From b4dc5c5cc700d29ab82083beeb1160c79beb4084 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 24 Nov 2008 13:55:20 -0600 Subject: [PATCH] gdiplus: add parameter checking to GdipGetRegionHRgn --- dlls/gdiplus/region.c | 3 +++ dlls/gdiplus/tests/region.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletions(-) diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 1cda0b7..5d8098b 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -775,6 +775,9 @@ GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HR { FIXME("(%p, %p, %p): stub\n", region, graphics, hrgn); + if (!region || !hrgn) + return InvalidParameter; + *hrgn = NULL; return NotImplemented; } diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c index d2477ce..2bf4416 100644 --- a/dlls/gdiplus/tests/region.c +++ b/dlls/gdiplus/tests/region.c @@ -743,6 +743,42 @@ todo_wine{ DeleteObject((HGDIOBJ)hrgn); } +static void test_gethrgn(void) +{ + GpStatus status; + GpRegion *region; + GpGraphics *graphics; + HRGN hrgn; + HDC hdc=GetDC(0); + + status = GdipCreateFromHDC(hdc, &graphics); + ok(status == Ok, "status %08x\n", status); + + status = GdipCreateRegion(®ion); + ok(status == Ok, "status %08x\n", status); + + status = GdipGetRegionHRgn(NULL, graphics, &hrgn); + ok(status == InvalidParameter, "status %08x\n", status); + status = GdipGetRegionHRgn(region, graphics, NULL); + ok(status == InvalidParameter, "status %08x\n", status); + + hrgn = NULL; + status = GdipGetRegionHRgn(region, NULL, &hrgn); + todo_wine ok(status == Ok, "status %08x\n", status); + DeleteObject(hrgn); + + hrgn = NULL; + status = GdipGetRegionHRgn(region, graphics, &hrgn); + todo_wine ok(status == Ok, "status %08x\n", status); + DeleteObject(hrgn); + + status = GdipDeleteRegion(region); + ok(status == Ok, "status %08x\n", status); + status = GdipDeleteGraphics(graphics); + ok(status == Ok, "status %08x\n", status); + ReleaseDC(0, hdc); +} + START_TEST(region) { struct GdiplusStartupInput gdiplusStartupInput; @@ -760,7 +796,7 @@ START_TEST(region) test_isempty(); test_combinereplace(); test_fromhrgn(); + test_gethrgn(); GdiplusShutdown(gdiplusToken); - } -- 1.5.6.3