Author: aandrejevic
Date: Sat Nov 9 18:10:21 2013
New Revision: 60904
URL: http://svn.reactos.org/svn/reactos?rev=60904&view=rev
Log:
[NTVDM]
Allow COM programs to exit with a simple near return to PSP:0000. Spotted by Thomas Faber.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Sat Nov 9 18:10:21 2013
@@ -1203,6 +1203,12 @@
/* 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);
Author: aandrejevic
Date: Sat Nov 9 16:15:24 2013
New Revision: 60900
URL: http://svn.reactos.org/svn/reactos?rev=60900&view=rev
Log:
[NTVDM]
Instead of repeating the BOP, simply handle both 0x51 and 0x62 as the same function.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Sat Nov 9 16:15:24 2013
@@ -2330,6 +2330,8 @@
/* Internal - Get Current Process ID (Get PSP Address) */
case 0x51:
+ /* Get Current PSP Address */
+ case 0x62:
{
/*
* Identical to the documented AH=62h.
@@ -2393,24 +2395,6 @@
setAX(ERROR_INVALID_FUNCTION);
}
- break;
- }
-
- /* Get Current PSP Address */
- case 0x62:
- {
- /*
- * Identical to the undocumented AH=51h.
- * See Ralf Brown: http://www.ctyme.com/intr/rb-3140.htm
- * for more information.
- */
- setAH(0x51); // Call the internal function.
- /*
- * Instead of calling ourselves really recursively as in:
- * DosInt21h(Stack);
- * prefer resetting the CF flag to let the BOP repeat.
- */
- setCF(1);
break;
}