Module: wine Branch: master Commit: 5c752777849be992db287b4d2c109df89b11204c URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c752777849be992db287b4d2c...
Author: Vincent Povirk vincent@codeweavers.com Date: Mon Nov 24 13:55:20 2008 -0600
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); - }