Meaningful error message when program start fails
Moderators: white, Hacker, petermad, Stefan2
Uh, this is not about Windows 10. I'm testing on XP (and Win2k where my Delphi is), because it's easier in this particular case.
OK, to summarize: TC 9.20 beta5 shows "Access denied" in its own error dialog (not the Windows one) when trying to launch FB-Traffic on XP - just like it did in previous betas/versions. My test program shows "%1 is not a valid Win32 application", similar to the Windows message when launching the file via TC's context menu. Logic tells me there is something different in TC, maybe FormatMessage doesn't get the message from the system or it's lost somewhere before it gets to the user. As I already said, I don't know what I can do to assist you.
Regards
Dalai
OK, to summarize: TC 9.20 beta5 shows "Access denied" in its own error dialog (not the Windows one) when trying to launch FB-Traffic on XP - just like it did in previous betas/versions. My test program shows "%1 is not a valid Win32 application", similar to the Windows message when launching the file via TC's context menu. Logic tells me there is something different in TC, maybe FormatMessage doesn't get the message from the system or it's lost somewhere before it gets to the user. As I already said, I don't know what I can do to assist you.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Thank you for looking into this issue I have also raised in the past.
I confirm that Beta 5 still doesn't display a correct error message on 2k/XP/2008/Seven for programs that require new subsystem version (increasingly common) or 64-bit machine. It now shows two lines of access denied instead of one like in the past.
Access denied!
"Access is denied."
For 64-bit binaries, x86 NT6.0 provides a helpful message that is a paragraph long (but not shown in TC).
"The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86..." (they could simplify and just tell the required version...)
Is it not possible to make double-click perform the same action as launching an exe from explorer/right-click with all error dialogs?
The double error reminds me of doors in video game Half-Life.
I confirm that Beta 5 still doesn't display a correct error message on 2k/XP/2008/Seven for programs that require new subsystem version (increasingly common) or 64-bit machine. It now shows two lines of access denied instead of one like in the past.
Access denied!
"Access is denied."
For 64-bit binaries, x86 NT6.0 provides a helpful message that is a paragraph long (but not shown in TC).
"The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86..." (they could simplify and just tell the required version...)
Is it not possible to make double-click perform the same action as launching an exe from explorer/right-click with all error dialogs?
The double error reminds me of doors in video game Half-Life.
#148174 Personal license
Running Total Commander v8.52a
Running Total Commander v8.52a
This is done when TC's language differs from the OS language or the error message is potentially different. This should work for "simple" error texts that don't contain placeholders like %1, like the one you mentioned regarding x64 programs on 32 bit Windows.j7n wrote:It now shows two lines of access denied instead of one like in the past.
Access denied!
"Access is denied."
Yes, that's another good test case which Ghisler can use. Apparently even that error text isn't shown by TC, because it also contains a placeholder:For 64-bit binaries, x86 NT6.0 provides a helpful message that is a paragraph long (but not shown in TC).
Note that this error text slightly differs from the one shown by Explorer. Thus I searched where the error texts come from, and it looks like the FormatMessage function reads the error texts (in this case) from kernel32.dll(.mui), while Explorer reads it from shell32.dll(.mui).Windows wrote:This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.
Well, the goal of this thread is that TC shows the same error text as Windows does, and with the suggested code it can be achieved. Ghisler just needs to find out what he does differently in TC. In the end, it's not the same action, but at least the end result (the error text) is the same.Is it not possible to make double-click perform the same action as launching an exe from explorer/right-click with all error dialogs?
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48083
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It's probably because I'm not using GetLastError, but instead use the error returned in hInstApp:
I will try using GetLastError instead.If the function fails, it is set to an SE_ERR_XXX error value that indicates the cause of the failure.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Aha! Well, you could use both GetLastError and hInstApp, but as I see it, the latter only contains some generic error code that is not really helpful.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48083
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Yes indeed! In Beta 6, I'm now using GetLastError. Please let me know whether it makes any difference. I have also extended the buffer to 1024 characters.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Ah, what a relief! Finally useful error texts in that message box, thank you!
Regards
Dalai
I second that. @Ghisler: I guess that, if you don't want FormatMessage to handle that replacement, a simple StringReplace of %1 with the executable name would be enough. In other words, I wouldn't bother with placeholders starting from %2.j7n wrote:However, a literal "%1" is shown. Maybe you can replace it with the name of the exe file to make the text nicer for non-technical users.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- ghisler(Author)
- Site Admin
- Posts: 48083
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It seems following may be related to the issue described here.
I treid to launch exe (c:\ProgramData\Microsoft\Windows\WER\ReportQueue\tc920x32_64_b3.exe) from a dir where NTFS rights don't allow this (at least here on Vista 32 bit) from TC 9.20 beta 6.
TC 9.20 beta 6 on Vista 32 bit still shows simple "Access denied" error:
When to try to launch it from context menu, Windows shows following error:
I treid to launch exe (c:\ProgramData\Microsoft\Windows\WER\ReportQueue\tc920x32_64_b3.exe) from a dir where NTFS rights don't allow this (at least here on Vista 32 bit) from TC 9.20 beta 6.
TC 9.20 beta 6 on Vista 32 bit still shows simple "Access denied" error:
Code: Select all
---------------------------
Total Commander
---------------------------
Access denied!
"Отказано в доступе."
---------------------------
ОК
---------------------------
Code: Select all
[Window Title]
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\tc920x32_64_b3.exe
[Content]
Отказано в доступе к указанному устройству, пути или файлу. Возможно, у вас нет нужных прав доступа к этому объекту.
[ОК]
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
For my sample case TC 9.20 RC1 now also shows file name in error window:
but the error text is still different from one in Windows error window (see original post). Should it be like that?
Code: Select all
---------------------------
Total Commander
---------------------------
Access denied on file
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\tc920x32_64_b3.exe!
"Отказано в доступе."
---------------------------
ОК
---------------------------
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
I can confirm DrShark's findings. Unfortunately, I don't know why this happens. Even my test program doesn't show anything more than "Access denied" when NTFS permissions don't allow the execution of executables. It seems that GetLastError doesn't help in finding the reason why the execution failed in such a case. I wonder what Explorer does beyond that ...
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
The longer message doesn't provide more information. It just repeats the basic error in two long sentences. "Access is denied. Perhaps you don't have access rights." It gives an illusion of more information, but doesn't really say whether the access restriction is on the "device, path or file". I think the two words are sufficient if they aren't shown for the other cases that have nothing to do with "access".
#148174 Personal license
Running Total Commander v8.52a
Running Total Commander v8.52a