Author: aandrejevic
Date: Tue Nov 12 01:56:18 2013
New Revision: 60959
URL:
http://svn.reactos.org/svn/reactos?rev=60959&view=rev
Log:
[NTVDM]
The command line in the PSP consists only of the parameters, the program
name is omitted.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Nov 12 01:56:18 2013
@@ -1025,6 +1025,7 @@
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;
@@ -1040,8 +1041,6 @@
/* 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");
@@ -1050,6 +1049,15 @@
&& ((Parameters[ParamCount] = strtok(NULL, " \t")) !=
NULL))
{
ParamCount++;
+ }
+
+ 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 */
@@ -1124,7 +1132,7 @@
/* Initialize the PSP */
DosInitializePsp(Segment,
- CommandLine,
+ ParamString,
(WORD)ExeSize,
EnvBlock);
@@ -1193,7 +1201,7 @@
/* Initialize the PSP */
DosInitializePsp(Segment,
- CommandLine,
+ ParamString,
MaxAllocSize,
EnvBlock);