iexplore: Added self-registration code.

This commit is contained in:
Jacek Caban 2007-11-02 19:51:53 +01:00 committed by Alexandre Julliard
parent 151f18e69c
commit e15b6096c6
6 changed files with 48 additions and 36 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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);

View File

@ -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 */

View File

@ -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"

View File

@ -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