Send the specified task ID to CSRSS in GetNextVDMCommand.
In ntvdm, parse the command line parameters to find the session ID, and pass it in
every call to GetNextVDMCommand.
svn path=/branches/ntvdm/; revision=63121
ZeroMemory(GetNextVdmCommand, sizeof(*GetNextVdmCommand));
/* Setup the input parameters */
+ GetNextVdmCommand->iTask = CommandData->TaskId;
GetNextVdmCommand->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
GetNextVdmCommand->CmdLen = CommandData->CmdLen;
GetNextVdmCommand->AppLen = CommandData->AppLen;
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
/* Initialize the structure members */
+ CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_FLAG_NESTED_TASK | VDM_FLAG_DONT_WAIT;
CommandInfo.CmdLine = CmdLine;
CommandInfo.CmdLen = sizeof(CmdLine);
if (CurrentPsp != SYSTEM_PSP)
{
/* Decrement the re-entry count */
+ CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_DEC_REENTER_COUNT;
GetNextVDMCommand(&CommandInfo);
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
/* Update the VDM state of the task */
+ CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_FLAG_DONT_WAIT;
GetNextVDMCommand(&CommandInfo);
}
static INT VdmMenuPos = -1;
static BOOLEAN ShowPointer = FALSE;
+ULONG SessionId = 0;
HANDLE VdmTaskEvent = NULL;
/*
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
/* Initialize the structure members */
+ CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_FLAG_DOS;
CommandInfo.CmdLine = CmdLine;
CommandInfo.CmdLen = sizeof(CmdLine);
return 0;
}
+#else
+ INT i;
+ WCHAR *endptr;
+
+ /* Parse the command line arguments */
+ for (i = 1; i < argc; i++)
+ {
+ if (wcsncmp(argv[i], L"-i", 2) == 0)
+ {
+ /* This is the session ID */
+ SessionId = wcstoul(argv[i] + 2, &endptr, 10);
+ }
+ }
+
#endif
DPRINT1("\n\n\nNTVDM - Starting...\n\n\n");
#include <stdio.h>
#include <stdarg.h>
#include <conio.h>
+#include <wchar.h>
#define WIN32_NO_STATUS
#include <windef.h>
/* FUNCTIONS ******************************************************************/
+extern ULONG SessionId;
extern HANDLE VdmTaskEvent;
VOID DisplayMessage(LPCWSTR Format, ...);