From 39e80379e797805f2ff7f333dfc31d8f5a4f1cbd Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 14 Jan 2011 00:42:42 +0100 Subject: [PATCH] objsel: COM cleanup for the IClassFactory iface. --- dlls/objsel/factory.c | 11 ++++++++--- dlls/objsel/objsel.c | 2 +- dlls/objsel/objsel_private.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/objsel/factory.c b/dlls/objsel/factory.c index 090c1266a42..cb0fb491cb4 100644 --- a/dlls/objsel/factory.c +++ b/dlls/objsel/factory.c @@ -26,6 +26,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(objsel); +static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface); +} + /********************************************************************** * OBJSEL_IClassFactory_QueryInterface (also IUnknown) */ @@ -60,7 +65,7 @@ static HRESULT WINAPI OBJSEL_IClassFactory_QueryInterface( */ static ULONG WINAPI OBJSEL_IClassFactory_AddRef(LPCLASSFACTORY iface) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; + ClassFactoryImpl *This = impl_from_IClassFactory(iface); ULONG ref; TRACE("\n"); @@ -83,7 +88,7 @@ static ULONG WINAPI OBJSEL_IClassFactory_AddRef(LPCLASSFACTORY iface) */ static ULONG WINAPI OBJSEL_IClassFactory_Release(LPCLASSFACTORY iface) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; + ClassFactoryImpl *This = impl_from_IClassFactory(iface); ULONG ref; TRACE("\n"); @@ -160,4 +165,4 @@ static IClassFactoryVtbl IClassFactory_Vtbl = * static ClassFactory instance */ -ClassFactoryImpl OBJSEL_ClassFactory = { &IClassFactory_Vtbl, 0 }; +ClassFactoryImpl OBJSEL_ClassFactory = { { &IClassFactory_Vtbl }, 0 }; diff --git a/dlls/objsel/objsel.c b/dlls/objsel/objsel.c index 79933205dde..3ba2ac1cc5f 100644 --- a/dlls/objsel/objsel.c +++ b/dlls/objsel/objsel.c @@ -54,7 +54,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) *ppv = NULL; if (IsEqualGUID(rclsid, &CLSID_DsObjectPicker)) - return IClassFactory_QueryInterface((IClassFactory*)&OBJSEL_ClassFactory, iid, ppv); + return IClassFactory_QueryInterface(&OBJSEL_ClassFactory.IClassFactory_iface, iid, ppv); FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/objsel/objsel_private.h b/dlls/objsel/objsel_private.h index 8c9a3c85ae4..62d6eb493e1 100644 --- a/dlls/objsel/objsel_private.h +++ b/dlls/objsel/objsel_private.h @@ -49,7 +49,7 @@ extern LONG dll_refs; */ typedef struct { - IClassFactoryVtbl *lpVtbl; + IClassFactory IClassFactory_iface; LONG ref; } ClassFactoryImpl;