[ros-dev] Win32/Gdi32 rewrite

James Tabor jimtabor at adsl-64-217-116-74.dsl.hstntx.swbell.net
Fri Jul 27 21:10:53 CEST 2007


Hi all,
I'm giving in to the idea of having two dc_attrs.

From, Windows Graphics Programming Win32 GDI and DirectDraw -> 3.8 GDI KERNEL MODE DATA STRUCTURE -> 
Device Context in the GDI Engine, second to the last paragraph:

Field pdcattr points to the DC_ATTR structure for that device context in user mode address space, 
which contains most device context settings. The DCOBJ structure has a duplication of it in its 
dcAttr field. It's possible the GDI designers want setting DC attributes to be efficient, with as 
little kernel mode code involvement as possible. This requires a DC_ATTR structure in user mode. But 
they also want to be able to access it easily in kernel mode, which requires a copy of DC_ATTR in 
kernel mode. Certain flags may be used to synchronize the two copies of DC_ATTR.

typedef struct
{
// ......snip......
void * pdcattr; // point to user mode DCATTR
DCLEVEL dcLevel; // 0x030 0x1B8(440) bytes
DC_ATTR dcAttr; // 0x1C8(456) bytes
// ......snip......
} DCOBJ;

I did set up Ros DC structure to have the dc_attr pointer stored. I guess it's time to move the old 
WIN_DC_INFO stuff over to the new kernel mode dc_attr and use the dirty flags for synchronizing. 
This will fix my memory access problems too. I did an experiment to test the idea of just copy if it 
was dirty and all my problems went away.

FYI,
James



More information about the Ros-dev mailing list