iexplore: Added self-registration code.
diff --git a/dlls/mshtml/install.c b/dlls/mshtml/install.c
index c4404a7..4acef19 100644
--- a/dlls/mshtml/install.c
+++ b/dlls/mshtml/install.c
@@ -54,14 +54,6 @@
      '\\','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 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 @@
                        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 ad4330a..2ed62e6 100644
--- a/dlls/shdocvw/factory.c
+++ b/dlls/shdocvw/factory.c
@@ -172,6 +172,23 @@
     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 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 @@
     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 @@
 
     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 adcaeee..c8fa61d 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -192,7 +192,14 @@
     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 db47b63..0b048eb 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -222,6 +222,7 @@
 
 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 0cb6498..91de9ee 100644
--- a/dlls/shdocvw/shdocvw.inf
+++ b/dlls/shdocvw/shdocvw.inf
@@ -10,6 +10,14 @@
 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\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 e6f3dbd..fdb47b9 100644
--- a/tools/wine.inf
+++ b/tools/wine.inf
@@ -2174,6 +2174,7 @@
 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