Commit 6762313c authored by Maxime Bellengé's avatar Maxime Bellengé Committed by Alexandre Julliard

Prevent CreateDCA from crashing if a bad lpInitData parameter is

provided.
parent 26d2b8bf
......@@ -38,6 +38,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(dc);
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj );
static const struct gdi_obj_funcs dc_funcs =
......@@ -670,8 +672,13 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
if (output) RtlCreateUnicodeStringFromAsciiz(&outputW, output);
else outputW.Buffer = NULL;
if (initData) initDataW = GdiConvertToDevmodeW(initData);
else initDataW = NULL;
initDataW = NULL;
if (initData)
{
/* don't convert initData for DISPLAY driver, it's not used */
if (!driverW.Buffer || strcmpiW( driverW.Buffer, displayW ))
initDataW = GdiConvertToDevmodeW(initData);
}
ret = CreateDCW( driverW.Buffer, deviceW.Buffer, outputW.Buffer, initDataW );
......@@ -725,7 +732,6 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
}
else
{
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
funcs = DRIVER_load_driver( displayW );
physDev = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment