Module: wine Branch: master Commit: 151b3516792764c3a11b14b706d9817dcadc35af URL: http://source.winehq.org/git/wine.git/?a=commit;h=151b3516792764c3a11b14b706...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Dec 7 11:09:48 2010 +0100
shell32: Use an iface instead of a vtbl pointer in IDefClFImpl.
---
dlls/shell32/shellole.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index d678276..41b9711 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -358,7 +358,7 @@ HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
typedef struct { - const IClassFactoryVtbl *lpVtbl; + IClassFactory IClassFactory_iface; LONG ref; CLSID *rclsid; LPFNCREATEINSTANCE lpfnCI; @@ -366,6 +366,11 @@ typedef struct LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ } IDefClFImpl;
+static inline IDefClFImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, IDefClFImpl, IClassFactory_iface); +} + static const IClassFactoryVtbl dclfvt;
/************************************************************************** @@ -378,7 +383,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc
lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl)); lpclf->ref = 1; - lpclf->lpVtbl = &dclfvt; + lpclf->IClassFactory_iface.lpVtbl = &dclfvt; lpclf->lpfnCI = lpfnCI; lpclf->pcRefDll = pcRefDll;
@@ -394,7 +399,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc static HRESULT WINAPI IDefClF_fnQueryInterface( LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) { - IDefClFImpl *This = (IDefClFImpl *)iface; + IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid));
@@ -414,7 +419,7 @@ static HRESULT WINAPI IDefClF_fnQueryInterface( */ static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) { - IDefClFImpl *This = (IDefClFImpl *)iface; + IDefClFImpl *This = impl_from_IClassFactory(iface); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1); @@ -426,9 +431,9 @@ static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) */ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) { - IDefClFImpl *This = (IDefClFImpl *)iface; + IDefClFImpl *This = impl_from_IClassFactory(iface); ULONG refCount = InterlockedDecrement(&This->ref); - + TRACE("(%p)->(count=%u)\n", This, refCount + 1);
if (!refCount) @@ -447,7 +452,7 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) static HRESULT WINAPI IDefClF_fnCreateInstance( 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);
@@ -468,7 +473,7 @@ static HRESULT WINAPI IDefClF_fnCreateInstance( */ 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); return E_NOTIMPL; }