Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/programs/iexplore/main.c
4389 views
1
/*
2
* Internet Explorer wrapper
3
*
4
* Copyright 2006 Mike McCormack
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19
*/
20
21
#include <windows.h>
22
#include <advpub.h>
23
#include <ole2.h>
24
#include <rpcproxy.h>
25
26
#include "wine/debug.h"
27
28
extern DWORD WINAPI IEWinMain(const WCHAR*, int);
29
30
static BOOL check_native_ie(void)
31
{
32
DWORD handle, size;
33
LPWSTR file_desc;
34
UINT bytes;
35
void* buf;
36
BOOL ret = TRUE;
37
LPWORD translation;
38
WCHAR file_desc_strW[48];
39
40
size = GetFileVersionInfoSizeW(L"browseui.dll", &handle);
41
if(!size)
42
return TRUE;
43
44
buf = HeapAlloc(GetProcessHeap(), 0, size);
45
GetFileVersionInfoW(L"browseui.dll", 0, size,buf);
46
if (VerQueryValueW(buf, L"\\VarFileInfo\\Translation", (void **)&translation, &bytes))
47
{
48
wsprintfW(file_desc_strW, L"\\StringFileInfo\\%04x%04x\\FileDescription", translation[0], translation[1]);
49
ret = !VerQueryValueW(buf, file_desc_strW, (void**)&file_desc, &bytes) || !wcsstr(file_desc, L"Wine");
50
}
51
52
HeapFree(GetProcessHeap(), 0, buf);
53
return ret;
54
}
55
56
static DWORD register_iexplore(BOOL doregister)
57
{
58
HRESULT hres;
59
60
if (check_native_ie()) {
61
WINE_MESSAGE("Native IE detected, not doing registration\n");
62
return 0;
63
}
64
65
hres = RegInstallA(NULL, doregister ? "RegisterIE" : "UnregisterIE", NULL);
66
return FAILED(hres);
67
}
68
69
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prev, WCHAR *cmdline, int show)
70
{
71
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
72
73
if(*cmdline == '-' || *cmdline == '/') {
74
if(!wcsicmp(cmdline+1, L"regserver"))
75
return register_iexplore(TRUE);
76
if(!wcsicmp(cmdline+1, L"unregserver"))
77
return register_iexplore(FALSE);
78
}
79
80
return IEWinMain(cmdline, show);
81
}
82
83