[3/3] gdi32: Fix error code for WidenPath() on invalid hdc
Nikolay Sivov
bunglehead at gmail.com
Sat Jan 10 13:44:22 CST 2009
Changelog:
- Fix error code for WidenPath() on invalid hdc
>From 3ff30ccb6bfe7139a09a78af890e9560e93a2ed6 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sat, 10 Jan 2009 22:21:17 +0300
Subject: Fix error code for WidenPath() on invalid hdc
---
dlls/gdi32/path.c | 6 +++++-
dlls/gdi32/tests/path.c | 7 +++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index e9cb7bb..5fc96e0 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -2230,7 +2230,11 @@ BOOL WINAPI WidenPath(HDC hdc)
DC *dc = get_dc_ptr( hdc );
BOOL ret = FALSE;
- if(!dc) return FALSE;
+ if(!dc)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
if(dc->funcs->pWidenPath)
ret = dc->funcs->pWidenPath(dc->physDev);
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 7944ed5..44beb7a 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -40,6 +40,7 @@ static void test_widenpath(void)
HPEN oldPen;
POINT pnt[6];
INT nSize, ret;
+ BOOL bRet;
/* Create a pen to be used in WidenPath */
greenPen = CreatePen(PS_SOLID, 10, RGB(0,0,0));
@@ -59,6 +60,12 @@ static void test_widenpath(void)
pnt[5].x = 100;
pnt[5].y = 300;
+ /* Invalid hdc handle */
+ SetLastError(0xdeadbeef);
+ bRet = WidenPath(NULL);
+ ok(!bRet, "WidenPath() should fail for invalid hdc\n");
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+
/* Set a polyline path */
BeginPath(hdc);
Polyline(hdc, pnt, 6);
--
1.5.6.5
More information about the wine-patches
mailing list