[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Mon, 28 Sep 2015 18:55:26 +0000 (18:55 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Mon, 28 Sep 2015 18:55:26 +0000 (18:55 +0000)
Fix a division-by-zero problem by storing the mouse driver's Width and Height
in DWORDs, thus avoiding the integer overflow which could make them zero.

svn path=/trunk/; revision=69408

reactos/subsystems/mvdm/ntvdm/dos/mouse32.c

index 171bdfd..85daf33 100644 (file)
@@ -211,8 +211,8 @@ static VOID EraseMouseCursor(VOID)
 static VOID ToMouseCoordinates(PCOORD Position)
 {
     COORD Resolution = VgaGetDisplayResolution();
-    WORD Width = DriverState.MaxX - DriverState.MinX + 1;
-    WORD Height = DriverState.MaxY - DriverState.MinY + 1;
+    DWORD Width = DriverState.MaxX - DriverState.MinX + 1;
+    DWORD Height = DriverState.MaxY - DriverState.MinY + 1;
 
     if (!VgaGetDoubleVisionState(NULL, NULL))
     {
@@ -227,8 +227,8 @@ static VOID ToMouseCoordinates(PCOORD Position)
 static VOID FromMouseCoordinates(PCOORD Position)
 {
     COORD Resolution = VgaGetDisplayResolution();
-    WORD Width = DriverState.MaxX - DriverState.MinX + 1;
-    WORD Height = DriverState.MaxY - DriverState.MinY + 1;
+    DWORD Width = DriverState.MaxX - DriverState.MinX + 1;
+    DWORD Height = DriverState.MaxY - DriverState.MinY + 1;
 
     if (!VgaGetDoubleVisionState(NULL, NULL))
     {