deliver full path by argv[0] and GetCommandLine for win9x

Juan Lang juan_lang at yahoo.com
Thu Feb 12 11:46:07 CST 2004


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



More information about the wine-devel mailing list