[NTVDM]
[reactos.git] / reactos / subsystems / ntvdm / dos / dem.c
index f78dab8..9e58d72 100644 (file)
 #include "utils.h"
 
 #include "dem.h"
-#include "bop.h"
+#include "cpu/bop.h"
 
 #include "bios/bios.h"
-#include "hardware/vga.h"
+#include "mouse32.h"
 
 /* Extra PSDK/NDK Headers */
 #include <ndk/obtypes.h>
@@ -48,7 +48,7 @@ static VOID WINAPI DosSystemBop(LPWORD Stack)
     {
         case 0x11:  // Load the DOS kernel
         {
-            BOOLEAN Success;
+            BOOLEAN Success = FALSE;
             HANDLE  hDosKernel;
             ULONG   ulDosKernelSize = 0;
 
@@ -91,7 +91,6 @@ Quit:
 
         default:
         {
-
             DPRINT1("Unknown DOS System BOP Function: 0x%02X\n", FuncNum);
             // setCF(1); // Disable, otherwise we enter an infinite loop
             break;
@@ -120,8 +119,8 @@ static VOID WINAPI DosCmdInterpreterBop(LPWORD Stack)
             STARTUPINFOA StartupInfo;
             PROCESS_INFORMATION ProcessInformation;
 
-            /* NULL-terminate the command by removing the return carriage character */
-            while (*CmdPtr != '\r') CmdPtr++;
+            /* NULL-terminate the command line by removing the return carriage character */
+            while (*CmdPtr && *CmdPtr != '\r') CmdPtr++;
             *CmdPtr = '\0';
 
             DPRINT1("CMD Run Command '%s'\n", Command);
@@ -138,8 +137,7 @@ static VOID WINAPI DosCmdInterpreterBop(LPWORD Stack)
 
             StartupInfo.cb = sizeof(StartupInfo);
 
-            VgaRefreshDisplay();
-            VgaDetachFromConsole(FALSE);
+            VidBiosDetachFromConsole();
 
             Result = CreateProcessA(NULL,
                                     CommandLine,
@@ -171,9 +169,7 @@ static VOID WINAPI DosCmdInterpreterBop(LPWORD Stack)
                 dwExitCode = GetLastError();
             }
 
-            VgaAttachToConsole();
-            VgaRefreshDisplay();
-            VidBiosSyncCursorPosition();
+            VidBiosAttachToConsole();
 
             setAL((UCHAR)dwExitCode);
 
@@ -238,6 +234,7 @@ BOOLEAN DosInitialize(IN LPCSTR DosKernelFileName)
         BOOLEAN Result;
 
         Result  = DosBIOSInitialize();
+        DosMouseInitialize(); // FIXME: Should be done by the DOS BIOS
         // Result &= DosKRNLInitialize();
 
         return Result;