Author: aandrejevic
Date: Sat May 30 02:23:44 2015
New Revision: 67961

URL: http://svn.reactos.org/svn/reactos?rev=67961&view=rev
Log:
[NTVDM][BASESRV]
- When a DOS application is started by a process that has no console,
the ConsoleHandle in the VDM_CONSOLE_RECORD is initially NULL.
Fix that by making an initial VDM_GET_FIRST_COMMAND call in NTVDM
and setting the ConsoleHandle to the handle of NTVDM's console in
BaseSrvGetNextVDMCommand.
- Fix a bug in BaseSrvGetVDMExitCode (VDM_READY means the task has exited).


Modified:
    trunk/reactos/subsystems/mvdm/ntvdm/dos/dem.c
    trunk/reactos/subsystems/win/basesrv/vdm.c

Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dem.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/dem.c?rev=67961&r1=67960&r2=67961&view=diff
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/dos/dem.c       [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/dos/dem.c       [iso-8859-1] Sat May 30 
02:23:44 2015
@@ -216,6 +216,14 @@
 
     UNREFERENCED_PARAMETER(Parameter);
     ASSERT(Env);
+
+    /* Clear the structure */
+    RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));
+
+    /* Get the initial information */
+    CommandInfo.TaskId = SessionId;
+    CommandInfo.VDMState = VDM_GET_FIRST_COMMAND | VDM_FLAG_DOS;
+    GetNextVDMCommand(&CommandInfo);
 
     do
     {

Modified: trunk/reactos/subsystems/win/basesrv/vdm.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win/basesrv/vdm.c?rev=67961&r1=67960&r2=67961&view=diff
==============================================================================
--- trunk/reactos/subsystems/win/basesrv/vdm.c  [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win/basesrv/vdm.c  [iso-8859-1] Sat May 30 
02:23:44 2015
@@ -976,6 +976,13 @@
                 goto Cleanup;
             }
 
+            /* Check if the console handle hasn't been set yet */
+            if (ConsoleRecord->ConsoleHandle == NULL)
+            {
+                /* Set it now */
+                ConsoleRecord->ConsoleHandle = 
GetNextVdmCommandRequest->ConsoleHandle;
+            }
+
             /* Fill the command information */
             Status = BaseSrvFillCommandInfo(DosRecord->CommandInfo, 
GetNextVdmCommandRequest);
             goto Cleanup;
@@ -1204,7 +1211,7 @@
     }
 
     /* Check if this task is still running */
-    if (DosRecord->State == VDM_READY)
+    if (DosRecord->State != VDM_READY)
     {
         GetVDMExitCodeRequest->ExitCode = STATUS_PENDING;
         goto Cleanup;


Reply via email to