From e15b6096c620546a1fff433dae7cb1f75b669a38 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 2 Nov 2007 19:51:53 +0100 Subject: [PATCH] iexplore: Added self-registration code. --- dlls/mshtml/install.c | 27 +-------------------------- dlls/shdocvw/factory.c | 34 +++++++++++++++++++++++++--------- dlls/shdocvw/iexplore.c | 9 ++++++++- dlls/shdocvw/shdocvw.h | 1 + dlls/shdocvw/shdocvw.inf | 12 ++++++++++++ tools/wine.inf | 1 + 6 files changed, 48 insertions(+), 36 deletions(-) diff --git a/dlls/mshtml/install.c b/dlls/mshtml/install.c index c4404a7c467..4acef19dcd5 100644 --- a/dlls/mshtml/install.c +++ b/dlls/mshtml/install.c @@ -54,14 +54,6 @@ static const WCHAR mshtml_keyW[] = '\\','W','i','n','e', '\\','M','S','H','T','M','L',0}; -static const WCHAR wszMSIE[] = - {'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0}; -static const WCHAR wszIEVersion[] = - {'6','.','0','.','2','9','0','0','.','2','1','8','0',0}; - - static HWND install_dialog = NULL; static LPWSTR tmp_file_name = NULL; static HANDLE tmp_file = INVALID_HANDLE_VALUE; @@ -105,7 +97,6 @@ static void set_registry(LPCSTR install_dir) static const WCHAR wszGeckoPath[] = {'G','e','c','k','o','P','a','t','h',0}; static const WCHAR wszWineGecko[] = {'w','i','n','e','_','g','e','c','k','o',0}; - static const WCHAR wszVersion[] = {'V','e','r','s','i','o','n',0}; memcpy(mshtml_key, mshtml_keyW, sizeof(mshtml_keyW)); mshtml_key[sizeof(mshtml_keyW)/sizeof(WCHAR)-1] = '\\'; @@ -134,24 +125,8 @@ static void set_registry(LPCSTR install_dir) len*sizeof(WCHAR)+sizeof(wszWineGecko)); mshtml_free(gecko_path); RegCloseKey(hkey); - if(res != ERROR_SUCCESS) { + if(res != ERROR_SUCCESS) ERR("Failed to set GeckoPath value: %08x\n", res); - return; - } - - res = RegCreateKeyW(HKEY_LOCAL_MACHINE, wszMSIE, &hkey); - if(res != ERROR_SUCCESS) { - ERR("Failed to create Internet Explorer key: %d\n", res); - return; - } - - res = RegSetValueExW(hkey, wszVersion, 0, REG_SZ, (LPVOID)wszIEVersion, - sizeof(wszIEVersion)); - RegCloseKey(hkey); - if(res != ERROR_SUCCESS) { - ERR("Failed to set Version value: %d\n", res); - return; - } } static BOOL install_cab(LPCWSTR file_name) diff --git a/dlls/shdocvw/factory.c b/dlls/shdocvw/factory.c index ad4330ad7b9..2ed62e679ea 100644 --- a/dlls/shdocvw/factory.c +++ b/dlls/shdocvw/factory.c @@ -172,6 +172,23 @@ HRESULT register_class_object(BOOL do_reg) return CoRevokeClassObject(cookie); } +static HRESULT reg_install(LPCSTR section, STRTABLEA *strtable) +{ + typeof(RegInstallA) *pRegInstall; + HMODULE hadvpack; + HRESULT hres; + + static const WCHAR advpackW[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + + hadvpack = LoadLibraryW(advpackW); + pRegInstall = (typeof(RegInstallA)*)GetProcAddress(hadvpack, "RegInstall"); + + hres = pRegInstall(shdocvw_hinstance, section, strtable); + + FreeLibrary(hadvpack); + return hres; +} + static const GUID CLSID_MicrosoftBrowserArchitecture = {0xa5e46e3a, 0x8849, 0x11d1, {0x9d, 0x8c, 0x00, 0xc0, 0x4f, 0xc9, 0x9d, 0x61}}; static const GUID CLSID_MruLongList = @@ -188,15 +205,11 @@ static const GUID CLSID_MruLongList = static HRESULT register_server(BOOL doregister) { - HRESULT hres; - HMODULE hAdvpack; - typeof(RegInstallA) *pRegInstall; STRTABLEA strtable; STRENTRYA pse[13]; static CLSID const *clsids[13]; int i = 0; - - static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + HRESULT hres; INF_SET_CLSID(CUrlHistory); INF_SET_CLSID(Internet); @@ -223,10 +236,7 @@ static HRESULT register_server(BOOL doregister) strtable.cEntries = sizeof(pse)/sizeof(pse[0]); strtable.pse = pse; - hAdvpack = LoadLibraryW(wszAdvpack); - pRegInstall = (typeof(RegInstallA)*)GetProcAddress(hAdvpack, "RegInstall"); - - hres = pRegInstall(shdocvw_hinstance, doregister ? "RegisterDll" : "UnregisterDll", &strtable); + hres = reg_install(doregister ? "RegisterDll" : "UnregisterDll", &strtable); for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) HeapFree(GetProcessHeap(), 0, pse[i].pszValue); @@ -274,3 +284,9 @@ HRESULT WINAPI DllUnregisterServer(void) return UnRegisterTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, SYS_WIN32); } + +DWORD register_iexplore(BOOL doregister) +{ + HRESULT hres = reg_install(doregister ? "RegisterIE" : "UnregisterIE", NULL); + return !SUCCEEDED(hres); +} diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c index adcaeeec24e..c8fa61d9231 100644 --- a/dlls/shdocvw/iexplore.c +++ b/dlls/shdocvw/iexplore.c @@ -192,7 +192,14 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow) MSG msg; HRESULT hres; - FIXME("%s %d\n", debugstr_a(szCommandLine), nShowWindow); + TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow); + + if(*szCommandLine == '-' || *szCommandLine == '/') { + if(!strcasecmp(szCommandLine+1, "regserver")) + return register_iexplore(TRUE); + if(!strcasecmp(szCommandLine+1, "unregserver")) + return register_iexplore(FALSE); + } CoInitialize(NULL); diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index db47b637fc8..0b048eb1a34 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -222,6 +222,7 @@ extern void unregister_iewindow_class(void); HRESULT register_class_object(BOOL); HRESULT get_typeinfo(ITypeInfo**); +DWORD register_iexplore(BOOL); /* memory allocation functions */ diff --git a/dlls/shdocvw/shdocvw.inf b/dlls/shdocvw/shdocvw.inf index 0cb649861ad..91de9ee14be 100644 --- a/dlls/shdocvw/shdocvw.inf +++ b/dlls/shdocvw/shdocvw.inf @@ -10,6 +10,14 @@ AddReg=Classes.Reg DelReg=Classes.Reg +[RegisterIE] +AddReg=IE.Reg + + +[UnregisterIE] +DelReg=IE.Reg + + [Classes.Reg] HKCR,"CLSID\%CLSID_InternetExplorer%",,,"Internet Explorer(Ver 1.0)" HKCR,"CLSID\%CLSID_InternetExplorer%\LocalServer32",,,"iexplore.exe" @@ -101,5 +109,9 @@ HKCR,"Shell.Explorer.1",,,"" HKCR,"Shell.Explorer.1\CLSID",,,"%CLSID_WebBrowser_V1%" +[IE.Reg] +HKLM,"Software\Microsoft\Internet Explorer","Version",,"6.0.2900.2180" + + [Strings] MODULE="shdocvw.dll" diff --git a/tools/wine.inf b/tools/wine.inf index e6f3dbdd1d1..fdb47b992be 100644 --- a/tools/wine.inf +++ b/tools/wine.inf @@ -2174,6 +2174,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,dxdiagn.dll,1 11,,hhctrl.ocx,1 11,,hlink.dll,1 +11,,iexplore.exe,1 11,,infosoft.dll,1 11,,inseng.dll,1 11,,itss.dll,1