[NTVDM]: Zero-fill memory with RtlZeroMemory (that exists also in NT mode), and use...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 14 Oct 2014 22:46:40 +0000 (22:46 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 14 Oct 2014 22:46:40 +0000 (22:46 +0000)
svn path=/trunk/; revision=64747

reactos/subsystems/ntvdm/dos/dem.c
reactos/subsystems/ntvdm/dos/dos32krnl/bios.c
reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
reactos/subsystems/ntvdm/dos/mouse32.c
reactos/subsystems/ntvdm/hardware/cmos.c
reactos/subsystems/ntvdm/hardware/mouse.c
reactos/subsystems/ntvdm/hardware/vga.c
reactos/subsystems/ntvdm/io.c

index 2e20a9c..0389ac1 100644 (file)
@@ -134,8 +134,8 @@ static VOID WINAPI DosCmdInterpreterBop(LPWORD Stack)
             strcpy(CommandLine, "cmd.exe /c ");
             strcat(CommandLine, Command);
 
-            ZeroMemory(&StartupInfo, sizeof(StartupInfo));
-            ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
+            RtlZeroMemory(&StartupInfo, sizeof(StartupInfo));
+            RtlZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
 
             StartupInfo.cb = sizeof(StartupInfo);
 
@@ -209,7 +209,7 @@ CommandThreadProc(LPVOID Parameter)
     do
     {
         /* Clear the structure */
-        ZeroMemory(&CommandInfo, sizeof(CommandInfo));
+        RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));
 
         /* Initialize the structure members */
         CommandInfo.TaskId = SessionId;
index 428807e..5c0fbcc 100644 (file)
@@ -168,7 +168,7 @@ BOOLEAN DosBIOSInitialize(VOID)
 #if 0
 
     /* Clear the current directory buffer */
-    ZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
+    RtlZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
 
     /* Get the current directory */
     if (!GetCurrentDirectoryA(MAX_PATH, CurrentDirectory))
index 3b96205..f98ef75 100644 (file)
@@ -860,7 +860,7 @@ VOID DosInitializePsp(WORD PspSegment, LPCSTR CommandLine, WORD ProgramSize, WOR
     PDOS_PSP PspBlock = SEGMENT_TO_PSP(PspSegment);
     LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress);
 
-    ZeroMemory(PspBlock, sizeof(DOS_PSP));
+    RtlZeroMemory(PspBlock, sizeof(*PspBlock));
 
     /* Set the exit interrupt */
     PspBlock->Exit[0] = 0xCD; // int 0x20
@@ -1204,8 +1204,8 @@ WORD DosCreateProcess(DOS_EXEC_TYPE LoadType,
     }
 
     /* Set up the startup info structure */
-    ZeroMemory(&StartupInfo, sizeof(STARTUPINFOA));
-    StartupInfo.cb = sizeof(STARTUPINFOA);
+    RtlZeroMemory(&StartupInfo, sizeof(StartupInfo));
+    StartupInfo.cb = sizeof(StartupInfo);
 
     /* Create the process */
     if (!CreateProcessA(ProgramName,
@@ -1230,7 +1230,7 @@ WORD DosCreateProcess(DOS_EXEC_TYPE LoadType,
         case SCS_WOW_BINARY:
         {
             /* Clear the structure */
-            ZeroMemory(&CommandInfo, sizeof(CommandInfo));
+            RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));
 
             /* Initialize the structure members */
             CommandInfo.TaskId = SessionId;
@@ -1362,7 +1362,7 @@ Done:
         GetNextVDMCommand(&CommandInfo);
 
         /* Clear the structure */
-        ZeroMemory(&CommandInfo, sizeof(CommandInfo));
+        RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));
 
         /* Update the VDM state of the task */
         CommandInfo.TaskId = SessionId;
@@ -2901,7 +2901,7 @@ BOOLEAN DosKRNLInitialize(VOID)
     WCHAR Buffer[256];
 
     /* Clear the current directory buffer */
-    ZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
+    RtlZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
 
     /* Get the current directory */
     if (!GetCurrentDirectoryA(MAX_PATH, CurrentDirectory))
