Commit 5b502e3e authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

hlink: Use an iface instead of a vtbl pointer in CFImpl.

parent 81f44f50
...@@ -34,10 +34,15 @@ typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*); ...@@ -34,10 +34,15 @@ typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
typedef struct typedef struct
{ {
const IClassFactoryVtbl *lpVtbl; IClassFactory IClassFactory_iface;
LPFNCREATEINSTANCE lpfnCI; LPFNCREATEINSTANCE lpfnCI;
} CFImpl; } CFImpl;
static inline CFImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, CFImpl, IClassFactory_iface);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved); TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved);
...@@ -500,7 +505,7 @@ cleanup: ...@@ -500,7 +505,7 @@ cleanup:
static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface, static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppvObj) REFIID riid, LPVOID *ppvObj)
{ {
CFImpl *This = (CFImpl *)iface; CFImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%s)\n",This,debugstr_guid(riid)); TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
...@@ -530,7 +535,7 @@ static ULONG WINAPI HLinkCF_fnRelease(LPCLASSFACTORY iface) ...@@ -530,7 +535,7 @@ static ULONG WINAPI HLinkCF_fnRelease(LPCLASSFACTORY iface)
static HRESULT WINAPI HLinkCF_fnCreateInstance( LPCLASSFACTORY iface, static HRESULT WINAPI HLinkCF_fnCreateInstance( LPCLASSFACTORY iface,
LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject) LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
{ {
CFImpl *This = (CFImpl *)iface; CFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject); TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
...@@ -554,8 +559,8 @@ static const IClassFactoryVtbl hlcfvt = ...@@ -554,8 +559,8 @@ static const IClassFactoryVtbl hlcfvt =
HLinkCF_fnLockServer HLinkCF_fnLockServer
}; };
static CFImpl HLink_cf = { &hlcfvt, HLink_Constructor }; static CFImpl HLink_cf = { { &hlcfvt }, HLink_Constructor };
static CFImpl HLinkBrowseContext_cf = { &hlcfvt, HLinkBrowseContext_Constructor }; static CFImpl HLinkBrowseContext_cf = { { &hlcfvt }, HLinkBrowseContext_Constructor };
/*********************************************************************** /***********************************************************************
* DllGetClassObject (HLINK.@) * DllGetClassObject (HLINK.@)
...@@ -571,9 +576,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) ...@@ -571,9 +576,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
*ppv = NULL; *ppv = NULL;
if (IsEqualIID(rclsid, &CLSID_StdHlink)) if (IsEqualIID(rclsid, &CLSID_StdHlink))
pcf = (IClassFactory*) &HLink_cf; pcf = &HLink_cf.IClassFactory_iface;
else if (IsEqualIID(rclsid, &CLSID_StdHlinkBrowseContext)) else if (IsEqualIID(rclsid, &CLSID_StdHlinkBrowseContext))
pcf = (IClassFactory*) &HLinkBrowseContext_cf; pcf = &HLinkBrowseContext_cf.IClassFactory_iface;
else else
return CLASS_E_CLASSNOTAVAILABLE; return CLASS_E_CLASSNOTAVAILABLE;
......
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