[NTVDM][KERNEL32]

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
This commit is contained in:
Aleksandar Andrejevic
2014-05-02 22:23:34 +00:00
parent 9c142126d3
commit 9b7d069e2e
4 changed files with 22 additions and 0 deletions
+1
View File
@@ -1149,6 +1149,7 @@ GetNextVDMCommand(PVDM_COMMAND_INFO CommandData)
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;
+3
View File
@@ -1336,6 +1336,7 @@ WORD DosCreateProcess(DOS_EXEC_TYPE LoadType,
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);
@@ -1455,6 +1456,7 @@ Done:
if (CurrentPsp != SYSTEM_PSP)
{
/* Decrement the re-entry count */
CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_DEC_REENTER_COUNT;
GetNextVDMCommand(&CommandInfo);
@@ -1462,6 +1464,7 @@ Done:
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
/* Update the VDM state of the task */
CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_FLAG_DONT_WAIT;
GetNextVDMCommand(&CommandInfo);
}
+16
View File
@@ -39,6 +39,7 @@ static HMENU hConsoleMenu = NULL;
static INT VdmMenuPos = -1;
static BOOLEAN ShowPointer = FALSE;
ULONG SessionId = 0;
HANDLE VdmTaskEvent = NULL;
/*
@@ -382,6 +383,7 @@ DWORD WINAPI CommandThreadProc(LPVOID Parameter)
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
/* Initialize the structure members */
CommandInfo.TaskId = SessionId;
CommandInfo.VDMState = VDM_FLAG_DOS;
CommandInfo.CmdLine = CmdLine;
CommandInfo.CmdLen = sizeof(CmdLine);
@@ -455,6 +457,20 @@ INT wmain(INT argc, WCHAR *argv[])
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");
+2
View File
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <conio.h>
#include <wchar.h>
#define WIN32_NO_STATUS
#include <windef.h>
@@ -33,6 +34,7 @@ DWORD WINAPI SetLastConsoleEventActive(VOID);
/* FUNCTIONS ******************************************************************/
extern ULONG SessionId;
extern HANDLE VdmTaskEvent;
VOID DisplayMessage(LPCWSTR Format, ...);