Commit 0482c8e8 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Fix CreateCompatibleDC to reject invalid DCs.

parent 2004d2b2
...@@ -785,6 +785,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc ) ...@@ -785,6 +785,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
release_dc_ptr( origDC ); release_dc_ptr( origDC );
if (funcs) funcs = DRIVER_get_driver( funcs ); if (funcs) funcs = DRIVER_get_driver( funcs );
} }
else if (hdc) return 0;
if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0; if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
......
...@@ -248,15 +248,11 @@ static void test_CreateCompatibleDC(void) ...@@ -248,15 +248,11 @@ static void test_CreateCompatibleDC(void)
bRet = DeleteDC(hDC); bRet = DeleteDC(hDC);
ok(bRet == TRUE, "DeleteDC returned %u\n", bRet); ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
todo_wine
{
/* Try to create a DC compatible to the deleted DC. This has to fail */ /* Try to create a DC compatible to the deleted DC. This has to fail */
hNewDC = CreateCompatibleDC(hDC); hNewDC = CreateCompatibleDC(hDC);
ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC); ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
} }
}
START_TEST(dc) START_TEST(dc)
{ {
test_savedc(); test_savedc();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment