[ros-dev] The ABCs of DCEs

James Tabor jimtabor.rosdev at gmail.com
Sat Jul 5 03:05:42 CEST 2008

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 );
  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.


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.


More information about the Ros-dev mailing list