LockDIBSection problem

Rein Klazes wijn at wanadoo.nl
Thu May 5 12:11:22 CDT 2005


Here is another problem in BigJig a jigsaw puzzle game (free download at

The program calls BitBlt with destination an in memory DIB. Inside
BitBlt, the destination bits are set to PAGE_NOACCESS:

| 0009:Call kernel32.VirtualProtect(727f0000,00123324,00000001,77a5f7bc) ret=770032ba
| 0009:Call ntdll.NtProtectVirtualMemory(ffffffff,77a5f69c,77a5f6a0,00000001,77a5f7bc) ret=77b6929e
| trace:virtual:NtProtectVirtualMemory 0xffffffff 0x727f0000 00123324 00000001
| trace:virtual:VIRTUAL_SetProt 0x727f0000-0x72913fff c----
| View: 0x727f0000 - 0x72913fff (valloc)
|       0x727f0000 - 0x72913fff c----
| 0009:Ret  ntdll.NtProtectVirtualMemory() retval=00000000 ret=77b6929e

This memory segment (727f0000,00123324) does not appear in the log
anymore until it is written to disk:

| 0009:Call kernel32.WriteFile(00000084,727f0000,00123324,77a5f360,00000000) ret=00408ac1
 The call fails ( not in the log because I fixed it) with error
STATUS_INVALID_USER_BUFFER and the program hangs.

I managed to fixed it in two ways:

1. put a 
    X11DRV_CoerceDIBSection( physDevDst, DIB_Status_InSync, FALSE );
at the end of X11DRV_BitBlt. This probably defeats the whole purpose of
these protections so:

2. Add a "IsBadReadPtr( buffer, bytesToWrite)" in the top of WriteFile
to force an exception and everything works.

Would that be an acceptable fix?


More information about the wine-devel mailing list