[NTVDM]
[reactos.git] / reactos / subsystems / mvdm / ntvdm / dos / dem.c
index 9deee83..92ef845 100644 (file)
 
 #define NDEBUG
 
+#include "ntvdm.h"
 #include "emulator.h"
 #include "utils.h"
 
 #include "dem.h"
+#include "dos/dos32krnl/device.h"
 #include "cpu/bop.h"
 
 #include "bios/bios.h"
 #include "mouse32.h"
 
-/* Extra PSDK/NDK Headers */
-#include <ndk/obtypes.h>
-
 /* PRIVATE VARIABLES **********************************************************/
 
 /**/extern BYTE CurrentDrive;/**/
 
-/* DEFINES ********************************************************************/
-
-/* BOP Identifiers */
-#define BOP_LOAD_DOS    0x2B    // DOS Loading and Initializing BOP. In parameter (following bytes) we take a NULL-terminated string indicating the name of the DOS kernel file.
-#define BOP_START_DOS   0x2C    // DOS Starting BOP. In parameter (following bytes) we take a NULL-terminated string indicating the name of the DOS kernel file.
-#define BOP_DOS         0x50    // DOS System BOP (for NTIO.SYS and NTDOS.SYS)
-#define BOP_CMD         0x54    // DOS Command Interpreter BOP (for COMMAND.COM)
-
 /* PRIVATE FUNCTIONS **********************************************************/
 
 static VOID WINAPI DosSystemBop(LPWORD Stack)
@@ -91,6 +82,20 @@ Quit:
             break;
         }
 
+        /* Call 32-bit Driver Strategy Routine */
+        case BOP_DRV_STRATEGY:
+        {
+            DeviceStrategyBop();
+            break;
+        }
+
+        /* Call 32-bit Driver Interrupt Routine */
+        case BOP_DRV_INTERRUPT:
+        {
+            DeviceInterruptBop();
+            break;
+        }
+
         default:
         {
             DPRINT1("Unknown DOS System BOP Function: 0x%02X\n", FuncNum);
@@ -201,7 +206,7 @@ CommandThreadProc(LPVOID Parameter)
     CHAR Desktop[MAX_PATH];
     CHAR Title[MAX_PATH];
     ULONG EnvSize = 256;
-    PVOID Env = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, EnvSize);
+    PVOID Env = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, EnvSize);
 
     UNREFERENCED_PARAMETER(Parameter);
     ASSERT(Env != NULL);
@@ -236,9 +241,10 @@ Command:
             {
                 /* Expand the environment size */
                 EnvSize = CommandInfo.EnvLen;
-                CommandInfo.Env = Env = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Env, EnvSize);
+                CommandInfo.Env = Env = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Env, EnvSize);
 
                 /* Repeat the request */
+                CommandInfo.VDMState |= VDM_FLAG_RETRY;
                 goto Command;
             }
 
@@ -259,7 +265,7 @@ Command:
     }
     while (AcceptCommands);
 
-    HeapFree(GetProcessHeap(), 0, Env);
+    RtlFreeHeap(RtlGetProcessHeap(), 0, Env);
     return 0;
 }
 #endif