shdocvw: Move DllGetClassObject implementation to factory.c.
This commit is contained in:
parent
b26ed16633
commit
c48c50f575
|
@ -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;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("WebBrowser class %s\n", debugstr_guid(rclsid) );
|
||||
if(!SHDOCVW_TryLoadMozillaControl())
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
|
||||
pGetClassObject = (fnGetClassObject)
|
||||
GetProcAddress( hMozCtl, "DllGetClassObject" );
|
||||
pGetClassObject = (fnGetClassObject)GetProcAddress( hMozCtl, "DllGetClassObject" );
|
||||
|
||||
if( !pGetClassObject )
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
r = pGetClassObject( &CLSID_MozillaBrowser, riid, ppv );
|
||||
|
||||
TRACE("r = %08lx *ppv = %p\n", r, *ppv );
|
||||
hres = pGetClassObject( &CLSID_MozillaBrowser, riid, ppv );
|
||||
|
||||
return r;
|
||||
}
|
||||
TRACE("hres = %08lx *ppv = %p\n", hres, *ppv );
|
||||
|
||||
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;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
|
||||
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
|
||||
return hres;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue