ddrawex: Get rid of the IDirectDrawFactoryImpl typedef.
This commit is contained in:
parent
ec37ac6f20
commit
b9e1bcb7f6
|
@ -1276,17 +1276,8 @@ static const IDirectDraw4Vtbl IDirectDraw4_Vtbl =
|
|||
IDirectDraw4Impl_GetDeviceIdentifier
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* IDirectDrawFactoryImpl_CreateDirectDraw
|
||||
*******************************************************************************/
|
||||
HRESULT WINAPI
|
||||
IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
|
||||
GUID * pGUID,
|
||||
HWND hWnd,
|
||||
DWORD dwCoopLevelFlags,
|
||||
DWORD dwReserved,
|
||||
IUnknown *pUnkOuter,
|
||||
IDirectDraw **ppDirectDraw)
|
||||
HRESULT WINAPI ddrawex_factory_CreateDirectDraw(IDirectDrawFactory *iface, GUID * pGUID, HWND hWnd,
|
||||
DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter, IDirectDraw **ppDirectDraw)
|
||||
{
|
||||
HRESULT hr;
|
||||
IDirectDrawImpl *object = NULL;
|
||||
|
|
|
@ -44,9 +44,9 @@ DECLARE_INTERFACE_(IDirectDrawFactory, IUnknown)
|
|||
#endif
|
||||
|
||||
|
||||
HRESULT WINAPI IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
|
||||
GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter,
|
||||
IDirectDraw **ppDirectDraw) DECLSPEC_HIDDEN;
|
||||
HRESULT WINAPI ddrawex_factory_CreateDirectDraw(IDirectDrawFactory *iface,
|
||||
GUID *guid, HWND window, DWORD coop_level, DWORD reserved, IUnknown *outer_unknown,
|
||||
IDirectDraw **ddraw) DECLSPEC_HIDDEN;
|
||||
|
||||
void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN;
|
||||
void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -116,129 +116,96 @@ static const IClassFactoryVtbl ddrawex_class_factory_vtbl =
|
|||
ddrawex_class_factory_LockServer,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* DirectDrawFactory implementation
|
||||
******************************************************************************/
|
||||
typedef struct
|
||||
struct ddrawex_factory
|
||||
{
|
||||
IDirectDrawFactory IDirectDrawFactory_iface;
|
||||
LONG ref;
|
||||
} IDirectDrawFactoryImpl;
|
||||
};
|
||||
|
||||
static inline IDirectDrawFactoryImpl *impl_from_IDirectDrawFactory(IDirectDrawFactory *iface)
|
||||
static inline struct ddrawex_factory *impl_from_IDirectDrawFactory(IDirectDrawFactory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirectDrawFactoryImpl, IDirectDrawFactory_iface);
|
||||
return CONTAINING_RECORD(iface, struct ddrawex_factory, IDirectDrawFactory_iface);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* IDirectDrawFactory::QueryInterface
|
||||
*
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI IDirectDrawFactoryImpl_QueryInterface(IDirectDrawFactory *iface, REFIID riid,
|
||||
void **obj)
|
||||
static HRESULT WINAPI ddrawex_factory_QueryInterface(IDirectDrawFactory *iface, REFIID riid, void **out)
|
||||
{
|
||||
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), obj);
|
||||
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IDirectDrawFactory))
|
||||
if (IsEqualGUID(riid, &IID_IDirectDrawFactory)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IDirectDrawFactory_AddRef(iface);
|
||||
*obj = iface;
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
|
||||
*obj = NULL;
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* IDirectDrawFactory::AddRef
|
||||
*
|
||||
*******************************************************************************/
|
||||
static ULONG WINAPI IDirectDrawFactoryImpl_AddRef(IDirectDrawFactory *iface)
|
||||
static ULONG WINAPI ddrawex_factory_AddRef(IDirectDrawFactory *iface)
|
||||
{
|
||||
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
struct ddrawex_factory *factory = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG refcount = InterlockedIncrement(&factory->ref);
|
||||
|
||||
TRACE("(%p)->() incrementing from %d.\n", This, ref - 1);
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
return ref;
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* IDirectDrawFactory::Release
|
||||
*
|
||||
*******************************************************************************/
|
||||
static ULONG WINAPI IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
|
||||
static ULONG WINAPI ddrawex_factory_Release(IDirectDrawFactory *iface)
|
||||
{
|
||||
IDirectDrawFactoryImpl *This = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
struct ddrawex_factory *factory = impl_from_IDirectDrawFactory(iface);
|
||||
ULONG refcount = InterlockedDecrement(&factory->ref);
|
||||
|
||||
TRACE("(%p)->() decrementing from %d.\n", This, ref+1);
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
if (!refcount)
|
||||
HeapFree(GetProcessHeap(), 0, factory);
|
||||
|
||||
return ref;
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectDrawFactoryImpl_DirectDrawEnumerate(IDirectDrawFactory *iface,
|
||||
static HRESULT WINAPI ddrawex_factory_DirectDrawEnumerate(IDirectDrawFactory *iface,
|
||||
LPDDENUMCALLBACKW cb, void *ctx)
|
||||
{
|
||||
FIXME("Stub!\n");
|
||||
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Direct Draw Factory VTable
|
||||
*******************************************************************************/
|
||||
static const IDirectDrawFactoryVtbl IDirectDrawFactory_Vtbl =
|
||||
static const IDirectDrawFactoryVtbl ddrawex_factory_vtbl =
|
||||
{
|
||||
IDirectDrawFactoryImpl_QueryInterface,
|
||||
IDirectDrawFactoryImpl_AddRef,
|
||||
IDirectDrawFactoryImpl_Release,
|
||||
IDirectDrawFactoryImpl_CreateDirectDraw,
|
||||
IDirectDrawFactoryImpl_DirectDrawEnumerate,
|
||||
ddrawex_factory_QueryInterface,
|
||||
ddrawex_factory_AddRef,
|
||||
ddrawex_factory_Release,
|
||||
ddrawex_factory_CreateDirectDraw,
|
||||
ddrawex_factory_DirectDrawEnumerate,
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* CreateDirectDrawFactory
|
||||
*
|
||||
***********************************************************************/
|
||||
static HRESULT
|
||||
CreateDirectDrawFactory(IUnknown* UnkOuter, REFIID iid, void **obj)
|
||||
static HRESULT ddrawex_factory_create(IUnknown *outer_unknown, REFIID riid, void **out)
|
||||
{
|
||||
struct ddrawex_factory *factory;
|
||||
HRESULT hr;
|
||||
IDirectDrawFactoryImpl *This = NULL;
|
||||
|
||||
TRACE("(%p,%s,%p)\n", UnkOuter, debugstr_guid(iid), obj);
|
||||
TRACE("outer_unknown %p, riid %s, out %p.\n", outer_unknown, debugstr_guid(riid), out);
|
||||
|
||||
if (UnkOuter != NULL)
|
||||
if (outer_unknown)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawFactoryImpl));
|
||||
|
||||
if(!This)
|
||||
{
|
||||
ERR("Out of memory when creating DirectDraw\n");
|
||||
if (!(factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory))))
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->IDirectDrawFactory_iface.lpVtbl = &IDirectDrawFactory_Vtbl;
|
||||
factory->IDirectDrawFactory_iface.lpVtbl = &ddrawex_factory_vtbl;
|
||||
|
||||
hr = IDirectDrawFactory_QueryInterface(&This->IDirectDrawFactory_iface, iid, obj);
|
||||
|
||||
if (FAILED(hr))
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
if (FAILED(hr = ddrawex_factory_QueryInterface(&factory->IDirectDrawFactory_iface, riid, out)))
|
||||
HeapFree(GetProcessHeap(), 0, factory);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* DllCanUnloadNow [DDRAWEX.@] Determines whether the DLL is in use.
|
||||
*/
|
||||
|
@ -273,7 +240,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
|
|||
factory->IClassFactory_iface.lpVtbl = &ddrawex_class_factory_vtbl;
|
||||
factory->ref = 1;
|
||||
|
||||
factory->pfnCreateInstance = CreateDirectDrawFactory;
|
||||
factory->pfnCreateInstance = ddrawex_factory_create;
|
||||
|
||||
*out = factory;
|
||||
|
||||
|
|
Loading…
Reference in New Issue