http://bugs.winehq.org/show_bug.cgi?id=5668
------- Additional Comments From stefandoesinger@gmx.at 2006-22-08 17:13 ------- trace:d3d7:IDirect3DImpl_3_CreateViewport (0x165d48) creating implementation at 0x1f3f98. fixme:d3d7:IDirect3DDeviceImpl_3_GetStats (0x1b3eb0)->(0x1f3f98): Stub!
Is this maybe an application that uses native d3dim.dll? I've seen such an oddness with that library. What basically happens here is that an IDirect3DViewport interface is created and then the caller requests D3D statistics to be written to that address, which is obviously nonsense and will destroy the viewport's private data. Because of this the device pointer is NULL when the viewport is used.
I suspect that GetStats should return an error in this case, what has to be done is to write a test case for this behaviour and if windows returns an error implement simple object tracking for viewports and check the pointer against stored interface pointers in GetStats.