[NTVDM]
[reactos.git] / subsystems / ntvdm / dos.c
index 147daaf..f56ed76 100644 (file)
@@ -1203,6 +1203,12 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
         /* Set the stack to the last word of the segment */
         EmulatorSetStack(Segment, 0xFFFE);
 
+        /*
+         * Set the value on the stack to 0, so that a near return
+         * jumps to PSP:0000 which has the exit code.
+         */
+        *((LPWORD)SEG_OFF_TO_PTR(Segment, 0xFFFE)) = 0;
+
         /* Execute */
         CurrentPsp = Segment;
         DiskTransferArea = MAKELONG(0x80, Segment);
@@ -2334,8 +2340,9 @@ VOID DosInt21h(LPWORD Stack)
         case 0x62:
         {
             /*
-             * Identical to the documented AH=62h.
+             * Undocumented AH=51h is identical to the documented AH=62h.
              * See Ralf Brown: http://www.ctyme.com/intr/rb-2982.htm
+             * and http://www.ctyme.com/intr/rb-3140.htm
              * for more information.
              */
             setBX(CurrentPsp);