The command line in the PSP consists only of the parameters, the program
name is omitted.
svn path=/branches/ntvdm/; revision=60959
LPBYTE Address = NULL;
LPSTR ProgramFilePath, Parameters[256];
CHAR CommandLineCopy[DOS_CMDLINE_LENGTH];
LPBYTE Address = NULL;
LPSTR ProgramFilePath, Parameters[256];
CHAR CommandLineCopy[DOS_CMDLINE_LENGTH];
+ CHAR ParamString[DOS_CMDLINE_LENGTH];
INT ParamCount = 0;
WORD Segment = 0;
WORD MaxAllocSize;
INT ParamCount = 0;
WORD Segment = 0;
WORD MaxAllocSize;
/* Save a copy of the command line */
strcpy(CommandLineCopy, CommandLine);
/* Save a copy of the command line */
strcpy(CommandLineCopy, CommandLine);
- // FIXME: Improve parsing (especially: "some_path\with spaces\program.exe" options)
-
/* Get the file name of the executable */
ProgramFilePath = strtok(CommandLineCopy, " \t");
/* Get the file name of the executable */
ProgramFilePath = strtok(CommandLineCopy, " \t");
+ ZeroMemory(ParamString, sizeof(ParamString));
+
+ /* Store the parameters in a string */
+ for (i = 0; i < ParamCount; i++)
+ {
+ strncat(ParamString, Parameters[i], DOS_CMDLINE_LENGTH - strlen(ParamString) - 1);
+ strncat(ParamString, " ", DOS_CMDLINE_LENGTH - strlen(ParamString) - 1);
+ }
+
/* Open a handle to the executable */
FileHandle = CreateFileA(ProgramFilePath,
GENERIC_READ,
/* Open a handle to the executable */
FileHandle = CreateFileA(ProgramFilePath,
GENERIC_READ,
/* Initialize the PSP */
DosInitializePsp(Segment,
/* Initialize the PSP */
DosInitializePsp(Segment,
(WORD)ExeSize,
EnvBlock);
(WORD)ExeSize,
EnvBlock);
/* Initialize the PSP */
DosInitializePsp(Segment,
/* Initialize the PSP */
DosInitializePsp(Segment,