Commit c48c50f5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

shdocvw: Move DllGetClassObject implementation to factory.c.

parent b26ed166
......@@ -30,10 +30,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
* (Based on implementation in ddraw/main.c)
*/
#define FACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
typedef struct
{
/* IUnknown fields */
const IClassFactoryVtbl *lpVtbl;
const IClassFactoryVtbl *lpClassFactoryVtbl;
HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *);
LONG ref;
} IClassFactoryImpl;
......@@ -115,9 +117,24 @@ static const IClassFactoryVtbl WBCF_Vtbl =
WBCF_LockServer
};
static IClassFactoryImpl SHDOCVW_WBClassFactory = {&WBCF_Vtbl, WebBrowser_Create};
IClassFactory *get_class_factory(void)
/*************************************************************************
* DllGetClassObject (SHDOCVW.@)
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
{
return (IClassFactory*) &SHDOCVW_WBClassFactory;
HRESULT hres;
static IClassFactoryImpl WBClassFactory = {&WBCF_Vtbl, WebBrowser_Create};
TRACE("\n");
if(IsEqualGUID(&CLSID_WebBrowser, rclsid)) {
hres = create_mozctl(riid, ppv);
if(SUCCEEDED(hres))
return hres;
return IClassFactory_QueryInterface(FACTORY(&WBClassFactory), riid, ppv);
}
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
}
......@@ -169,6 +169,8 @@ void deactivate_document(DocHost*);
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(DocHost*,LPCWSTR,PBYTE,ULONG,LPWSTR);
HRESULT create_mozctl(REFIID,void**);
#define WB_WM_NAVIGATE2 (WM_USER+100)
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
......@@ -184,6 +186,5 @@ extern HINSTANCE shdocvw_hinstance;
extern void register_iewindow_class(void);
extern void unregister_iewindow_class(void);
extern BOOL create_ie_window(LPCWSTR url);
extern IClassFactory *get_class_factory(void);
#endif /* __WINE_SHDOCVW_H */
......@@ -444,46 +444,24 @@ static BOOL SHDOCVW_TryLoadMozillaControl(void)
}
}
/*************************************************************************
* DllGetClassObject (SHDOCVW.@)
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
HRESULT create_mozctl(REFIID riid, void **ppv)
{
TRACE("\n");
if( IsEqualGUID( &CLSID_WebBrowser, rclsid ) &&
SHDOCVW_TryLoadMozillaControl() )
{
HRESULT r;
fnGetClassObject pGetClassObject;
TRACE("WebBrowser class %s\n", debugstr_guid(rclsid) );
fnGetClassObject pGetClassObject;
HRESULT hres;
pGetClassObject = (fnGetClassObject)
GetProcAddress( hMozCtl, "DllGetClassObject" );
if(!SHDOCVW_TryLoadMozillaControl())
return CLASS_E_CLASSNOTAVAILABLE;
if( !pGetClassObject )
return CLASS_E_CLASSNOTAVAILABLE;
r = pGetClassObject( &CLSID_MozillaBrowser, riid, ppv );
pGetClassObject = (fnGetClassObject)GetProcAddress( hMozCtl, "DllGetClassObject" );
TRACE("r = %08lx *ppv = %p\n", r, *ppv );
if( !pGetClassObject )
return CLASS_E_CLASSNOTAVAILABLE;
return r;
}
if (IsEqualCLSID(&CLSID_WebBrowser, rclsid) &&
IsEqualIID(&IID_IClassFactory, riid))
{
/* Pass back our shdocvw class factory */
IClassFactory *cf = get_class_factory();
IClassFactory_AddRef(cf);
*ppv = cf;
hres = pGetClassObject( &CLSID_MozillaBrowser, riid, ppv );
return S_OK;
}
TRACE("hres = %08lx *ppv = %p\n", hres, *ppv );
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
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