ReactOS 0.4.17-dev-1218-gfae4549
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:967
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1171
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:738
return ret
Definition: mutex.c:147
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
unsigned int UINT
Definition: sysinfo.c:13
static WCHAR wineW[]
Definition: localmon.c:128
short WCHAR
Definition: pedump.c:58
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
uint16_t * LPWSTR
Definition: typedefs.h:56
uint16_t * LPWORD
Definition: typedefs.h:56
#define strstrW(d, s)
Definition: unicode.h:32

Referenced by register_iexplore().

◆ IEWinMain()

DWORD WINAPI IEWinMain ( const WCHAR *  cmdline,
int  nShowWindow 
)

Definition at line 1145 of file iexplore.c.

1146{
1147 BOOL embedding = FALSE, nohome = FALSE, manager = FALSE, activated = FALSE;
1148 MSG msg;
1149 HRESULT hres;
1151 DWORD reg_cookie, ret = 1;
1152 ULONG_PTR context_cookie;
1153 ACTCTXW actctx;
1154
1155 static const WCHAR embeddingW[] = {'-','e','m','b','e','d','d','i','n','g',0};
1156 static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0};
1157 static const WCHAR startmanagerW[] = {'-','s','t','a','r','t','m','a','n','a','g','e','r',0};
1158
1159 TRACE("%s %d\n", debugstr_w(cmdline), nShowWindow);
1160
1162
1163 memset(&actctx, 0, sizeof(actctx));
1164 actctx.cbSize = sizeof(actctx);
1165 actctx.hModule = ieframe_instance;
1166 actctx.lpResourceName = MAKEINTRESOURCEW(123);
1167 actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
1170 activated = ActivateActCtx(context, &context_cookie);
1171
1172 init_dde();
1173
1174 while (*cmdline)
1175 {
1176 int length = 0;
1177
1178 while (*cmdline == ' ' || *cmdline == '\t') cmdline++;
1179 if (!*cmdline) break;
1180
1181 while (cmdline[length] && cmdline[length] != ' ' && cmdline[length] != '\t') length++;
1182
1183 if (!wcsnicmp(cmdline, embeddingW, length))
1184 embedding = TRUE;
1185 else if (!wcsnicmp(cmdline, nohomeW, length))
1186 nohome = TRUE;
1187 else if (!wcsnicmp(cmdline, startmanagerW, length))
1188 manager = TRUE;
1189 else
1190 break;
1191
1192 cmdline += length;
1193 }
1194
1195 if (manager)
1196 hres = CoRegisterClassObject(&CLSID_InternetExplorerManager,
1197 (IUnknown*)&InternetExplorerManagerFactory, CLSCTX_SERVER,
1198 REGCLS_SINGLEUSE, &reg_cookie);
1199 else
1200 hres = CoRegisterClassObject(&CLSID_InternetExplorer,
1201 (IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER,
1202 REGCLS_MULTIPLEUSE, &reg_cookie);
1203
1204 if (FAILED(hres))
1205 {
1206 ERR("failed to register CLSID_InternetExplorer%s: %08lx\n", manager ? "Manager" : "", hres);
1207 goto done;
1208 }
1209
1210 if (!embedding)
1211 {
1212 if(!create_ie_window(nohome, cmdline))
1213 goto done;
1214 }
1215
1216 /* run the message loop for this thread */
1217 while (GetMessageW(&msg, 0, 0, 0))
1218 {
1221 }
1222
1223 CoRevokeClassObject(reg_cookie);
1224 release_dde();
1225
1226 ret = 0;
1227done:
1229 if (activated)
1230 DeactivateActCtx(0, context_cookie);
1233}
#define msg(x)
Definition: auth_time.c:54
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD cookie)
Definition: combase.c:3107
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, IUnknown *object, DWORD clscontext, DWORD flags, DWORD *cookie)
Definition: combase.c:2970
#define wcsnicmp
Definition: compat.h:14
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1382
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
IClassFactory InternetExplorerFactory
Definition: ieframe_main.c:262
IClassFactory InternetExplorerManagerFactory
Definition: ieframe_main.c:272
HINSTANCE ieframe_instance
Definition: ieframe_main.c:32
static void init_dde(void)
Definition: iexplore.c:1104
static void release_dde(void)
Definition: iexplore.c:1129
static BOOL create_ie_window(BOOL nohome, const WCHAR *cmdline)
Definition: iexplore.c:956
#define FAILED(hr)
Definition: intsafe.h:51
#define actctx
Definition: kernel32.h:8
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:432
static UINT activated
Definition: msctf.cpp:42
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:398
@ REGCLS_SINGLEUSE
Definition: objbase.h:397
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: http.c:7783
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t ULONG_PTR
Definition: typedefs.h:65

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:139
#define WINE_MESSAGE
Definition: debug.h:385

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:1145
static DWORD register_iexplore(BOOL doregister)
Definition: main.c:67
#define strcmpiW(s1, s2)
Definition: unicode.h:39