index 5b0a526..acf3f83 100644 (file)
@@ -665,7 +665,7 @@ VOID MouseBiosUpdateButtons(WORD ButtonState)
 BOOLEAN DosMouseInitialize(VOID)
 {
     /* Clear the state */
-    ZeroMemory(&DriverState, sizeof(DriverState));
+    RtlZeroMemory(&DriverState, sizeof(DriverState));
 
     /* Initialize the interrupt handler */
     RegisterDosInt32(BIOS_MOUSE_INTERRUPT, BiosMouseService);
index 47306eb..7239368 100644 (file)
@@ -428,7 +428,7 @@ VOID CmosInitialize(VOID)
     ASSERT(hCmosRam == INVALID_HANDLE_VALUE);
 
     /* Clear the CMOS memory */
-    ZeroMemory(&CmosMemory, sizeof(CmosMemory));
+    RtlZeroMemory(&CmosMemory, sizeof(CmosMemory));
 
     /* Always open (and if needed, create) a RAM file with shared access */
     SetLastError(0); // For debugging purposes
@@ -452,7 +452,7 @@ VOID CmosInitialize(VOID)
         {
             /* Bad CMOS Ram file. Reinitialize the CMOS memory. */
             DPRINT1("Invalid CMOS file, read bytes %u, expected bytes %u\n", CmosSize, sizeof(CmosMemory));
-            ZeroMemory(&CmosMemory, sizeof(CmosMemory));
+            RtlZeroMemory(&CmosMemory, sizeof(CmosMemory));
         }
         DPRINT1("CMOS loading %s ; GetLastError() = %u\n", Success ? "succeeded" : "failed", GetLastError());
         SetFilePointer(hCmosRam, 0, NULL, FILE_BEGIN);
index 9c5c84e..f480d5b 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "mouse.h"
 #include "ps2.h"
+// #include "pic.h"
 
 // HACK: For the PS/2 bypass and MOUSE.COM driver direct call
 #include "dos/mouse32.h"
@@ -69,7 +70,7 @@ static VOID MouseReset(VOID)
 static VOID MouseGetPacket(PMOUSE_PACKET Packet)
 {
     /* Clear the packet */
-    ZeroMemory(Packet, sizeof(MOUSE_PACKET));
+    RtlZeroMemory(Packet, sizeof(*Packet));
 
     Packet->Flags |= MOUSE_ALWAYS_SET;
 
index 2200c57..94d17b7 100644 (file)
@@ -976,8 +976,8 @@ static BOOL VgaEnterGraphicsMode(PCOORD Resolution)
     }
 
     /* Fill the bitmap info header */
-    ZeroMemory(&BitmapInfo->bmiHeader, sizeof(BITMAPINFOHEADER));
-    BitmapInfo->bmiHeader.biSize   = sizeof(BITMAPINFOHEADER);
+    RtlZeroMemory(&BitmapInfo->bmiHeader, sizeof(BitmapInfo->bmiHeader));
+    BitmapInfo->bmiHeader.biSize   = sizeof(BitmapInfo->bmiHeader);
     BitmapInfo->bmiHeader.biWidth  = Width;
     BitmapInfo->bmiHeader.biHeight = Height;
     BitmapInfo->bmiHeader.biBitCount = 8;
@@ -1006,7 +1006,7 @@ static BOOL VgaEnterGraphicsMode(PCOORD Resolution)
     ConsoleMutex = GraphicsBufferInfo.hMutex;
 
     /* Clear the framebuffer */
-    ZeroMemory(ConsoleFramebuffer, BitmapInfo->bmiHeader.biSizeImage);
+    RtlZeroMemory(ConsoleFramebuffer, BitmapInfo->bmiHeader.biSizeImage);
 
     /* Set the active buffer */
     VgaSetActiveScreenBuffer(GraphicsConsoleBuffer);
@@ -1901,7 +1901,7 @@ VOID VgaWriteMemory(DWORD Address, LPBYTE Buffer, DWORD Size)
 
 VOID VgaClearMemory(VOID)
 {
-    ZeroMemory(VgaMemory, sizeof(VgaMemory));
+    RtlZeroMemory(VgaMemory, sizeof(VgaMemory));
 }
 
 VOID VgaResetPalette(VOID)
index 9a85a11..7fa2891 100644 (file)
@@ -342,7 +342,7 @@ VOID UnregisterIoPort(ULONG Port)
      * the hVdd gets unregistered as well as all the handlers.
      */
     // IoPortProc[Port] = {NULL};
-    ZeroMemory(&IoPortProc[Port], sizeof(IoPortProc[Port]));
+    RtlZeroMemory(&IoPortProc[Port], sizeof(IoPortProc[Port]));
 }
 
 VOID WINAPI
@@ -594,7 +594,7 @@ VDDDeInstallIOHook(HANDLE            hVdd,
              * the hVdd gets unregistered as well as all the handlers.
              */
             // IoPortProc[i] = {NULL};
-            ZeroMemory(&IoPortProc[i], sizeof(IoPortProc[i]));
+            RtlZeroMemory(&IoPortProc[i], sizeof(IoPortProc[i]));
         }
 
         /* Go to the next range */