https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d8c39753e82e8e7f8db9…
commit 5d8c39753e82e8e7f8db90a427b230ed248f0158
Author: Colin Finck <colin(a)reactos.org>
AuthorDate: Mon Feb 24 19:17:56 2020 +0100
Commit: Colin Finck <colin(a)reactos.org>
CommitDate: Mon Feb 24 19:17:56 2020 +0100
[GDI32] GdiConvertToDevmodeW: Import WINE commit
32393796bb534e9cf11dd988dce88722c67f7906 ("gdi32: GdiConvertToDevmodeW should not
refer to unintialized name bytes.")
This makes our GdiConvertToDevmodeW equivalent to the WINE counterpart again.
---
win32ss/gdi/gdi32/misc/misc.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/win32ss/gdi/gdi32/misc/misc.c b/win32ss/gdi/gdi32/misc/misc.c
index b31db63b9fa..04be375853f 100644
--- a/win32ss/gdi/gdi32/misc/misc.c
+++ b/win32ss/gdi/gdi32/misc/misc.c
@@ -962,6 +962,7 @@ bMakePathNameW(LPWSTR lpBuffer,LPCWSTR lpFileName,LPWSTR
*lpFilePart,DWORD unkno
/*
* @implemented
+ * Synchronized with WINE dlls/gdi32/driver.c
*/
DEVMODEW *
WINAPI
@@ -986,15 +987,19 @@ GdiConvertToDevmodeW(const DEVMODEA *dmA)
dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
if (!dmW) return NULL;
- MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, CCHDEVICENAME,
- dmW->dmDeviceName, CCHDEVICENAME);
+ MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
+ dmW->dmDeviceName, CCHDEVICENAME);
/* copy slightly more, to avoid long computations */
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size -
CCHDEVICENAME);
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
{
- MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, CCHFORMNAME,
- dmW->dmFormName, CCHFORMNAME);
+ if (dmA->dmFields & DM_FORMNAME)
+ MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
+ dmW->dmFormName, CCHFORMNAME);
+ else
+ dmW->dmFormName[0] = 0;
+
if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size -
FIELD_OFFSET(DEVMODEA, dmLogPixels));
}