Skip to content
Snippets Groups Projects
Commit 74dcea09 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek
Browse files

Revert "win32u: Fix ExtCreateRegion when parameters are wrong."

This reverts commit e1ea8c2f.
parent e1ea8c2f
No related branches found
No related tags found
No related merge requests found
Pipeline #18490 failed
......@@ -648,11 +648,6 @@ HRGN WINAPI ExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *dat
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if ((data->rdh.nCount == 1) && (!xform))
{
const PRECT pRect = (PRECT)&data->Buffer[0];
return NtGdiCreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom);
}
return NtGdiExtCreateRegion( xform, count, data );
}
......
......@@ -260,9 +260,11 @@ static void test_ExtCreateRegion(void)
rgn.data.rdh.nCount = 0;
SetLastError(0xdeadbeef);
hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) - 1, &rgn.data);
todo_wine
ok(!hrgn, "ExtCreateRegion should fail\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %lu\n", GetLastError());
broken(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %lu\n", GetLastError());
SetLastError(0xdeadbeef);
hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data);
......@@ -293,6 +295,7 @@ static void test_ExtCreateRegion(void)
/* Buffer cannot be smaller than sizeof(RGNDATAHEADER) + 2 * sizeof(RECT) */
SetLastError(0xdeadbeef);
hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + 2 * sizeof(RECT) - 1, &rgn.data);
todo_wine
ok(!hrgn, "ExtCreateRegion should fail\n");
ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %lu\n", GetLastError());
}
......
......@@ -896,12 +896,11 @@ HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA
WINEREGION *obj;
const RECT *pCurRect, *pEndRect;
if (!rgndata || rgndata->rdh.dwSize < sizeof(RGNDATAHEADER) ||
(count < sizeof(RGNDATAHEADER) + rgndata->rdh.nCount * sizeof(RECT)))
if (!rgndata || rgndata->rdh.dwSize < sizeof(RGNDATAHEADER))
return 0;
/* Up to Windows XP/2003, function return 0, if type is wrong */
if (rgndata->rdh.iType != RDH_RECTANGLES)
/* XP doesn't care about the type */
if( rgndata->rdh.iType != RDH_RECTANGLES )
WARN("(Unsupported region data type: %u)\n", (int)rgndata->rdh.iType);
if (xform)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment