mirror of
https://github.com/reactos/wine.git
synced 2025-02-14 09:39:30 +00:00
ddrawex: COM cleanup for the IClassFactory iface.
This commit is contained in:
parent
68d5d33e5e
commit
3799ad3482
@ -43,16 +43,6 @@ DECLARE_INTERFACE_(IDirectDrawFactory, IUnknown)
|
|||||||
#define IDirectDrawFactory_DirectDrawEnumerate(p,a,b) (p)->lpVtbl->_DirectDrawEnumerate(p,a,b)
|
#define IDirectDrawFactory_DirectDrawEnumerate(p,a,b) (p)->lpVtbl->_DirectDrawEnumerate(p,a,b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* DirectDraw ClassFactory implementation - incomplete
|
|
||||||
******************************************************************************/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
const IClassFactoryVtbl *lpVtbl;
|
|
||||||
LONG ref;
|
|
||||||
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj);
|
|
||||||
} IClassFactoryImpl;
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* DirectDrawFactory implementation
|
* DirectDrawFactory implementation
|
||||||
|
@ -39,16 +39,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddrawex);
|
|||||||
|
|
||||||
static HINSTANCE instance;
|
static HINSTANCE instance;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* DirectDraw ClassFactory implementation
|
||||||
|
******************************************************************************/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
IClassFactory IClassFactory_iface;
|
||||||
|
LONG ref;
|
||||||
|
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj);
|
||||||
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
|
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* IDirectDrawClassFactory::QueryInterface
|
* IDirectDrawClassFactory::QueryInterface
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface, REFIID riid,
|
||||||
IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface,
|
void **obj)
|
||||||
REFIID riid,
|
|
||||||
void **obj)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl*) iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
|
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obj);
|
||||||
|
|
||||||
@ -68,10 +81,9 @@ IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface,
|
|||||||
* IDirectDrawClassFactory::AddRef
|
* IDirectDrawClassFactory::AddRef
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static ULONG WINAPI
|
static ULONG WINAPI IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface)
|
||||||
IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl*) iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
ULONG ref = InterlockedIncrement(&This->ref);
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
|
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
|
||||||
@ -83,11 +95,11 @@ IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface)
|
|||||||
* IDirectDrawClassFactory::Release
|
* IDirectDrawClassFactory::Release
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static ULONG WINAPI
|
static ULONG WINAPI IDirectDrawClassFactoryImpl_Release(IClassFactory *iface)
|
||||||
IDirectDrawClassFactoryImpl_Release(IClassFactory *iface)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl*) iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
|
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
|
||||||
|
|
||||||
if (ref == 0)
|
if (ref == 0)
|
||||||
@ -101,13 +113,10 @@ IDirectDrawClassFactoryImpl_Release(IClassFactory *iface)
|
|||||||
* IDirectDrawClassFactory::CreateInstance
|
* IDirectDrawClassFactory::CreateInstance
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface,
|
||||||
IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface,
|
IUnknown *UnkOuter, REFIID riid, void **obj)
|
||||||
IUnknown *UnkOuter,
|
|
||||||
REFIID riid,
|
|
||||||
void **obj)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl*) iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%p,%s,%p)\n",This,UnkOuter,debugstr_guid(riid),obj);
|
TRACE("(%p)->(%p,%s,%p)\n",This,UnkOuter,debugstr_guid(riid),obj);
|
||||||
|
|
||||||
@ -118,11 +127,12 @@ IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface,
|
|||||||
* IDirectDrawClassFactory::LockServer
|
* IDirectDrawClassFactory::LockServer
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI IDirectDrawClassFactoryImpl_LockServer(IClassFactory *iface,BOOL dolock)
|
||||||
IDirectDrawClassFactoryImpl_LockServer(IClassFactory *iface,BOOL dolock)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl*) iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +297,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||||||
factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory));
|
factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory));
|
||||||
if (factory == NULL) return E_OUTOFMEMORY;
|
if (factory == NULL) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
factory->lpVtbl = &IClassFactory_Vtbl;
|
factory->IClassFactory_iface.lpVtbl = &IClassFactory_Vtbl;
|
||||||
factory->ref = 1;
|
factory->ref = 1;
|
||||||
|
|
||||||
factory->pfnCreateInstance = CreateDirectDrawFactory;
|
factory->pfnCreateInstance = CreateDirectDrawFactory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user