mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 21:20:25 +00:00
ddrawex: COM cleanup for the IDirectDrawFactory iface.
This commit is contained in:
parent
3799ad3482
commit
0b9cfcfcc9
@ -44,15 +44,6 @@ DECLARE_INTERFACE_(IDirectDrawFactory, IUnknown)
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* DirectDrawFactory implementation
|
||||
******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
const IDirectDrawFactoryVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} IDirectDrawFactoryImpl;
|
||||
|
||||
HRESULT WINAPI IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
|
||||
GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter,
|
||||
IDirectDraw **ppDirectDraw);
|
||||
|
@ -150,16 +150,28 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* DirectDrawFactory implementation
|
||||
******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
IDirectDrawFactory IDirectDrawFactory_iface;
|
||||
LONG ref;
|
||||
} IDirectDrawFactoryImpl;
|
||||
|
||||
static inline IDirectDrawFactoryImpl *impl_from_IDirectDrawFactory(IDirectDrawFactory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectDrawFactoryImpl, IDirectDrawFactory_iface);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* IDirectDrawFactory::QueryInterface
|
||||
*
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface,
|
||||
REFIID riid,
|
||||
void **obj)
|
||||
static HRESULT WINAPI IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface, REFIID riid,
|
||||
void **obj)
|
||||
{
|
||||
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
|
||||
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
|
||||
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
|
||||
|
||||
@ -179,10 +191,9 @@ IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface,
|
||||
* IDirectDrawFactory::AddRef
|
||||
*
|
||||
*******************************************************************************/
|
||||
static ULONG WINAPI
|
||||
IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
|
||||
static ULONG WINAPI IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
|
||||
{
|
||||
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
|
||||
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
|
||||
@ -194,11 +205,11 @@ IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
|
||||
* IDirectDrawFactory::Release
|
||||
*
|
||||
*******************************************************************************/
|
||||
static ULONG WINAPI
|
||||
IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
|
||||
static ULONG WINAPI IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
|
||||
{
|
||||
IDirectDrawFactoryImpl *This = (IDirectDrawFactoryImpl*) iface;
|
||||
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
|
||||
|
||||
if (ref == 0)
|
||||
@ -255,9 +266,9 @@ CreateDirectDrawFactory(IUnknown* UnkOuter, REFIID iid, void **obj)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->lpVtbl = &IDirectDrawFactory_Vtbl;
|
||||
This->IDirectDrawFactory_iface.lpVtbl = &IDirectDrawFactory_Vtbl;
|
||||
|
||||
hr = IDirectDrawFactory_QueryInterface((IDirectDrawFactory *)This, iid, obj);
|
||||
hr = IDirectDrawFactory_QueryInterface(&This->IDirectDrawFactory_iface, iid, obj);
|
||||
|
||||
if (FAILED(hr))
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
Loading…
Reference in New Issue
Block a user