Author: hbelusca
Date: Tue Oct 14 22:46:40 2014
New Revision: 64747

URL: http://svn.reactos.org/svn/reactos?rev=64747&view=rev
Log:
[NTVDM]: Zero-fill memory with RtlZeroMemory (that exists also in NT mode), and 
use sizeof(object) instead of sizeof(type_of_object).

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

Modified: trunk/reactos/subsystems/ntvdm/dos/dem.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dem.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dem.c    [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dem.c    [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -134,8 +134,8 @@
             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 @@
     do
     {
         /* Clear the structure */
-        ZeroMemory(&CommandInfo, sizeof(CommandInfo));
+        RtlZeroMemory(&CommandInfo, sizeof(CommandInfo));
 
         /* Initialize the structure members */
         CommandInfo.TaskId = SessionId;

Modified: trunk/reactos/subsystems/ntvdm/dos/dos32krnl/bios.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dos32krnl/bios.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dos32krnl/bios.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dos32krnl/bios.c [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -168,7 +168,7 @@
 #if 0
 
     /* Clear the current directory buffer */
-    ZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
+    RtlZeroMemory(CurrentDirectories, sizeof(CurrentDirectories));
 
     /* Get the current directory */
     if (!GetCurrentDirectoryA(MAX_PATH, CurrentDirectory))

Modified: trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c  [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c  [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -860,7 +860,7 @@
     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 @@
     }
 
     /* 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 @@
         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 @@
         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 @@
     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))

Modified: trunk/reactos/subsystems/ntvdm/dos/mouse32.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/mouse32.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/mouse32.c        [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/mouse32.c        [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -665,7 +665,7 @@
 BOOLEAN DosMouseInitialize(VOID)
 {
     /* Clear the state */
-    ZeroMemory(&DriverState, sizeof(DriverState));
+    RtlZeroMemory(&DriverState, sizeof(DriverState));
 
     /* Initialize the interrupt handler */
     RegisterDosInt32(BIOS_MOUSE_INTERRUPT, BiosMouseService);

Modified: trunk/reactos/subsystems/ntvdm/hardware/cmos.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/cmos.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/cmos.c      [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/cmos.c      [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -428,7 +428,7 @@
     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 @@
         {
             /* 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);

Modified: trunk/reactos/subsystems/ntvdm/hardware/mouse.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/mouse.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/mouse.c     [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/mouse.c     [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -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 MouseGetPacket(PMOUSE_PACKET Packet)
 {
     /* Clear the packet */
-    ZeroMemory(Packet, sizeof(MOUSE_PACKET));
+    RtlZeroMemory(Packet, sizeof(*Packet));
 
     Packet->Flags |= MOUSE_ALWAYS_SET;
 

Modified: trunk/reactos/subsystems/ntvdm/hardware/vga.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/vga.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/vga.c       [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/vga.c       [iso-8859-1] Tue Oct 14 
22:46:40 2014
@@ -976,8 +976,8 @@
     }
 
     /* 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 @@
     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 VgaClearMemory(VOID)
 {
-    ZeroMemory(VgaMemory, sizeof(VgaMemory));
+    RtlZeroMemory(VgaMemory, sizeof(VgaMemory));
 }
 
 VOID VgaResetPalette(VOID)

Modified: trunk/reactos/subsystems/ntvdm/io.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/io.c?rev=64747&r1=64746&r2=64747&view=diff
==============================================================================
--- trunk/reactos/subsystems/ntvdm/io.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/io.c [iso-8859-1] Tue Oct 14 22:46:40 2014
@@ -342,7 +342,7 @@
      * 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 @@
              * 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 */


Reply via email to