Author: hbelusca
Date: Sat Aug 10 20:50:37 2013
New Revision: 59691
URL:
http://svn.reactos.org/svn/reactos?rev=59691&view=rev
Log:
[NTVDM]
- Use up to 256 parameters for programs (as suggested by the parsing while loop), but
don't hardcode this values in many other places.
- The passed command line to ntvdm should be as long as MAX_PATH.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
branches/ntvdm/subsystems/ntvdm/ntvdm.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] Sat Aug 10 20:50:37 2013
@@ -874,8 +874,8 @@
BOOLEAN Success = FALSE, AllocatedEnvBlock = FALSE;
HANDLE FileHandle = INVALID_HANDLE_VALUE, FileMapping = NULL;
LPBYTE Address = NULL;
- LPSTR ProgramFilePath, Parameters[128];
- CHAR CommandLineCopy[128];
+ LPSTR ProgramFilePath, Parameters[256];
+ CHAR CommandLineCopy[MAX_PATH];
INT ParamCount = 0;
WORD Segment = 0;
WORD MaxAllocSize;
@@ -891,11 +891,13 @@
/* 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");
/* Load the parameters in the local array */
- while ((ParamCount < 256)
+ while ((ParamCount < sizeof(Parameters)/sizeof(Parameters[0]))
&& ((Parameters[ParamCount] = strtok(NULL, " \t")) !=
NULL))
{
ParamCount++;
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sat Aug 10 20:50:37 2013
@@ -77,7 +77,7 @@
INT wmain(INT argc, WCHAR *argv[])
{
INT i;
- CHAR CommandLine[128];
+ CHAR CommandLine[MAX_PATH];
DWORD CurrentTickCount;
DWORD LastTickCount = GetTickCount();
DWORD Cycles = 0;
@@ -94,11 +94,11 @@
UNREFERENCED_PARAMETER(argv);
/* The DOS command line must be ASCII */
- WideCharToMultiByte(CP_ACP, 0, GetCommandLine(), -1, CommandLine, 128, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, GetCommandLine(), -1, CommandLine,
sizeof(CommandLine), NULL, NULL);
#else
if (argc == 2 && argv[1] != NULL)
{
- WideCharToMultiByte(CP_ACP, 0, argv[1], -1, CommandLine, 128, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, argv[1], -1, CommandLine, sizeof(CommandLine),
NULL, NULL);
}
else
{