gdi32: Don't crash in StartDoc on NULL DOCINFO.

This commit is contained in:
Piotr Caban 2022-11-21 11:50:24 +01:00 committed by Alexandre Julliard
parent a9183c7e3b
commit 4e527045d5

View file

@ -2155,16 +2155,29 @@ INT WINAPI StartDocW( HDC hdc, const DOCINFOW *doc )
{
DC_ATTR *dc_attr;
ABORTPROC proc;
DOCINFOW info;
TRACE("%p %p\n", hdc, doc);
if (doc)
{
info = *doc;
}
else
{
memset( &info, 0, sizeof(info) );
info.cbSize = sizeof(info);
}
TRACE("DocName %s, Output %s, Datatype %s, fwType %#lx\n",
debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
debugstr_w(doc->lpszDatatype), doc->fwType);
debugstr_w(info.lpszDocName), debugstr_w(info.lpszOutput),
debugstr_w(info.lpszDatatype), info.fwType);
if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
proc = (ABORTPROC)(UINT_PTR)dc_attr->abort_proc;
if (proc && !proc( hdc, 0 )) return 0;
return NtGdiStartDoc( hdc, doc, NULL, 0 );
return NtGdiStartDoc( hdc, &info, NULL, 0 );
}
/***********************************************************************
@ -2176,6 +2189,8 @@ INT WINAPI StartDocA( HDC hdc, const DOCINFOA *doc )
DOCINFOW docW;
INT ret, len;
if (!doc) return StartDocW(hdc, NULL);
docW.cbSize = doc->cbSize;
if (doc->lpszDocName)
{