Hello, While working on an implementation for IWineD3DSurface::GetDC and IWineD3DSurface::ReleaseDC, I think I stubled accross a bug in the DIB code. It appears to me that the memory of the DIB section isn't unprotected correctly when the dib section is destroyed. I have pasted my code here: http://wine.pastebin.com/671601 What I do is basically: ->Lock the surface ->Create a DIB section for the locked surface memory(Allocated with VirtualAlloc) ->Get a DC for the dib section ->Setup the dc and return it to the app In ReleaseDC, I do it the reverse way: ->Release the DC ->Delete the DIB section ->Unlock the surface But all accesses to the surface's memory fail after deleting the dib section. Therefore I unlock the surface before destroying the dib, and upload the texture to opengl, to be able to free the memory. For testing, I've inserted VirtualProtect(This->resource.allocatedMemory, This->resource.size, PAGE_READWRITE,&oldProtect); after the DeleteObject, and then I can access the surface normally again. But the image that the app wrote with GDI commands isn't there, it looks like the image is left in the X server and dropped. Can someone with more knowledge of the DIB code have a quick look at this? Thanks, Stefan
Forget about that, as AJ told me on irc, ddraw(and in the same way my code) used gdi incorrectly by calling an unofficial function.
participants (2)
-
Stefan Dösinger -
Stefan Dösinger