Windows Command Prompt cm_ExecuteDOS WinExec() ShellExecute
Moderators: white, Hacker, petermad, Stefan2
Windows Command Prompt cm_ExecuteDOS WinExec() ShellExecute
The "Windows Command Prompt" is not fully function
Please find a description of the issue at the following links:
https://cygwin.com/ml/cygwin/2017-10/msg00162.html
https://cygwin.com/ml/cygwin/2017-10/msg00163.html
https://cygwin.com/ml/cygwin/2017-10/msg00223.html
Initially I reported it on the Cygwin mailing list because I thought it was related to gcc on Windows, then I realized it is actually related to the Total Commander's Command Prompt.
Moderation:
Subject line modified.
Jump to explanation post of the author > viewtopic.php?p=333774#333774
Please find a description of the issue at the following links:
https://cygwin.com/ml/cygwin/2017-10/msg00162.html
https://cygwin.com/ml/cygwin/2017-10/msg00163.html
https://cygwin.com/ml/cygwin/2017-10/msg00223.html
Initially I reported it on the Cygwin mailing list because I thought it was related to gcc on Windows, then I realized it is actually related to the Total Commander's Command Prompt.
Moderation:
Subject line modified.
Jump to explanation post of the author > viewtopic.php?p=333774#333774
What executable did you compile, 32 or 64 bit? Which TC version and architecture did you use exactly? How exactly did you start the program, double-click or menu Commands > Open command prompt window or something else?
In short, please provide more information. Currently I have my doubts that TC is the culprit.
Regards
Dalai
In short, please provide more information. Currently I have my doubts that TC is the culprit.
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: 48162
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Total commander simply starts the program defined via COMSPEC environment variable, which is usually cmd.exe - but may be changed on your system. I haven't heared of any programs which wouldn't run from such a command prompt.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
I compiled a 64 bit executable, using the 'x86_64-w64-mingw32-gcc' command as described in the first post linked above.
I am using TC 9.0a 64 bit, on Windows 7 64 bit.
I executed the program as follows: with TC navigate to the 'foo.exe' folder, click on menu Commands > Open command prompt window, execute 'foo.exe' + enter (I do not get any message).
If instead I open the Windows Command Prompt form the Start Menu, cd to the 'foo.exe' folder, and execute 'foo.exe' + enter I get the error message window shown in the second post linked above.
Unfortunately I cannot attach 'foo.exe' here, but it should be fairly easy to reproduce this issue following the instructions above.
You can also reproduce this issue with other (probably with all) binaries linked to a dll. For instance, if you have GIMP installed, you can reproduce it by renaming 'libcairo-2.dll' to something else, and executing 'gimp-2.8.exe' first in the Command Prompt opened from TC, and then in the Command Prompt opened from the Start Menu.
I am using TC 9.0a 64 bit, on Windows 7 64 bit.
I executed the program as follows: with TC navigate to the 'foo.exe' folder, click on menu Commands > Open command prompt window, execute 'foo.exe' + enter (I do not get any message).
If instead I open the Windows Command Prompt form the Start Menu, cd to the 'foo.exe' folder, and execute 'foo.exe' + enter I get the error message window shown in the second post linked above.
Unfortunately I cannot attach 'foo.exe' here, but it should be fairly easy to reproduce this issue following the instructions above.
You can also reproduce this issue with other (probably with all) binaries linked to a dll. For instance, if you have GIMP installed, you can reproduce it by renaming 'libcairo-2.dll' to something else, and executing 'gimp-2.8.exe' first in the Command Prompt opened from TC, and then in the Command Prompt opened from the Start Menu.
Hmm, 'paper chase' ? ( 'Schnitzeljagd' )
If I would have the time to clean up your description, I would get something like this:
If I would have the time to clean up your description, I would get something like this:
Correct?
Why I get no message if I launch the executable from TC command line?
I am using TC 9.0a 64 bit, on Windows 7 64 bit.
I compiled a 64 bit executable, using the 'x86_64-w64-mingw32-gcc' command as described in the first post linked above.
This executable should use the 'libfoo.dll', but I renamed them for an test so it can not be found.
... if I run a program compiled with 'gcc' without the proper shared libraries in path I get the following error message:
> error while loading shared libraries: libxxx.so: cannot open shared object file: No such file or directory
This is expected.
With Windows Command Prompt I get that message too:
If instead I open the Windows Command Prompt form the Start Menu, cd to the 'foo.exe' folder,
and execute 'foo.exe' + enter I get the error message window
---------------------------
foo.exe - System Error
---------------------------
The program can't start because libfoo.dll is missing from your computer. Try
reinstalling the program to fix this problem.
---------------------------
OK
---------------------------
But with TC I see no message:
I executed the program as follows: with TC navigate to the 'foo.exe' folder,
click on menu Commands > Open command prompt window,
execute 'foo.exe' + enter (I do not get any message).
So why I get no message if I launch the executable from TC command line?
Did you start TC as administrator? What happens when you launch cmd.exe via TC by navigating to C:\Windows\system32 and double click on cmd.exe?
OK, I tested your suggestion with GIMP now (had it installed anyway) and I can confirm the issue. Interestingly adding a button like thisor adding CMD to TC's start menu works just fine. Menu Commands > Open command prompt must do something different than the button bar or start menu.
But at least you have a workaround until the bug is fixed.
Regards
Dalai
OK, I tested your suggestion with GIMP now (had it installed anyway) and I can confirm the issue. Interestingly adding a button like this
Code: Select all
TOTALCMD#BAR#DATA
%SystemRoot%\System32\cmd.exe
%SystemRoot%\System32\cmd.exe
0
-1
But at least you have a workaround until the bug is fixed.
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
I tried to start TC as administrator and the result is the same (no error message window).
If I launch 'cmd.exe' via TC by navigating to 'C:\Windows\system32' and double clicking on 'cmd.exe', I get the correct error message window (same as running the Command Prompt from the Start Menu).
So I guess the TC menu 'Commands > Open command prompt window' does something else.
If I launch 'cmd.exe' via TC by navigating to 'C:\Windows\system32' and double clicking on 'cmd.exe', I get the correct error message window (same as running the Command Prompt from the Start Menu).
So I guess the TC menu 'Commands > Open command prompt window' does something else.
- ghisler(Author)
- Site Admin
- Posts: 48162
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It's probably because of a security feature: TC is set to not load any dlls from the current directory, because this can be used by viruses to inject their own dlls. Instead, the dll must be in the windows, system32, or one of the PATH directories.
wincmd.ini
[Configuration]
DllLoad=0
Set DLL load method for plugins and Explorer extensions:
-1: Never from current dir (most secure)
0: Only in context menu (needed e.g. for "Send To" with Outlook 2003)
1: always also from current dir (as TC7.55a and older)
wincmd.ini
[Configuration]
DllLoad=0
Set DLL load method for plugins and Explorer extensions:
-1: Never from current dir (most secure)
0: Only in context menu (needed e.g. for "Send To" with Outlook 2003)
1: always also from current dir (as TC7.55a and older)
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
I don't think this is the culprit. It's neither cmd.exe nor TC that is missing a DLL but the program that is launched by CMD (which itself has been launched via cm_ExecuteDOS). Furthermore I can also reproduce it with TC 7.04a, which - according to the help excerpt - should load all DLLs also from the current directory. And that still doesn't explain the difference between a button/start menu and cm_ExecuteDOS.
Please try it for yourself, e.g. with GIMP.
Regards
Dalai
I don't think this is the culprit. It's neither cmd.exe nor TC that is missing a DLL but the program that is launched by CMD (which itself has been launched via cm_ExecuteDOS). Furthermore I can also reproduce it with TC 7.04a, which - according to the help excerpt - should load all DLLs also from the current directory. And that still doesn't explain the difference between a button/start menu and cm_ExecuteDOS.
Please try it for yourself, e.g. with GIMP.
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: 48162
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I see - so what IS the culprit? Do I need to launch cmd.exe with special parameters?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
2ghisler(Author)
Not sure what the culprit is exactly (that's up to you to find out ), but the problem is this: A program is missing a DLL. In one case it tells the user about it, in another case it doesn't.
Summary:
Regards
Dalai
Not sure what the culprit is exactly (that's up to you to find out ), but the problem is this: A program is missing a DLL. In one case it tells the user about it, in another case it doesn't.
Summary:
- Open a CMD window (via TC's command line by typing C:\Windows\system32\cmd.exe, the button bar or TC's start menu). In the CMD window navigate to the program's directory and launch the program. It will show a window that says that it's missing a DLL and which one.
- Open a CMD window via cm_ExecuteDOS (Commands > Open command prompt). In the CMD window navigate to the program's directory and launch it. It will not show anything about the missing DLL!
Regards
Dalai
Last edited by Dalai on 2017-10-23, 14:55 UTC, edited 1 time in total.
#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
Hello
I think it depends on whether it is a windows programm or not.
I tested it with inkscape and renaming "libpangomm-1.4-1.dll to "_libpangomm-1.4-1.dll"
Executing portable inkscape (inkscape.com) within:
1. commando line (Kommandozeile), I get the error message box
2. commando line window (Befehle->Kommandozeilenfenster öffnen) no error box occured.
Regards
ffFan
I think it depends on whether it is a windows programm or not.
I tested it with inkscape and renaming "libpangomm-1.4-1.dll to "_libpangomm-1.4-1.dll"
Executing portable inkscape (inkscape.com) within:
1. commando line (Kommandozeile), I get the error message box
2. commando line window (Befehle->Kommandozeilenfenster öffnen) no error box occured.
Regards
ffFan
Win7/32 - TC8.51a
I am in the right folder.
Renamed 'libcairo-2.dl-l'
Double click in TC panel at 'gimp-2.8.exe' >> got the message.
Execute 'gimp-2.8.exe' from TC command line >> got the message.
Launch Windows Start > cmd > CD to folder > 'gimp-2.8.exe' >> got the message.
Have a Button
cmd /k
C:\Windows\system32\cmd.exe
>> 'gimp-2.8.exe' >> got the message.
Execute cm_ExecuteDOS and there in DOS 'gimp-2.8.exe' - no message
I am in the right folder.
Renamed 'libcairo-2.dl-l'
Double click in TC panel at 'gimp-2.8.exe' >> got the message.
Execute 'gimp-2.8.exe' from TC command line >> got the message.
Launch Windows Start > cmd > CD to folder > 'gimp-2.8.exe' >> got the message.
Have a Button
cmd /k
C:\Windows\system32\cmd.exe
>> 'gimp-2.8.exe' >> got the message.
Execute cm_ExecuteDOS and there in DOS 'gimp-2.8.exe' - no message
---------------------------
gimp-2.8.exe - Systemfehler
---------------------------
Das Programm kann nicht gestartet werden, da libcairo-2.dll auf dem
Computer fehlt. Installieren Sie das Programm erneut, um das Problem
zu beheben.
---------------------------
OK
---------------------------
- ghisler(Author)
- Site Admin
- Posts: 48162
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Command line sets current directory to the directory of the active panel. If the program only looks in current directory for the dll, then it will not find it.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com