Commit 3faa9387 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

iexplore: Moved iexplore registration extension to iexplore.exe.

parent 6c1e349b
......@@ -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);
......
......@@ -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
......@@ -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
......
......@@ -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}"
......@@ -28,3 +28,6 @@
/* @makedep: iexplore.ico */
1 ICON iexplore.ico
/* @makedep: iexplore.inf */
REGINST REGINST iexplore.inf
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment