Fix copying of structure values in OpenPrinterA
authorColin Finck <colin@reactos.org>
Wed, 6 May 2015 13:00:08 +0000 (13:00 +0000)
committerColin Finck <colin@reactos.org>
Wed, 6 May 2015 13:00:08 +0000 (13:00 +0000)
svn path=/branches/colins-printing-for-freedom/; revision=67577

reactos/win32ss/printing/base/winspool/main.c

index d2e5bd4..a83204c 100644 (file)
@@ -213,8 +213,8 @@ OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefaul
             MultiByteToWideChar(CP_ACP, 0, pDefault->pDevMode->dmFormName, -1, wDevMode.dmFormName, sizeof(wDevMode.dmFormName) / sizeof(WCHAR));
 
             // Use CopyMemory to copy over several structure values in one step
-            CopyMemory(&wDevMode.dmSpecVersion, &pDefault->pDevMode->dmSpecVersion, (ULONG_PTR)&wDevMode.dmCollate - (ULONG_PTR)&wDevMode.dmSpecVersion);
-            CopyMemory(&wDevMode.dmLogPixels, &pDefault->pDevMode->dmLogPixels, (ULONG_PTR)&wDevMode.dmPanningHeight - (ULONG_PTR)&wDevMode.dmLogPixels);
+            CopyMemory(&wDevMode.dmSpecVersion, &pDefault->pDevMode->dmSpecVersion, (ULONG_PTR)&wDevMode.dmCollate - (ULONG_PTR)&wDevMode.dmSpecVersion + sizeof(wDevMode.dmCollate));
+            CopyMemory(&wDevMode.dmLogPixels, &pDefault->pDevMode->dmLogPixels, (ULONG_PTR)&wDevMode.dmPanningHeight - (ULONG_PTR)&wDevMode.dmLogPixels + sizeof(wDevMode.dmPanningHeight));
 
             wDefault.pDevMode = &wDevMode;
         }