Alexandre Julliard : gdi32: Fix CreateCompatibleDC to reject invalid DCs.

Alexandre Julliard julliard at winehq.org
Mon Apr 14 07:14:07 CDT 2008


Module: wine
Branch: master
Commit: 0482c8e81854ed52f5db2b177e0e51fec091ad1c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0482c8e81854ed52f5db2b177e0e51fec091ad1c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 14 12:06:24 2008 +0200

gdi32: Fix CreateCompatibleDC to reject invalid DCs.

---

 dlls/gdi32/dc.c       |    1 +
 dlls/gdi32/tests/dc.c |    4 ----
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index ffd6a1b..debbde8 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -785,6 +785,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
         release_dc_ptr( origDC );
         if (funcs) funcs = DRIVER_get_driver( funcs );
     }
+    else if (hdc) return 0;
 
     if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
 
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index d0ca5cf..9e0048e 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -248,15 +248,11 @@ static void test_CreateCompatibleDC(void)
     bRet = DeleteDC(hDC);
     ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
 
-todo_wine
-{
     /* Try to create a DC compatible to the deleted DC. This has to fail */
     hNewDC = CreateCompatibleDC(hDC);
     ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
 }
 
-}
-
 START_TEST(dc)
 {
     test_savedc();




More information about the wine-cvs mailing list