shell32: Use an iface instead of a vtbl pointer in IDefClFImpl.

This commit is contained in:
Michael Stefaniuc 2010-12-07 11:09:48 +01:00 committed by Alexandre Julliard
parent b6f869c743
commit 151b351679

View File

@ -358,7 +358,7 @@ HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
typedef struct typedef struct
{ {
const IClassFactoryVtbl *lpVtbl; IClassFactory IClassFactory_iface;
LONG ref; LONG ref;
CLSID *rclsid; CLSID *rclsid;
LPFNCREATEINSTANCE lpfnCI; LPFNCREATEINSTANCE lpfnCI;
@ -366,6 +366,11 @@ typedef struct
LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */
} IDefClFImpl; } IDefClFImpl;
static inline IDefClFImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IDefClFImpl, IClassFactory_iface);
}
static const IClassFactoryVtbl dclfvt; static const IClassFactoryVtbl dclfvt;
/************************************************************************** /**************************************************************************
@ -378,7 +383,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc
lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl)); lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
lpclf->ref = 1; lpclf->ref = 1;
lpclf->lpVtbl = &dclfvt; lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
lpclf->lpfnCI = lpfnCI; lpclf->lpfnCI = lpfnCI;
lpclf->pcRefDll = pcRefDll; lpclf->pcRefDll = pcRefDll;
@ -394,7 +399,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc
static HRESULT WINAPI IDefClF_fnQueryInterface( static HRESULT WINAPI IDefClF_fnQueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
{ {
IDefClFImpl *This = (IDefClFImpl *)iface; IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid)); TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid));
@ -414,7 +419,7 @@ static HRESULT WINAPI IDefClF_fnQueryInterface(
*/ */
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
{ {
IDefClFImpl *This = (IDefClFImpl *)iface; IDefClFImpl *This = impl_from_IClassFactory(iface);
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1); TRACE("(%p)->(count=%u)\n", This, refCount - 1);
@ -426,7 +431,7 @@ static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
*/ */
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
{ {
IDefClFImpl *This = (IDefClFImpl *)iface; IDefClFImpl *This = impl_from_IClassFactory(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount + 1); TRACE("(%p)->(count=%u)\n", This, refCount + 1);
@ -447,7 +452,7 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
static HRESULT WINAPI IDefClF_fnCreateInstance( static HRESULT WINAPI IDefClF_fnCreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject) LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
{ {
IDefClFImpl *This = (IDefClFImpl *)iface; IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(%p,%s,%p)\n",This,pUnkOuter,shdebugstr_guid(riid),ppvObject); TRACE("%p->(%p,%s,%p)\n",This,pUnkOuter,shdebugstr_guid(riid),ppvObject);
@ -468,7 +473,7 @@ static HRESULT WINAPI IDefClF_fnCreateInstance(
*/ */
static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
{ {
IDefClFImpl *This = (IDefClFImpl *)iface; IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(0x%x), not implemented\n",This, fLock); TRACE("%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL; return E_NOTIMPL;
} }