shdocvw: Register InternetExplorer class factory in IEWinMain.

Based on a patch by Mike McCormack.
This commit is contained in:
Jacek Caban 2006-04-19 20:37:57 +02:00 committed by Alexandre Julliard
parent c51aefdb58
commit 4a8397a593
3 changed files with 37 additions and 1 deletions

View File

@ -138,3 +138,28 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **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);
} }
HRESULT register_class_object(BOOL do_reg)
{
HRESULT hres;
static DWORD cookie;
static IClassFactoryImpl IEClassFactory = {&WBCF_Vtbl, InternetExplorer_Create};
if(do_reg) {
hres = CoRegisterClassObject(&CLSID_InternetExplorer, (IUnknown*)FACTORY(&IEClassFactory),
CLSCTX_SERVER, REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie);
if (FAILED(hres)) {
ERR("failed to register object %08lx\n", hres);
return hres;
}
hres = CoResumeClassObjects();
if(SUCCEEDED(hres))
return hres;
ERR("failed to resume object %08lx\n", hres);
}
return CoRevokeClassObject(cookie);
}

View File

@ -590,11 +590,18 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
{ {
LPWSTR url; LPWSTR url;
DWORD len; DWORD len;
HRESULT hres;
FIXME("%s %d\n", debugstr_a(szCommandLine), nShowWindow); FIXME("%s %d\n", debugstr_a(szCommandLine), nShowWindow);
CoInitialize(NULL); CoInitialize(NULL);
hres = register_class_object(TRUE);
if(FAILED(hres)) {
CoUninitialize();
ExitProcess(1);
}
/* FIXME: parse the command line properly, handle -Embedding */ /* FIXME: parse the command line properly, handle -Embedding */
len = MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, NULL, 0);
@ -605,7 +612,9 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
HeapFree(GetProcessHeap(), 0, url); HeapFree(GetProcessHeap(), 0, url);
CoUninitialize(); register_class_object(FALSE);
CoUninitialize();
ExitProcess(0); ExitProcess(0);
return 0; return 0;

View File

@ -200,4 +200,6 @@ extern void register_iewindow_class(void);
extern void unregister_iewindow_class(void); extern void unregister_iewindow_class(void);
extern BOOL create_ie_window(LPCWSTR url); extern BOOL create_ie_window(LPCWSTR url);
HRESULT register_class_object(BOOL);
#endif /* __WINE_SHDOCVW_H */ #endif /* __WINE_SHDOCVW_H */