Author: aandrejevic
Date: Fri May  2 22:23:34 2014
New Revision: 63121

URL: http://svn.reactos.org/svn/reactos?rev=63121&view=rev
Log:
[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.


Modified:
    branches/ntvdm/dll/win32/kernel32/client/vdm.c
    branches/ntvdm/subsystems/ntvdm/dos/dos32krnl/dos.c
    branches/ntvdm/subsystems/ntvdm/ntvdm.c
    branches/ntvdm/subsystems/ntvdm/ntvdm.h

Modified: branches/ntvdm/dll/win32/kernel32/client/vdm.c
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/dll/win32/kernel32/client/vdm.c?rev=63121&r1=63120&r2=63121&view=diff
==============================================================================
--- branches/ntvdm/dll/win32/kernel32/client/vdm.c      [iso-8859-1] (original)
+++ branches/ntvdm/dll/win32/kernel32/client/vdm.c      [iso-8859-1] Fri May  2 
22:23:34 2014
@@ -1149,6 +1149,7 @@
             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;

Modified: branches/ntvdm/subsystems/ntvdm/dos/dos32krnl/dos.c
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos/dos32krnl/dos.c?rev=63121&r1=63120&r2=63121&view=diff
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Fri May  2 
22:23:34 2014
@@ -1336,6 +1336,7 @@
             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 @@
     if (CurrentPsp != SYSTEM_PSP)
     {
         /* Decrement the re-entry count */
+        CommandInfo.TaskId = SessionId;
         CommandInfo.VDMState = VDM_DEC_REENTER_COUNT;
         GetNextVDMCommand(&CommandInfo);
 
@@ -1462,6 +1464,7 @@
         ZeroMemory(&CommandInfo, sizeof(CommandInfo));
 
         /* Update the VDM state of the task */
+        CommandInfo.TaskId = SessionId;
         CommandInfo.VDMState = VDM_FLAG_DONT_WAIT;
         GetNextVDMCommand(&CommandInfo);
     }

Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?rev=63121&r1=63120&r2=63121&view=diff
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c     [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c     [iso-8859-1] Fri May  2 
22:23:34 2014
@@ -39,6 +39,7 @@
 static INT   VdmMenuPos    = -1;
 static BOOLEAN ShowPointer = FALSE;
 
+ULONG SessionId = 0;
 HANDLE VdmTaskEvent = NULL;
 
 /*
@@ -382,6 +383,7 @@
         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 @@
         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");

Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h
URL: 
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?rev=63121&r1=63120&r2=63121&view=diff
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.h     [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.h     [iso-8859-1] Fri May  2 
22:23:34 2014
@@ -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 @@
 
 /* FUNCTIONS 
******************************************************************/
 
+extern ULONG SessionId;
 extern HANDLE VdmTaskEvent;
 
 VOID DisplayMessage(LPCWSTR Format, ...);


Reply via email to