Commit 6d7d1b58 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dinput: Use an iface instead of a vtbl pointer in IClassFactoryImpl.

parent 72f3765a
...@@ -794,24 +794,29 @@ static const IDirectInput8WVtbl ddi8wvt = { ...@@ -794,24 +794,29 @@ static const IDirectInput8WVtbl ddi8wvt = {
typedef struct typedef struct
{ {
/* IUnknown fields */ /* IUnknown fields */
const IClassFactoryVtbl *lpVtbl; IClassFactory IClassFactory_iface;
LONG ref; LONG ref;
} IClassFactoryImpl; } IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj); FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) { static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&(This->ref)); return InterlockedIncrement(&(This->ref));
} }
static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) { static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = impl_from_IClassFactory(iface);
/* static class, won't be freed */ /* static class, won't be freed */
return InterlockedDecrement(&(This->ref)); return InterlockedDecrement(&(This->ref));
} }
...@@ -819,7 +824,7 @@ static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) { ...@@ -819,7 +824,7 @@ static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) {
static HRESULT WINAPI DICF_CreateInstance( static HRESULT WINAPI DICF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) { ) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if ( IsEqualGUID( &IID_IUnknown, riid ) || if ( IsEqualGUID( &IID_IUnknown, riid ) ||
...@@ -840,7 +845,7 @@ static HRESULT WINAPI DICF_CreateInstance( ...@@ -840,7 +845,7 @@ static HRESULT WINAPI DICF_CreateInstance(
} }
static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY 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;
} }
...@@ -852,7 +857,7 @@ static const IClassFactoryVtbl DICF_Vtbl = { ...@@ -852,7 +857,7 @@ static const IClassFactoryVtbl DICF_Vtbl = {
DICF_CreateInstance, DICF_CreateInstance,
DICF_LockServer DICF_LockServer
}; };
static IClassFactoryImpl DINPUT_CF = {&DICF_Vtbl, 1 }; static IClassFactoryImpl DINPUT_CF = {{&DICF_Vtbl}, 1 };
/*********************************************************************** /***********************************************************************
* DllCanUnloadNow (DINPUT.@) * DllCanUnloadNow (DINPUT.@)
......
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