wbemprox: Use an iface instead of a vtbl pointer in wbemprox_cf.

Michael Stefaniuc mstefani at redhat.de
Tue Dec 28 19:53:40 CST 2010


---
 dlls/wbemprox/main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/wbemprox/main.c b/dlls/wbemprox/main.c
index 5f32bd2..c6bb240 100644
--- a/dlls/wbemprox/main.c
+++ b/dlls/wbemprox/main.c
@@ -40,13 +40,13 @@ typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj );
 
 typedef struct
 {
-    const struct IClassFactoryVtbl *vtbl;
+    IClassFactory IClassFactory_iface;
     fnCreateInstance pfnCreateInstance;
 } wbemprox_cf;
 
 static inline wbemprox_cf *impl_from_IClassFactory( IClassFactory *iface )
 {
-    return (wbemprox_cf *)((char *)iface - FIELD_OFFSET( wbemprox_cf, vtbl ));
+    return CONTAINING_RECORD(iface, wbemprox_cf, IClassFactory_iface);
 }
 
 static HRESULT WINAPI wbemprox_cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj )
@@ -113,7 +113,7 @@ static const struct IClassFactoryVtbl wbemprox_cf_vtbl =
     wbemprox_cf_LockServer
 };
 
-static wbemprox_cf wbem_locator_cf = { &wbemprox_cf_vtbl, WbemLocator_create };
+static wbemprox_cf wbem_locator_cf = { { &wbemprox_cf_vtbl }, WbemLocator_create };
 
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
@@ -141,7 +141,7 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
 
     if (IsEqualGUID( rclsid, &CLSID_WbemLocator ))
     {
-       cf = (IClassFactory *)&wbem_locator_cf.vtbl;
+       cf = &wbem_locator_cf.IClassFactory_iface;
     }
     if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
     return IClassFactory_QueryInterface( cf, iid, ppv );
-- 
1.7.3.4



More information about the wine-patches mailing list