Commit f85759bc authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Update the 'DIRECTDRAW7' flag according to the interface initialized.

parent 18e6bb81
......@@ -335,7 +335,7 @@ HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
{
HRESULT hr;
TRACE("(%p)\n", This);
TRACE("(%p,%d)\n", This, ex);
hr = User_DirectDraw_Construct(This, ex);
if (FAILED(hr)) return hr;
......
......@@ -698,32 +698,48 @@ IDirectDraw4Impl_GetVerticalBlankStatus(LPDIRECTDRAW4 This, LPBOOL lpbIsInVB)
}
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)
{
......
......@@ -241,6 +241,8 @@ static HRESULT DDRAW_Create(
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 @@ static HRESULT DDRAW_Create(
|| 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 @@ static HRESULT DDRAW_Create(
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 DirectDrawCreate(
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 @@ static HRESULT DDRAW_CreateDirectDraw(IUnknown* pUnkOuter, REFIID iid,
{
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 @@ DDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
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 @@ DDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment