Commit be6dcb54 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

shdocvw: Use an iface instead of an vtbl pointer in IClassFactoryImpl.

parent 02986df0
...@@ -34,20 +34,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); ...@@ -34,20 +34,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
/********************************************************************** /**********************************************************************
* Implement the WebBrowser class factory * Implement the WebBrowser class factory
*
* (Based on implementation in ddraw/main.c)
*/ */
#define FACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
typedef struct typedef struct
{ {
/* IUnknown fields */ /* IUnknown fields */
const IClassFactoryVtbl *lpClassFactoryVtbl; IClassFactory IClassFactory_iface;
HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *); HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *);
LONG ref; LONG ref;
} IClassFactoryImpl; } IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
/********************************************************************** /**********************************************************************
* WBCF_QueryInterface (IUnknown) * WBCF_QueryInterface (IUnknown)
...@@ -131,28 +132,28 @@ static const IClassFactoryVtbl WBCF_Vtbl = ...@@ -131,28 +132,28 @@ static const IClassFactoryVtbl WBCF_Vtbl =
*/ */
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
{ {
static IClassFactoryImpl WB1ClassFactory = {&WBCF_Vtbl, WebBrowserV1_Create}; static IClassFactoryImpl WB1ClassFactory = {{&WBCF_Vtbl}, WebBrowserV1_Create};
static IClassFactoryImpl WB2ClassFactory = {&WBCF_Vtbl, WebBrowserV2_Create}; static IClassFactoryImpl WB2ClassFactory = {{&WBCF_Vtbl}, WebBrowserV2_Create};
static IClassFactoryImpl CUHClassFactory = {&WBCF_Vtbl, CUrlHistory_Create}; static IClassFactoryImpl CUHClassFactory = {{&WBCF_Vtbl}, CUrlHistory_Create};
static IClassFactoryImpl ISCClassFactory = {&WBCF_Vtbl, InternetShortcut_Create}; static IClassFactoryImpl ISCClassFactory = {{&WBCF_Vtbl}, InternetShortcut_Create};
static IClassFactoryImpl TBLClassFactory = {&WBCF_Vtbl, TaskbarList_Create}; static IClassFactoryImpl TBLClassFactory = {{&WBCF_Vtbl}, TaskbarList_Create};
TRACE("\n"); TRACE("\n");
if(IsEqualGUID(&CLSID_WebBrowser, rclsid)) if(IsEqualGUID(&CLSID_WebBrowser, rclsid))
return IClassFactory_QueryInterface(FACTORY(&WB2ClassFactory), riid, ppv); return IClassFactory_QueryInterface(&WB2ClassFactory.IClassFactory_iface, riid, ppv);
if(IsEqualGUID(&CLSID_WebBrowser_V1, rclsid)) if(IsEqualGUID(&CLSID_WebBrowser_V1, rclsid))
return IClassFactory_QueryInterface(FACTORY(&WB1ClassFactory), riid, ppv); return IClassFactory_QueryInterface(&WB1ClassFactory.IClassFactory_iface, riid, ppv);
if(IsEqualGUID(&CLSID_CUrlHistory, rclsid)) if(IsEqualGUID(&CLSID_CUrlHistory, rclsid))
return IClassFactory_QueryInterface(FACTORY(&CUHClassFactory), riid, ppv); return IClassFactory_QueryInterface(&CUHClassFactory.IClassFactory_iface, riid, ppv);
if(IsEqualGUID(&CLSID_InternetShortcut, rclsid)) if(IsEqualGUID(&CLSID_InternetShortcut, rclsid))
return IClassFactory_QueryInterface(FACTORY(&ISCClassFactory), riid, ppv); return IClassFactory_QueryInterface(&ISCClassFactory.IClassFactory_iface, riid, ppv);
if(IsEqualGUID(&CLSID_TaskbarList, rclsid)) if(IsEqualGUID(&CLSID_TaskbarList, rclsid))
return IClassFactory_QueryInterface(FACTORY(&TBLClassFactory), riid, ppv); return IClassFactory_QueryInterface(&TBLClassFactory.IClassFactory_iface, riid, ppv);
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */ /* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv); return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
...@@ -163,11 +164,12 @@ HRESULT register_class_object(BOOL do_reg) ...@@ -163,11 +164,12 @@ HRESULT register_class_object(BOOL do_reg)
HRESULT hres; HRESULT hres;
static DWORD cookie; static DWORD cookie;
static IClassFactoryImpl IEClassFactory = {&WBCF_Vtbl, InternetExplorer_Create}; static IClassFactoryImpl IEClassFactory = {{&WBCF_Vtbl}, InternetExplorer_Create};
if(do_reg) { if(do_reg) {
hres = CoRegisterClassObject(&CLSID_InternetExplorer, (IUnknown*)FACTORY(&IEClassFactory), hres = CoRegisterClassObject(&CLSID_InternetExplorer,
CLSCTX_SERVER, REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie); (IUnknown*)&IEClassFactory.IClassFactory_iface, CLSCTX_SERVER,
REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie);
if (FAILED(hres)) { if (FAILED(hres)) {
ERR("failed to register object %08x\n", hres); ERR("failed to register object %08x\n", hres);
return hres; return hres;
......
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