ReactOS 0.4.15-dev-7958-gcd0bb1a
main.c File Reference
#include <windows.h>
#include <advpub.h>
#include <ole2.h>
#include <rpcproxy.h>
#include "wine/unicode.h"
#include "wine/debug.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

DWORD WINAPI IEWinMain (const WCHAR *, int)
 
static BOOL check_native_ie (void)
 
static DWORD register_iexplore (BOOL doregister)
 
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE prev, WCHAR *cmdline, int show)
 

Function Documentation

◆ check_native_ie()

static BOOL check_native_ie ( void  )
static

Definition at line 31 of file main.c.

32{
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
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
64 return ret;
65}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static WCHAR wineW[]
Definition: localmon.c:128
unsigned int UINT
Definition: ndis.h:50
#define strstrW(d, s)
Definition: unicode.h:32
uint16_t * LPWORD
Definition: typedefs.h:56
int ret
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by register_iexplore().

◆ IEWinMain()

DWORD WINAPI IEWinMain ( const WCHAR cmdline,
int  nShowWindow 
)

Definition at line 1139 of file iexplore.c.

1140{
1141 MSG msg;
1142 HRESULT hres;
1143 BOOL embedding = FALSE, nohome = FALSE, manager = FALSE;
1144 DWORD reg_cookie;
1145
1146 static const WCHAR embeddingW[] = {'-','e','m','b','e','d','d','i','n','g',0};
1147 static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0};
1148 static const WCHAR startmanagerW[] = {'-','s','t','a','r','t','m','a','n','a','g','e','r',0};
1149
1150 TRACE("%s %d\n", debugstr_w(cmdline), nShowWindow);
1151
1153
1154 init_dde();
1155
1156 while (*cmdline)
1157 {
1158 int length = 0;
1159
1160 while (*cmdline == ' ' || *cmdline == '\t') cmdline++;
1161 if (!*cmdline) break;
1162
1163 while (cmdline[length] && cmdline[length] != ' ' && cmdline[length] != '\t') length++;
1164
1165 if (!_wcsnicmp(cmdline, embeddingW, length))
1166 embedding = TRUE;
1167 else if (!_wcsnicmp(cmdline, nohomeW, length))
1168 nohome = TRUE;
1169 else if (!_wcsnicmp(cmdline, startmanagerW, length))
1170 manager = TRUE;
1171 else
1172 break;
1173
1174 cmdline += length;
1175 }
1176
1177 if (manager)
1178 hres = CoRegisterClassObject(&CLSID_InternetExplorerManager,
1179 (IUnknown*)&InternetExplorerManagerFactory, CLSCTX_SERVER,
1180 REGCLS_SINGLEUSE, &reg_cookie);
1181 else
1182 hres = CoRegisterClassObject(&CLSID_InternetExplorer,
1183 (IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER,
1184 REGCLS_MULTIPLEUSE, &reg_cookie);
1185
1186 if (FAILED(hres))
1187 {
1188 ERR("failed to register CLSID_InternetExplorer%s: %08x\n", manager ? "Manager" : "", hres);
1190 ExitProcess(1);
1191 }
1192
1193 if (!embedding)
1194 {
1195 if(!create_ie_window(nohome, cmdline))
1196 {
1198 ExitProcess(1);
1199 }
1200 }
1201
1202 /* run the message loop for this thread */
1203 while (GetMessageW(&msg, 0, 0, 0))
1204 {
1207 }
1208
1209 CoRevokeClassObject(reg_cookie);
1210 release_dde();
1211
1213
1214 ExitProcess(0);
1215 return 0;
1216}
#define msg(x)
Definition: auth_time.c:54
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1086
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
IClassFactory InternetExplorerFactory
Definition: ieframe_main.c:241
IClassFactory InternetExplorerManagerFactory
Definition: ieframe_main.c:251
static void init_dde(void)
Definition: iexplore.c:1098
static void release_dde(void)
Definition: iexplore.c:1123
static BOOL create_ie_window(BOOL nohome, const WCHAR *cmdline)
Definition: iexplore.c:952
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:393
@ REGCLS_SINGLEUSE
Definition: objbase.h:392
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)

Referenced by wWinMain().

◆ register_iexplore()

static DWORD register_iexplore ( BOOL  doregister)
static

Definition at line 67 of file main.c.

68{
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}
static BOOL check_native_ie(void)
Definition: main.c:31
HRESULT WINAPI RegInstallA(HMODULE hm, LPCSTR pszSection, const STRTABLEA *pstTable)
Definition: reg.c:148
#define WINE_MESSAGE
Definition: debug.h:382

Referenced by wWinMain().

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  prev,
WCHAR cmdline,
int  show 
)

Definition at line 80 of file main.c.

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))
90 }
91
92 return IEWinMain(cmdline, show);
93}
DWORD WINAPI IEWinMain(const WCHAR *, int)
Definition: iexplore.c:1139
static DWORD register_iexplore(BOOL doregister)
Definition: main.c:67
#define strcmpiW(s1, s2)
Definition: unicode.h:39