mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:45:50 +00:00
[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. svn path=/branches/ntvdm/; revision=59691
This commit is contained in:
parent
b34e5646dd
commit
2288b2c576
2 changed files with 8 additions and 6 deletions
|
@ -874,8 +874,8 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
|
|||
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 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
|
|||
/* 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++;
|
||||
|
|
|
@ -77,7 +77,7 @@ BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType)
|
|||
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 @@ INT wmain(INT argc, WCHAR *argv[])
|
|||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue