ReactOS
0.4.16-dev-87-g3dfbe52
main.c
Go to the documentation of this file.
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/unicode.h"
27
#include "
wine/debug.h
"
28
29
extern
DWORD
WINAPI
IEWinMain
(
const
WCHAR
*,
int
);
30
31
static
BOOL
check_native_ie
(
void
)
32
{
33
DWORD
handle
,
size
;
34
LPWSTR
file_desc;
35
UINT
bytes
;
36
void
*
buf
;
37
BOOL
ret
=
TRUE
;
38
LPWORD
translation;
39
40
static
const
WCHAR
browseui_dllW[] = {
'b'
,
'r'
,
'o'
,
'w'
,
's'
,
'e'
,
'u'
,
'i'
,
'.'
,
'd'
,
'l'
,
'l'
,0};
41
static
const
WCHAR
wineW
[] = {
'W'
,
'i'
,
'n'
,
'e'
,0};
42
static
const
WCHAR
translationW[] =
43
{
'\\'
,
'V'
,
'a'
,
'r'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
44
'\\'
,
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'l'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,0};
45
static
const
WCHAR
file_desc_fmtW[] =
46
{
'\\'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
47
'\\'
,
'%'
,
'0'
,
'4'
,
'x'
,
'%'
,
'0'
,
'4'
,
'x'
,
48
'\\'
,
'F'
,
'i'
,
'l'
,
'e'
,
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,0};
49
WCHAR
file_desc_strW[48];
50
51
size
=
GetFileVersionInfoSizeW
(browseui_dllW, &
handle
);
52
if
(!
size
)
53
return
TRUE
;
54
55
buf
=
HeapAlloc
(
GetProcessHeap
(), 0,
size
);
56
GetFileVersionInfoW
(browseui_dllW, 0,
size
,
buf
);
57
if
(
VerQueryValueW
(
buf
, translationW, (
void
**)&translation, &
bytes
))
58
{
59
wsprintfW
(file_desc_strW, file_desc_fmtW, translation[0], translation[1]);
60
ret
= !
VerQueryValueW
(
buf
, file_desc_strW, (
void
**)&file_desc, &
bytes
) || !
strstrW
(file_desc,
wineW
);
61
}
62
63
HeapFree
(
GetProcessHeap
(), 0,
buf
);
64
return
ret
;
65
}
66
67
static
DWORD
register_iexplore
(
BOOL
doregister)
68
{
69
HRESULT
hres
;
70
71
if
(
check_native_ie
()) {
72
WINE_MESSAGE
(
"Native IE detected, not doing registration\n"
);
73
return
0;
74
}
75
76
hres
=
RegInstallA
(
NULL
, doregister ?
"RegisterIE"
:
"UnregisterIE"
,
NULL
);
77
return
FAILED
(
hres
);
78
}
79
80
int
WINAPI
wWinMain
(
HINSTANCE
hInstance
,
HINSTANCE
prev,
WCHAR
*
cmdline
,
int
show)
81
{
82
static
const
WCHAR
regserverW[] = {
'r'
,
'e'
,
'g'
,
's'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,0};
83
static
const
WCHAR
unregserverW[] = {
'u'
,
'n'
,
'r'
,
'e'
,
'g'
,
's'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,0};
84
85
if
(*
cmdline
==
'-'
|| *
cmdline
==
'/'
) {
86
if
(!
strcmpiW
(
cmdline
+1, regserverW))
87
return
register_iexplore
(
TRUE
);
88
if
(!
strcmpiW
(
cmdline
+1, unregserverW))
89
return
register_iexplore
(
FALSE
);
90
}
91
92
return
IEWinMain
(
cmdline
, show);
93
}
bytes
static unsigned char bytes[4]
Definition:
adnsresfilter.c:74
advpub.h
wWinMain
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
Definition:
main.c:788
check_native_ie
static BOOL check_native_ie(void)
Definition:
main.c:31
IEWinMain
DWORD WINAPI IEWinMain(const WCHAR *, int)
Definition:
iexplore.c:1139
register_iexplore
static DWORD register_iexplore(BOOL doregister)
Definition:
main.c:67
hInstance
HINSTANCE hInstance
Definition:
charmap.c:19
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
RegInstallA
HRESULT WINAPI RegInstallA(HMODULE hm, LPCSTR pszSection, const STRTABLEA *pstTable)
Definition:
reg.c:148
GetProcessHeap
#define GetProcessHeap()
Definition:
compat.h:736
HeapAlloc
#define HeapAlloc
Definition:
compat.h:733
HeapFree
#define HeapFree(x, y, z)
Definition:
compat.h:735
GetFileVersionInfoW
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition:
version.c:845
VerQueryValueW
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition:
version.c:1049
GetFileVersionInfoSizeW
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition:
version.c:611
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
size
GLsizeiptr size
Definition:
glext.h:5919
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition:
glext.h:7751
HRESULT
Definition:
mshtmhst.idl:286
void
Definition:
nsiface.idl:2307
FAILED
#define FAILED(hr)
Definition:
intsafe.h:51
wineW
static WCHAR wineW[]
Definition:
localmon.c:128
hres
HRESULT hres
Definition:
protocol.c:465
UINT
unsigned int UINT
Definition:
ndis.h:50
ole2.h
strstrW
#define strstrW(d, s)
Definition:
unicode.h:38
strcmpiW
#define strcmpiW(s1, s2)
Definition:
unicode.h:45
rpcproxy.h
debug.h
WINE_MESSAGE
#define WINE_MESSAGE
Definition:
debug.h:382
cmdline
TCHAR * cmdline
Definition:
stretchblt.cpp:32
handle
Definition:
rpc_generic.c:61
LPWORD
uint16_t * LPWORD
Definition:
typedefs.h:56
ret
int ret
Definition:
wcstombs-tests.c:31
WINAPI
#define WINAPI
Definition:
msvc.h:6
wsprintfW
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
LPWSTR
WCHAR * LPWSTR
Definition:
xmlstorage.h:184
base
applications
iexplore
main.c
Generated on Wed Oct 2 2024 06:14:56 for ReactOS by
1.9.6