http://bugs.winehq.org/show_bug.cgi?id=10758
--- Comment #7 from Jim Cameron jim_24601@btinternet.com 2008-10-03 06:06:23 --- Leave aside for the moment the matter of the above patch haemorrhaging surfaces...
The problem's a bit more complicated than this. The game is clearly expecting SetDepthStencilSurface() to increase the reference count for the Direct3D 9 surface, which is an intuitively reasonable expectation. Since Wine's D3D9 implementation relies on the generic wined3d driver to do the heavy lifting, only the backing WineD3D surface actually gets referenced.
The naive solution (of grabbing the parent and referencing it instead) doesn't work with the auto depth stencil buffer, though. Wine D3D9 does not expect the auto depth stencil buffer's D3D9 surface to be referenced merely by its being used as a depth/stencil buffer, and if a D3D9 device with an auto depth stencil buffer is reset, it will call SetDepthStencilSurface() on it, resulting in a dangling reference that will block the /next/ attempt to reset the surface. This causes Wine to fail several tests.