Okay, here's a test program: #include <windows.h> #include <stdio.h>
int main(int argc, const char *argv[]) { LPCSTR cmd;
printf("argv[0] is %s\n", argv[0]); cmd = GetCommandLineA(); printf("GetCommandLine returns %s\n", cmd); return strcmp(argv[0], cmd); }
Under Windows 2000, cmd.exe, run from the current directory, I get: argv[0] is cmdlinetest.exe GetCommandLine returns cmdlinetest.exe
Under Windows 2000, command.com, run from the current directory, I get: argv[0] is CMDLIN~1.exe GetCommandLine returns CMDLIN~1.exe
Under Windows 2000, run from the debugger, I get: argv[0] is c:\src\cmdlinetest\Debug\cmdlinetest.exe GetCommandLineA returns "c:\src\cmdlinetest\Debug\cmdlinetest.exe" (This case is interesting because it shows argv[0] and GetCommandLineA can be different even without arguments.)
Under Windows ME, command.com, run from the current directory, I get: argv[0] is C:\SRC\CMDLIN~1\DEBUG\CMDLIN~1.EXE GetCommandLine returns C:\SRC\CMDLIN~1\DEBUG\CMDLIN~1.EXE
This is the same executable, so it isn't a different _CRTMainStartup. I think this supports Frank's assertion.
--Juan
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html
Juan Lang juan_lang@yahoo.com writes:
This is the same executable, so it isn't a different _CRTMainStartup. I think this supports Frank's assertion.
No, the interesting case is what happens with CreateProcess. Launching the app from cmd.exe doesn't tell you anything, because you don't know exactly what arguments cmd.exe passed to CreateProcess.
--- Alexandre Julliard julliard@winehq.com wrote:
No, the interesting case is what happens with CreateProcess. Launching the app from cmd.exe doesn't tell you anything, because you don't know exactly what arguments cmd.exe passed to CreateProcess.
You're right, as usual :)
I created another test case: #include <windows.h> #include <stdio.h>
int main(int argc, const char *argv[]) { if (argc <= 1) { PROCESS_INFORMATION procInfo; STARTUPINFO startInfo;
memset(&startInfo, 0, sizeof(startInfo)); startInfo.cb = sizeof(startInfo); if (CreateProcessA(NULL, "cmdlinetest.exe 1", NULL, NULL, FALSE, 0, NULL, NULL, &startInfo, &procInfo)) { CloseHandle(procInfo.hProcess); CloseHandle(procInfo.hThread); } } else { LPCSTR cmd;
printf("argv[0] is %s\n", argv[0]); cmd = GetCommandLineA(); printf("GetCommandLine returns %s\n", cmd); } return 0; }
With this, the output under win9x is: argv[0] is cmdlinetest.exe GetCommandLine returns cmdlinetest.exe 1
So, Frank, sorry, this isn't the way GetCommandLine actually behaves under Win9x. --Juan
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html