Jacek Caban : iexplore: Moved iexplore registration extension to iexplore. exe.
Alexandre Julliard
julliard at winehq.org
Fri Jul 29 12:37:01 CDT 2011
Module: wine
Branch: master
Commit: 3faa938712cbce470701b49b935687cffeb058c7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3faa938712cbce470701b49b935687cffeb058c7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jul 29 12:14:19 2011 +0200
iexplore: Moved iexplore registration extension to iexplore.exe.
---
dlls/shdocvw/factory.c | 125 +-------------------
dlls/shdocvw/shdocvw.rc | 3 -
programs/iexplore/Makefile.in | 1 +
.../shdocvw.inf => programs/iexplore/iexplore.inf | 17 +--
programs/iexplore/iexplore.rc | 3 +
programs/iexplore/main.c | 56 +++++++++-
6 files changed, 70 insertions(+), 135 deletions(-)
diff --git a/dlls/shdocvw/factory.c b/dlls/shdocvw/factory.c
index 5c0f106..ce6ddb9 100644
--- a/dlls/shdocvw/factory.c
+++ b/dlls/shdocvw/factory.c
@@ -23,7 +23,6 @@
#include "shdocvw.h"
#include "winreg.h"
-#include "advpub.h"
#include "rpcproxy.h"
#include "isguids.h"
@@ -74,77 +73,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
}
-static HRESULT reg_install(LPCSTR section, STRTABLEA *strtable)
-{
- HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable);
- HMODULE hadvpack;
- HRESULT hres;
-
- static const WCHAR advpackW[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
-
- hadvpack = LoadLibraryW(advpackW);
- pRegInstall = (void *)GetProcAddress(hadvpack, "RegInstall");
-
- hres = pRegInstall(shdocvw_hinstance, section, strtable);
-
- FreeLibrary(hadvpack);
- return hres;
-}
-
-#define INF_SET_CLSID(clsid) \
- do \
- { \
- static CHAR name[] = "CLSID_" #clsid; \
- \
- pse[i].pszName = name; \
- clsids[i++] = &CLSID_ ## clsid; \
- } while (0)
-
-static HRESULT register_server(BOOL doregister)
-{
- STRTABLEA strtable;
- STRENTRYA pse[3];
- static CLSID const *clsids[3];
- unsigned int i = 0;
- HRESULT hres;
-
- INF_SET_CLSID(Internet);
- INF_SET_CLSID(InternetExplorer);
- INF_SET_CLSID(InternetShortcut);
-
- for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) {
- pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39);
- sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
- clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0],
- clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4],
- clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]);
- }
-
- strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
- strtable.pse = pse;
-
- hres = reg_install(doregister ? "RegisterDll" : "UnregisterDll", &strtable);
-
- for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
- HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
-
- return hres;
-}
-
-#undef INF_SET_CLSID
-
/***********************************************************************
* DllRegisterServer (shdocvw.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
- HRESULT hres;
-
- hres = __wine_register_resources( shdocvw_hinstance, NULL );
- if(FAILED(hres))
- return hres;
-
- return register_server(TRUE);
+ TRACE("\n");
+ return __wine_register_resources( shdocvw_hinstance, NULL );
}
/***********************************************************************
@@ -152,57 +87,12 @@ HRESULT WINAPI DllRegisterServer(void)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
- HRESULT hres;
-
- hres = register_server(FALSE);
- if(FAILED(hres))
- return hres;
-
+ TRACE("\n");
return __wine_unregister_resources( shdocvw_hinstance, NULL );
}
-static BOOL check_native_ie(void)
-{
- static const WCHAR cszPath[] = {'b','r','o','w','s','e','u','i','.','d','l','l',0};
- DWORD handle,size;
- BOOL ret = TRUE;
-
- size = GetFileVersionInfoSizeW(cszPath,&handle);
- if (size)
- {
- LPVOID buf;
- LPWSTR lpFileDescription;
- UINT dwBytes;
- static const WCHAR cszFD[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\','0','4','0','9','0','4','e','4','\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0};
- static const WCHAR cszWine[] = {'W','i','n','e',0};
-
- buf = HeapAlloc(GetProcessHeap(),0,size);
- GetFileVersionInfoW(cszPath,0,size,buf);
-
- if (VerQueryValueW(buf, cszFD, (LPVOID*)&lpFileDescription, &dwBytes) &&
- strstrW(lpFileDescription,cszWine))
- ret = FALSE;
-
- HeapFree(GetProcessHeap(), 0, buf);
- }
-
- return ret;
-}
-
-static DWORD register_iexplore(BOOL doregister)
-{
- HRESULT hres;
- if (check_native_ie())
- {
- TRACE("Native IE detected, not doing registration\n");
- return S_OK;
- }
- hres = reg_install(doregister ? "RegisterIE" : "UnregisterIE", NULL);
- return FAILED(hres);
-}
-
/******************************************************************
- * IEWinMain (SHDOCVW.101)
+ * IEWinMain (SHDOCVW.101)
*
* Only returns on error.
*/
@@ -212,13 +102,6 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int 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);
- }
-
pIEWinMain = (void*)GetProcAddress(get_ieframe_instance(), MAKEINTRESOURCEA(101));
if(!pIEWinMain)
ExitProcess(1);
diff --git a/dlls/shdocvw/shdocvw.rc b/dlls/shdocvw/shdocvw.rc
index bd47bbd..555eabd 100644
--- a/dlls/shdocvw/shdocvw.rc
+++ b/dlls/shdocvw/shdocvw.rc
@@ -33,8 +33,5 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: shdocvw_v1.tlb */
1 TYPELIB shdocvw_v1.tlb
-/* @makedep: shdocvw.inf */
-REGINST REGINST shdocvw.inf
-
/* @makedep: shdocvw.rgs */
2 WINE_REGISTRY shdocvw.rgs
diff --git a/programs/iexplore/Makefile.in b/programs/iexplore/Makefile.in
index 547f8f0..6762af6 100644
--- a/programs/iexplore/Makefile.in
+++ b/programs/iexplore/Makefile.in
@@ -2,6 +2,7 @@ EXTRADEFS = -DWINE_NO_UNICODE_MACROS
MODULE = iexplore.exe
APPMODE = -mwindows
IMPORTS = shdocvw user32 gdi32
+DELAYIMPORTS = advpack version
C_SRCS = \
main.c
diff --git a/dlls/shdocvw/shdocvw.inf b/programs/iexplore/iexplore.inf
similarity index 88%
rename from dlls/shdocvw/shdocvw.inf
rename to programs/iexplore/iexplore.inf
index 2cf9d6e..a45df9f 100644
--- a/dlls/shdocvw/shdocvw.inf
+++ b/programs/iexplore/iexplore.inf
@@ -2,20 +2,12 @@
Signature="$CHICAGO$"
-[RegisterDll]
-AddReg=Classes.Reg
-
-
-[UnregisterDll]
-DelReg=Classes.Reg
-
-
[RegisterIE]
-AddReg=IE.Reg, Settings.Reg
+AddReg=Classes.Reg, IE.Reg, Settings.Reg
[UnregisterIE]
-DelReg=IE.Reg, Settings.Reg
+DelReg=Classes.Reg, IE.Reg, Settings.Reg
[Classes.Reg]
@@ -44,3 +36,8 @@ HKLM,"Software\Microsoft\Windows\CurrentVersion\App Paths\iexplore.exe","Path",,
HKLM,"Software\Microsoft\Internet Explorer","Build",,"86001"
HKLM,"Software\Microsoft\Internet Explorer","Version",,"8.0.6001.18702"
HKLM,"Software\Microsoft\Internet Explorer","W2kVersion",,"8.0.6001.18702"
+
+
+[Strings]
+CLSID_InternetExplorer="{0002df01-0000-0000-c000-000000000046}"
+CLSID_Internet="{871c5380-42a0-1069-a2ea-08002b30309d}"
diff --git a/programs/iexplore/iexplore.rc b/programs/iexplore/iexplore.rc
index 64a976c..cd75781 100644
--- a/programs/iexplore/iexplore.rc
+++ b/programs/iexplore/iexplore.rc
@@ -28,3 +28,6 @@
/* @makedep: iexplore.ico */
1 ICON iexplore.ico
+
+/* @makedep: iexplore.inf */
+REGINST REGINST iexplore.inf
diff --git a/programs/iexplore/main.c b/programs/iexplore/main.c
index 0ecf0d9..6065ba9 100644
--- a/programs/iexplore/main.c
+++ b/programs/iexplore/main.c
@@ -19,10 +19,64 @@
*/
#include <windows.h>
+#include <advpub.h>
+#include <rpcproxy.h>
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
extern DWORD WINAPI IEWinMain(LPSTR, int);
-int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
+static BOOL check_native_ie(void)
+{
+ DWORD handle, size;
+ LPWSTR file_desc;
+ UINT bytes;
+ void* buf;
+ BOOL ret;
+
+ static const WCHAR browseui_dllW[] = {'b','r','o','w','s','e','u','i','.','d','l','l',0};
+ static const WCHAR wineW[] = {'W','i','n','e',0};
+ static const WCHAR file_desc_strW[] =
+ {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o',
+ '\\','0','4','0','9','0','4','e','4',
+ '\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0};
+
+ size = GetFileVersionInfoSizeW(browseui_dllW, &handle);
+ if(!size)
+ return TRUE;
+
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ GetFileVersionInfoW(browseui_dllW, 0, size,buf);
+
+ ret = !VerQueryValueW(buf, file_desc_strW, (void**)&file_desc, &bytes) || !strstrW(file_desc, wineW);
+
+ HeapFree(GetProcessHeap(), 0, buf);
+ return ret;
+}
+
+static DWORD register_iexplore(BOOL doregister)
+{
+ HRESULT hres;
+
+ if (check_native_ie()) {
+ WINE_MESSAGE("Native IE detected, not doing registration\n");
+ return 0;
+ }
+
+ hres = RegInstallA(NULL, doregister ? "RegisterIE" : "UnregisterIE", NULL);
+ return FAILED(hres);
+}
+
+int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
{
+
+ if(*cmdline == '-' || *cmdline == '/') {
+ if(!strcasecmp(cmdline+1, "regserver"))
+ return register_iexplore(TRUE);
+ if(!strcasecmp(cmdline+1, "unregserver"))
+ return register_iexplore(FALSE);
+ }
+
return IEWinMain(cmdline, show);
}
More information about the wine-cvs
mailing list