jscript: Support passing EXPRVAL_JSVAL through JS stack.
[wine/zf.git] / programs / iexplore / main.c
blobade9f8c5226963dff6f9c628d1d3a00c6ab7b58d
1 /*
2 * Internet Explorer wrapper
4 * Copyright 2006 Mike McCormack
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.
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.
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
21 #include <windows.h>
22 #include <advpub.h>
23 #include <ole2.h>
24 #include <rpcproxy.h>
26 #include "wine/debug.h"
28 extern DWORD WINAPI IEWinMain(const WCHAR*, int);
30 static BOOL check_native_ie(void)
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];
40 size = GetFileVersionInfoSizeW(L"browseui.dll", &handle);
41 if(!size)
42 return TRUE;
44 buf = HeapAlloc(GetProcessHeap(), 0, size);
45 GetFileVersionInfoW(L"browseui.dll", 0, size,buf);
46 if (VerQueryValueW(buf, L"\\VarFileInfo\\Translation", (void **)&translation, &bytes))
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");
52 HeapFree(GetProcessHeap(), 0, buf);
53 return ret;
56 static DWORD register_iexplore(BOOL doregister)
58 HRESULT hres;
60 if (check_native_ie()) {
61 WINE_MESSAGE("Native IE detected, not doing registration\n");
62 return 0;
65 hres = RegInstallA(NULL, doregister ? "RegisterIE" : "UnregisterIE", NULL);
66 return FAILED(hres);
69 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prev, WCHAR *cmdline, int show)
71 if(*cmdline == '-' || *cmdline == '/') {
72 if(!wcsicmp(cmdline+1, L"regserver"))
73 return register_iexplore(TRUE);
74 if(!wcsicmp(cmdline+1, L"unregserver"))
75 return register_iexplore(FALSE);
78 return IEWinMain(cmdline, show);