Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed executable error, unable to run #12

Closed
cpkio opened this issue Oct 8, 2022 · 30 comments
Closed

Renamed executable error, unable to run #12

cpkio opened this issue Oct 8, 2022 · 30 comments

Comments

@cpkio
Copy link

cpkio commented Oct 8, 2022

After updating I cannot run it anymore, getting Renamed executable dialog window.

Windows 10 x64 1803

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Ok. Strange. Are you sure that the name hasn't been changed? The name should be 'swirc.exe' in all lower case, including the file extension 'exe'. Try to rename it from the Windows command prompt using the command 'ren' or 'rename'. Type 'ren /?' to see the command syntax. For example if the name is currently 'swirc.EXE' try 'ren swirc.EXE swirc.exe'.

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Because the name check was there in the previous version too...

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Perhaps I can remove the check completely or make it less strict. But try using 'ren'.

@cpkio
Copy link
Author

cpkio commented Oct 8, 2022

The file name is correct. The MSI package does not work after installation, which is strange, I didnt rename anything. Moreover, the same package works fine in another Windows installation (21H2 if I remember correctly). What can be the reason of this behavior beyond file name itself?

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Not sure yet.

The code is here:

if (_get_pgmptr(&pgm) == 0) {

str = sw_strdup(pgm);

if ((cp = strstr(str, "\\swirc.exe")) == NULL) {

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Maybe _get_pgmptr() returns something unexpected or its behavior has changed. But if 3.3.5 works it's strange because that code is in 3.3.5 too.

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Maybe it returns something like c:/path/to/swirc/swirc.exe instead of c:\path\to\swirc\swirc.exe thus strstr() returns NULL.

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Don't know if it's possible to rename a file to '\swirc.exe' under Windows, I currently don't have access to my Windows laptop, but you could try that and see if it works.

@cpkio
Copy link
Author

cpkio commented Oct 8, 2022

if it's possible to rename a file to '\swirc.exe' under Windows

It is not possible, \ is a path separator character in Windows systems.

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Yeah, thought so :\

@cpkio
Copy link
Author

cpkio commented Oct 8, 2022

btw Windows is not case-sensitive, you can type executable name in capitals and it will run. I cannot guarantee OS returns filename as it is in file system, it can uppercase it maybe.

if you changed building toolchain it may affect this too

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Yes, but strstr() is case-sensitive. Perhaps I should replace it with strcasestr(). But it would've been good to know what _get_pgmptr() stores/outputs on your system. I suspect it's something with the path separators. But does 3.3.5 work fine?

@cpkio
Copy link
Author

cpkio commented Oct 8, 2022

The last working version for me seems to be 3.3.3… If there ever will be out-of-the-box-portable versions I will try to play around more. I see you've added libintl/libidn, maybe the mess around with filenames?

@uhlin
Copy link
Owner

uhlin commented Oct 8, 2022

Yeah, 3.3.3 didn't have that code... I will fix this when I have access to my Windows computer. Thanks for reporting. But it would've been nice to see what the output of _get_pgmptr() is on your system. I can compile a small program that does it, but not right now, no Windows environment currently...

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

I compiled a small program that shows the output of _get_pgmptr(), if you can put the exe in the same dir as swirc and run it and tell me the output of it, would've been good. I attach both the c source and the exe.
pgmptr.zip

@cpkio
Copy link
Author

cpkio commented Oct 9, 2022

i:\_tools_\_internet_\Swirc\pgmptr.exe
Type <RETURN> to exit

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

Ok, hmm, it looks correct/like expected. Can you send me swirc.exe in i:\_tools_\_internet_\Swirc\? I think you need to zip it in order to attach it here.

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

I can recommend 7-zip for Windows. But you are probably an advanced user so you know already. :)

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

I really suspect that the actual name of swirc.exe isn't really swirc.exe, maybe it's swirc.EXE, after I saw the output of pgmptr. This can be fixed easily.

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

That's the only possibility. I will close this with a small fix if you don't respond (maybe it's night there). And I will build a new .msi which I will upload at https://www.nifty-networks.net/swirc/windows.html including the fix.

@cpkio
Copy link
Author

cpkio commented Oct 9, 2022

My system should not substitute extensions case, AFAIK… dir in CMD and ls in Powershell show same case. BTW, I have systemwide UTF-8 support enabled in Windows and have non-english locale, maybe that matters in conjunction with libintl

What version of swirc.exe you need, 3.3.6? here

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

Yeah, 3.3.6

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

Nothing with libintl, the failing part is the strstr() call

@uhlin
Copy link
Owner

uhlin commented Oct 9, 2022

It doesn't find the substring \swirc.exe (case-sensitive) in the string returned by _get_pgmptr().

@uhlin uhlin closed this as completed in 02bf8dd Oct 9, 2022
@uhlin uhlin reopened this Oct 9, 2022
@uhlin
Copy link
Owner

uhlin commented Oct 15, 2022

I currently don't have access to my Windows environment again. But I will test to use strcasestr() instead. I leave the issue open... Thanks again for reporting.

@uhlin
Copy link
Owner

uhlin commented Oct 16, 2022

I created a new installer with the strcasestr() change. Can you try it and see if it works?
It's here:
https://www.nifty-networks.net/swirc/tmp/Swirc-3.3.6.msi

@cpkio
Copy link
Author

cpkio commented Oct 16, 2022

Still does not work.

@uhlin
Copy link
Owner

uhlin commented Oct 16, 2022

Ok, I think I know the problem now.
https://www.nifty-networks.net/swirc/tmp/asdf/Swirc-3.3.6.msi
That one works, right?

@cpkio
Copy link
Author

cpkio commented Oct 16, 2022

Yes, it does run.

@uhlin
Copy link
Owner

uhlin commented Oct 16, 2022

Cool. I will upload an official fix at https://www.nifty-networks.net/swirc/windows.html. For some reason _get_pgmptr() returns an empty string on your system, but only in Swirc (because we tested with a small C program).

@uhlin uhlin closed this as completed in 4b8b141 Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants