It was ignoring the command line parameters
because there was an extraneous argv[1] that was a repeat of the module name, but in quotation marks. The processing in pcmain stops on the first argument that doesn't start with '-' so my other arguments got ignored. argv[0] 0x00b40800 "C:\test\binary\nethackw.exe" argv[1] 0x00b40878 ""C:\test\binary\nethackw.exe"" argv[2] 0x00b408f0 "-uwizard" argv[3] 0x00b40938 "-D"
This commit is contained in:
+5
-6
@@ -75,12 +75,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||||||
wizard = TRUE;
|
wizard = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get command line parameters */
|
/* get command line parameters */
|
||||||
GetModuleFileName(NULL, wbuf, BUFSZ);
|
|
||||||
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
|
|
||||||
|
|
||||||
p = _tcstok(GetCommandLine(), TEXT(" "));
|
p = _tcstok(GetCommandLine(), TEXT(" "));
|
||||||
for( argc=1; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
|
for( argc=0; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
|
||||||
len = _tcslen(p);
|
len = _tcslen(p);
|
||||||
if( len>0 ) {
|
if( len>0 ) {
|
||||||
argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
|
argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
|
||||||
@@ -89,7 +86,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
p = _tcstok(NULL, TEXT(" "));
|
p = _tcstok(NULL, TEXT(" "));
|
||||||
}
|
}
|
||||||
|
GetModuleFileName(NULL, wbuf, BUFSZ);
|
||||||
|
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
|
||||||
|
|
||||||
pcmain(argc,argv);
|
pcmain(argc,argv);
|
||||||
|
|
||||||
moveloop();
|
moveloop();
|
||||||
|
|||||||
Reference in New Issue
Block a user