http://bugs.winehq.org/show_bug.cgi?id=7643
------- Additional Comments From ehoover@mines.edu 2007-11-03 15:38 ------- Created an attachment (id=5306) --> (http://bugs.winehq.org/attachment.cgi?id=5306&action=view) Managing to build things
The attached screenshot shows the game getting much further than usual. By hacking IWineD3DSurfaceImpl_LockRect in wined3d/surface.c to allocate more memory, you can actually create some buildings and units in the campaign. The problem appears to be related to this:
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + 4); ... pLockedRect->pBits = This->resource.allocatedMemory + (pLockedRect->Pitch * pRect->top) + (pRect->left * This->bytesPerPixel);
LockRect allows this allocation of pBits to be greater than the allocated memory size. Since there is not even a check to see if the value of pBits is OK, there is no indication of a problem until Supreme Commander tries to use that memory location and segfaults.