x11drv, ntdll separation

David Fraser davidf at sjsoft.com
Sat Feb 22 05:36:03 CST 2003


Hi

I was wanting to do some work on x11drv dll separation.
The last remaining dll separation between x11drv and ntdll is 
VIRTUAL_SetFaultHandler.
This is called from X11DRV_DIB_CreateDIBSection, where it tries to set 
the fault handler to X11DRV_DIB_FaultHandler, with addr=dm.dmBits and 
arg=res.

 From reading the code it seems that this is done because it is not 
known whether the calling app requires read or write access to the data 
in bmp.  If the app then tries to read or write and doesn't have the 
appropriate access, this will generate an exception which will then 
raise the X11DRV_DIB_FaultHandler which would then set the appropriate 
access, in a way that ensures data gets handled correctly.

I presume I'm misunderstanding this, because looking at MSDN for 
CreateDIBSection, it says:
The CreateDIBSection function creates a device-independent bitmap (DIB) 
that applications can write to directly.
and further down...
Windows NT: You need to guarantee that the GDI subsystem has completed 
any drawing to a bitmap created by CreateDIBSection before you draw to 
the bitmap yourself. Access to the bitmap must be synchronized. Do this 
by calling the GdiFlush function.

So it would seem apps could always be given read-write access to this 
bitmap.

Why is the special fault handler needed? What is the best way to 
approach getting rid of it?

David






More information about the wine-devel mailing list