-- v7: win32u: fix NtGdiExtCreateRegion implementation
From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/gdi32/tests/clipping.c | 11 +++++------ dlls/win32u/region.c | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index ce66f9cad09..de096753744 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -57,7 +57,7 @@ static void test_GetRandomRgn(void) ok(ret != 0, "GetRandomRgn rets %d\n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc)); - + ret = GetRandomRgn(hdc, hrgn, 2); ok(ret == 0, "GetRandomRgn rets %d\n", ret);
@@ -97,7 +97,7 @@ static void test_GetRandomRgn(void) ok(ret != 0, "GetRandomRgn rets %d\n", ret); GetRgnBox(hrgn, &ret_rc); ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc)); - + IntersectRect(&rc2, &rc, &rc2);
ret = GetRandomRgn(hdc, hrgn, 3); @@ -225,11 +225,12 @@ static void test_ExtCreateRegion(void) /* Cannot be smaller than sizeof(RGNDATAHEADER) */ SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) - 1, &rgn.data); - todo_wine ok(!hrgn, "ExtCreateRegion should fail\n"); + /* From Windows 7 returns ERROR_INVALID_PARAMETER error */ todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER || - broken(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %lu\n", GetLastError()); + broken(GetLastError() == 0xdeadbeef), + "Expected ERROR_INVALID_PARAMETER (win7+) or 0xdeadbeef, got %lu\n", GetLastError());
SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data); @@ -267,10 +268,8 @@ 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()); - }
static void test_GetClipRgn(void) diff --git a/dlls/win32u/region.c b/dlls/win32u/region.c index f32984d1c54..88c80e274b6 100644 --- a/dlls/win32u/region.c +++ b/dlls/win32u/region.c @@ -896,7 +896,9 @@ HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA WINEREGION *obj; const RECT *pCurRect, *pEndRect;
- if (!rgndata || rgndata->rdh.dwSize < sizeof(RGNDATAHEADER)) + if (!rgndata || + rgndata->rdh.dwSize < sizeof(RGNDATAHEADER) || + count < (sizeof(RGNDATAHEADER) + rgndata->rdh.nCount * sizeof(RECT))) return 0;
/* XP doesn't care about the type */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=143881
Your paranoid android.
=== debian11b (64 bit WoW report) ===
ddraw: ddraw1.c:1102: Test failed: Failed to set clip list, hr 0x80004005. ddraw1.c:1146: Test failed: Failed to blit, hr 0x887600cd. ddraw1.c:1154: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x0000ff00 at 240,60, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x0000ff00 at 240,180, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x00ff0000 at 400,300, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x00ffffff at 560,300, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x00ff0000 at 400,420, got 0x00000000. ddraw1.c:1154: Test failed: Expected color 0x00ffffff at 560,420, got 0x00000000. ddraw1.c:1162: Test failed: Failed to clear destination surface, hr 0x887600cd. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 240,60, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 240,180, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 400,300, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 560,300, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 400,420, got 0x00000000. ddraw1.c:1170: Test failed: Expected color 0x000000ff at 560,420, got 0x00000000. ddraw1.c:1188: Test failed: Failed to get clip list size, hr 0x887600cd. ddraw2.c:945: Test failed: Failed to set clip list, hr 0x80004005. ddraw2.c:989: Test failed: Failed to blit, hr 0x887600cd. ddraw2.c:997: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x0000ff00 at 240,60, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x0000ff00 at 240,180, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x00ff0000 at 400,300, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x00ffffff at 560,300, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x00ff0000 at 400,420, got 0x00000000. ddraw2.c:997: Test failed: Expected color 0x00ffffff at 560,420, got 0x00000000. ddraw2.c:1005: Test failed: Failed to clear destination surface, hr 0x887600cd. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 240,60, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 240,180, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 400,300, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 560,300, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 400,420, got 0x00000000. ddraw2.c:1013: Test failed: Expected color 0x000000ff at 560,420, got 0x00000000. ddraw2.c:1031: Test failed: Failed to get clip list size, hr 0x887600cd. ddraw4.c:1135: Test failed: Failed to set clip list, hr 0x80004005. ddraw4.c:1179: Test failed: Failed to blit, hr 0x887600cd. ddraw4.c:1187: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x0000ff00 at 240,60, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x0000ff00 at 240,180, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x00ff0000 at 400,300, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x00ffffff at 560,300, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x00ff0000 at 400,420, got 0x00000000. ddraw4.c:1187: Test failed: Expected color 0x00ffffff at 560,420, got 0x00000000. ddraw4.c:1195: Test failed: Failed to clear destination surface, hr 0x887600cd. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 240,60, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 240,180, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 400,300, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 560,300, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 400,420, got 0x00000000. ddraw4.c:1203: Test failed: Expected color 0x000000ff at 560,420, got 0x00000000. ddraw4.c:1221: Test failed: Failed to get clip list size, hr 0x887600cd. ddraw7.c:1220: Test failed: Failed to set clip list, hr 0x80004005. ddraw7.c:1264: Test failed: Failed to blit, hr 0x887600cd. ddraw7.c:1272: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x0000ff00 at 240,60, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x0000ff00 at 240,180, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x00ff0000 at 400,300, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x00ffffff at 560,300, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x00ff0000 at 400,420, got 0x00000000. ddraw7.c:1272: Test failed: Expected color 0x00ffffff at 560,420, got 0x00000000. ddraw7.c:1280: Test failed: Failed to clear destination surface, hr 0x887600cd. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 80,60, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 240,60, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 80,180, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 240,180, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 400,300, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 560,300, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 400,420, got 0x00000000. ddraw7.c:1288: Test failed: Expected color 0x000000ff at 560,420, got 0x00000000. ddraw7.c:1306: Test failed: Failed to get clip list size, hr 0x887600cd.
gdi32: metafile.c:8340: Test failed: GetClipRgn returned 0, expected 1 metafile.c:8343: Test failed: expected sizeof(rgn), got 32 metafile.c:8346: Test failed: expected sizeof(rgn2), got 32 metafile.c:8358: Test failed: rects don't match metafile.c:8365: Test failed: rects don't match metafile.c:8369: Test failed: expected 1, got 0 metafile.c:8370: Test failed: expected sizeof(RECT), got 0
On Fri Mar 8 10:30:22 2024 +0000, Jinoh Kang wrote:
If the last error is 0xdeadbeef, broken() doesn't make it fail.
Done. How I should implement it to return `ERROR_INVALID_PARAMETER` on Windows 7+, and `0xdeadbeef` on previous OS (e.g. WIndows XP)?
On Fri Mar 8 11:49:57 2024 +0000, Bartosz Kosiorek wrote:
Done. How I should implement it to return `ERROR_INVALID_PARAMETER` on Windows 7+, and `0xdeadbeef` on previous OS (e.g. WIndows XP)?
You can use `RtlGetVersion()` to get the currently configured version.
That said, you have to justify it with an actual app that expects Windows XP behavior if you want to include it in a MR submission to Wine.
On Fri Mar 8 12:29:53 2024 +0000, Jinoh Kang wrote:
You can use `RtlGetVersion()` to get the currently configured version. That said, you have to justify it with an actual app that expects Windows XP behavior if you want to include it in a MR submission to Wine.
I don't know such application. Do you think just returning ERROR_INVALID_PARAMETER (also for Windows XP) will be fine?
This merge request was closed by Bartosz Kosiorek.
just returning ERROR_INVALID_PARAMETER (also for Windows XP)
Yup, that's fine.