Hi, I did some research and found something very interesting. I kept thinking about the last DCE commit (34289). I had a guess and modified the user32 test for wine. The results are very clear. Apparently windows does not care for which dc is returned if it is Cached or a bug since hWnd is the same. When DCX_NORESETATTRS is set when calling GetDCEx; "Does not reset the attributes of this DC to the default attributes when this DC is released." We do this correctly in ReleaseDC. So the next GetDCEx should keep the original DC data for the next set of tests. Wine test is completely incorrect. So all of our DCE attributes code is good to go. Windows did not pass the modified "Same hDC" check and we still fail the "ROP" check. See the windows results at the end of this message.
//////// Changes to user32/tests/dce.c: ReleaseDC( hwnd_cache, hdc ); hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS ); <------ DCX_NORESETATTRS rop = GetROP2( hdc ); ok( rop == def_rop || rop == R2_WHITE, "wrong ROP2 %d after release\n", rop ); ReleaseDC( hwnd_cache, hdc );
+ old_hdc = hdc; hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE ); rop = GetROP2( hdc ); + ok( old_hdc == hdc, "didn't get same DC %p/%p\n", old_hdc, hdc ); ok( rop == def_rop, "wrong ROP2 %d after release\n", rop ); ReleaseDC( hwnd_cache, hdc );
/* test own DC */ ////////
//////// Results from XP: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp.
Z:>e:
E:>user32_crosstest dce dce.c:79: Test failed: didn't get same DC F5010866/FC0107E0 dce: 77 tests executed (0 marked as todo, 1 failure), 0 skipped.
E:> /////////
Hi, Here is a patch that works with XP. It does reveal something very interesting. Enjoy! James
Index: dce.c =================================================================== RCS file: /home/wine/wine/dlls/user32/tests/dce.c,v retrieving revision 1.4 diff -u -r1.4 dce.c --- dce.c 25 Feb 2008 20:22:42 -0000 1.4 +++ dce.c 5 Jul 2008 05:09:54 -0000 @@ -73,11 +73,20 @@ ok( rop == def_rop || rop == R2_WHITE, "wrong ROP2 %d after release\n", rop ); ReleaseDC( hwnd_cache, hdc );
+ old_hdc = hdc; hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE ); rop = GetROP2( hdc ); + ok( old_hdc != hdc, "did get same DC %p/%p\n", old_hdc, hdc ); ok( rop == def_rop, "wrong ROP2 %d after release\n", rop ); ReleaseDC( hwnd_cache, hdc );
+ hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS ); + rop = GetROP2( hdc ); + ok( old_hdc == hdc, "didn't get same DC %p/%p\n", old_hdc, hdc ); + ok( rop == def_rop || rop == R2_WHITE, "wrong ROP2 %d after release\n", rop ); + ReleaseDC( hwnd_cache, hdc ); + + /* test own DC */
hdc = GetDC( hwnd_owndc );