On Mon, Oct 10, 2005 at 10:18:21PM +0200, Peter Berg Larsen wrote:
I would first merge both our patches replacing the following lines with an 'assert(to != from)':
if ((to) == (from)) break;
I think thats execellent idea; I hadnt though of asserts, did not new wine used them..
Well, as Alexandre committed my 'assert' patch, it's already in the code and there is just a merge to be done :-)
As for asserts, they work because Wine catches the 'assert' signal and transforms it into a Win32 exception thus starting the Wine debugger.
I still havent got the grasp of what dwSize is for if it does not reflect the size allocated?, nor the size of the struct current in the mem.
An example of the usage of the 'dwSize' parameter:
static HRESULT WINAPI IDirectDrawSurface3Impl_Lock(LPDIRECTDRAWSURFACE3 This, LPRECT pRect, LPDDSURFACEDESC pDDSD, DWORD dwFlags, HANDLE h) { return IDirectDrawSurface7_Lock(CONVERT(This), pRect, (LPDDSURFACEDESC2)pDDSD, dwFlags, h); }
As the DDSURFACEDESC2 structure starts exactly like the DDSURFACEDESC2 one, the hack here is to use 'dwSize' to magically cast one structure to the other to be able to share code.
This is what MS had in mind when they introduced this field: have 'extendable' structure wheer each new revisions only added fields => they can all be filled by one common function, using the 'dwSize' field to disctriminate between versions.
Note that next time I bring my Win32 laptop home, I will try to do some tests in real Windows to see how Windows fills the given structure pointer.
Lionel