Hi all, This attached patch fixes Revolt and will please Sylvain (well, the game still does not work properly but at least it won't fail due to GetAttachedSurface anymore :-) ). Changelog: Update the 'DIRECTDRAW7' flag according to the interface initialized -- Lionel Ulmer - http://www.bbrox.org/
--- ../wine_base/dlls/ddraw/main.c Sat Nov 9 12:14:13 2002 +++ dlls/ddraw/main.c Sun Jan 12 12:25:19 2003 @@ -241,6 +241,8 @@ LPDIRECTDRAW7 pDD; HRESULT hr; + TRACE("(%s,%p,%p,%d)\n", debugstr_guid(lpGUID), lplpDD, pUnkOuter, ex); + if (DDRAW_num_drivers == 0) { WARN("no DirectDraw drivers registered\n"); @@ -251,8 +253,6 @@ || lpGUID == (LPGUID)DDCREATE_HARDWAREONLY) lpGUID = NULL; - TRACE("(%s,%p,%p)\n",debugstr_guid(lpGUID),lplpDD,pUnkOuter); - if (pUnkOuter != NULL) return DDERR_INVALIDPARAMS; /* CLASS_E_NOAGGREGATION? */ @@ -277,7 +277,8 @@ HRESULT WINAPI DirectDrawCreate( LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter ) { - return DDRAW_Create(lpGUID,(LPVOID*)lplpDD,pUnkOuter,&IID_IDirectDraw,FALSE); + TRACE("(%s,%p,%p)\n", debugstr_guid(lpGUID), lplpDD, pUnkOuter); + return DDRAW_Create(lpGUID, (LPVOID*) lplpDD, pUnkOuter, &IID_IDirectDraw, FALSE); } /*********************************************************************** @@ -290,10 +291,12 @@ HRESULT WINAPI DirectDrawCreateEx( LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter ) { + TRACE("(%s,%p,%s,%p)\n", debugstr_guid(lpGUID), lplpDD, debugstr_guid(iid), pUnkOuter); + if (!IsEqualGUID(iid, &IID_IDirectDraw7)) return DDERR_INVALIDPARAMS; - return DDRAW_Create(lpGUID, lplpDD, pUnkOuter, iid, TRUE); + return DDRAW_Create(lpGUID, lplpDD, pUnkOuter, iid, TRUE); } extern HRESULT Uninit_DirectDraw_Create(const GUID*, LPDIRECTDRAW7*, @@ -305,8 +308,17 @@ { LPDIRECTDRAW7 pDD; HRESULT hr; + BOOL ex; - hr = Uninit_DirectDraw_Create(NULL, &pDD, pUnkOuter, TRUE); /* ex? */ + TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppObj); + + /* This is a mighty hack :-) */ + if (IsEqualGUID(iid, &IID_IDirectDraw7)) + ex = TRUE; + else + ex = FALSE; + + hr = Uninit_DirectDraw_Create(NULL, &pDD, pUnkOuter, ex); if (FAILED(hr)) return hr; hr = IDirectDraw7_QueryInterface(pDD, iid, ppObj); @@ -349,6 +361,8 @@ { ICOM_THIS(IClassFactoryImpl,iface); + TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj); + if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) { @@ -363,18 +377,21 @@ static ULONG WINAPI DDCF_AddRef(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); + + TRACE("(%p)->() incrementing from %ld.\n", This, This->ref); + return ++(This->ref); } static ULONG WINAPI DDCF_Release(LPCLASSFACTORY iface) { ICOM_THIS(IClassFactoryImpl,iface); - ULONG ref = --This->ref; + TRACE("(%p)->() decrementing from %ld.\n", This, This->ref); - if (ref == 0) + if (--This->ref == 0) HeapFree(GetProcessHeap(), 0, This); - return ref; + return This->ref; } --- ../wine_base/dlls/ddraw/ddraw/hal.c Sat Nov 9 12:14:13 2002 +++ dlls/ddraw/ddraw/hal.c Sun Jan 12 14:17:13 2003 @@ -335,7 +335,7 @@ { HRESULT hr; - TRACE("(%p)\n", This); + TRACE("(%p,%d)\n", This, ex); hr = User_DirectDraw_Construct(This, ex); if (FAILED(hr)) return hr; --- ../wine_base/dlls/ddraw/ddraw/thunks.c Tue Jul 23 20:39:11 2002 +++ dlls/ddraw/ddraw/thunks.c Sun Jan 12 14:51:46 2003 @@ -698,31 +698,47 @@ } static HRESULT WINAPI -IDirectDrawImpl_Initialize(LPDIRECTDRAW This, LPGUID pGUID) +IDirectDrawImpl_Initialize(LPDIRECTDRAW iface, LPGUID pGUID) { - return IDirectDraw7_Initialize(COM_INTERFACE_CAST(IDirectDrawImpl, - IDirectDraw, - IDirectDraw7, This), - pGUID); + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw, iface); + HRESULT ret_value; + + ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); + + /* Overwrite the falsely set 'DIRECTDRAW7' flag */ + This->local.dwLocalFlags &= ~DDRAWILCL_DIRECTDRAW7; + + return ret_value; } static HRESULT WINAPI -IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 This, LPGUID pGUID) +IDirectDraw2Impl_Initialize(LPDIRECTDRAW2 iface, LPGUID pGUID) { - return IDirectDraw7_Initialize(COM_INTERFACE_CAST(IDirectDrawImpl, - IDirectDraw2, - IDirectDraw7, This), - pGUID); + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw2, iface); + HRESULT ret_value; + + ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); + + /* Overwrite the falsely set 'DIRECTDRAW7' flag */ + This->local.dwLocalFlags &= ~DDRAWILCL_DIRECTDRAW7; + + return ret_value; } static HRESULT WINAPI -IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 This, LPGUID pGUID) +IDirectDraw4Impl_Initialize(LPDIRECTDRAW4 iface, LPGUID pGUID) { - return IDirectDraw7_Initialize(COM_INTERFACE_CAST(IDirectDrawImpl, - IDirectDraw4, - IDirectDraw7, This), - pGUID); + ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw4, iface); + HRESULT ret_value; + + ret_value = IDirectDraw7_Initialize(ICOM_INTERFACE(This, IDirectDraw7), pGUID); + + /* Overwrite the falsely set 'DIRECTDRAW7' flag */ + This->local.dwLocalFlags &= ~DDRAWILCL_DIRECTDRAW7; + + return ret_value; } + static HRESULT WINAPI IDirectDrawImpl_RestoreDisplayMode(LPDIRECTDRAW This)