Commit 8710dde0 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

In a call to EnumEnhMetaFile when hdc is NULL, lpRect may be NULL. Add

a test for this.
parent 9be7f278
......@@ -2147,7 +2147,7 @@ BOOL WINAPI EnumEnhMetaFile(
INT mapMode = MM_TEXT;
COLORREF old_text_color = 0, old_bk_color = 0;
if(!lpRect)
if(!lpRect && hdc)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
......@@ -2228,7 +2228,7 @@ BOOL WINAPI EnumEnhMetaFile(
CombineTransform(&info->init_transform, &savedXform, &info->init_transform);
}
if ( WIDTH(emh->rclFrame) && HEIGHT(emh->rclFrame) )
if ( lpRect && WIDTH(emh->rclFrame) && HEIGHT(emh->rclFrame) )
{
FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale;
XFORM xform;
......@@ -2256,7 +2256,7 @@ BOOL WINAPI EnumEnhMetaFile(
}
/* WinNT resets the current vp/win org/ext */
if ( !IS_WIN9X() )
if ( !IS_WIN9X() && hdc )
{
SetMapMode(hdc, MM_TEXT);
SetWindowOrgEx(hdc, 0, 0, NULL);
......
......@@ -43,6 +43,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n",
hdc, emr->iType, emr->nSize, (void *)param);
if(!hdc) return 1;
PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs);
switch (emr->iType)
......@@ -190,6 +192,9 @@ static void test_ExtTextOut(void)
ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, NULL),
"A valid hdc has to require a valid rc\n");
ok(EnumEnhMetaFile(NULL, hMetafile, emf_enum_proc, dx, NULL),
"A null hdc does not require a valid rc\n");
ret = DeleteEnhMetaFile(hMetafile);
ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
ret = ReleaseDC(hwnd, hdcDisplay);
......
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