http://bugs.winehq.org/show_bug.cgi?id=5007
stefandoesinger@gmx.at changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefandoesinger@gmx.at
------- Additional Comments From stefandoesinger@gmx.at 2006-17-06 09:30 ------- I've debugged that problem a bit and I have the impression that windows DirectDraw blatantly violates the COM rules(and the ddraw documentation is wrong). Basically what ep1 racer does is
1) CreateDirectDraw to create a DirectDraw 1 interface 2) QueryInterface the DDraw 1 interface for a DDraw 4 interface 3) Release the DDraw 1 interface and expect the returned refcount to be 0 4) Continue working with the DD4 interface
The COM rules say that the DD1 and DD4 interface refer to the same object and that QueryInterface increses the refcount of the object of which the interface is returned. So step 2 increases the refcount to 2 for both DD1 and DD4 and accordingly 3 has to return 1, not 0. A quick and dirty test showed that windows returns 0 instead.
This needs a proper test case and then an idea how to implement that. I'd say this is a programming sloppyness in ep1 racer:
hr = CreateDirectDraw(..., &DD1, ...); if(hr != DD_OK) cry_bloody_murder();
hr = QueryInterface(DD1, DD4, ...); if(hr != DD_OK) cry_bloody_murder();
hr = GetCaps(DD1); if(hr != DD_OK) cry_bloody_murder();
hr = Release(DD1); if(hr != DD_OK) cry_bloody_murder(); <--- DD_OK is (HRESULT) 0, but release returns a ULONG, not a HRESULT
hr = SetCooperativeLevel(DD4); if(hr != DD_OK) cry_bloody_murder();
etc...
Can you try to patch the game to the newest version?