ieframe: ieframe variant of IEWinMain is Unicode.

This commit is contained in:
Jacek Caban 2011-10-20 16:46:59 +02:00 committed by Alexandre Julliard
parent 26f3c14d6b
commit 2c47b66b71
4 changed files with 32 additions and 18 deletions

View File

@ -826,7 +826,7 @@ void released_obj(void)
PostQuitMessage(0);
}
static BOOL create_ie_window(LPCSTR cmdline)
static BOOL create_ie_window(const WCHAR *cmdline)
{
InternetExplorer *ie;
HRESULT hres;
@ -842,25 +842,24 @@ static BOOL create_ie_window(LPCSTR cmdline)
IWebBrowser2_GoHome(&ie->IWebBrowser2_iface);
}else {
VARIANT var_url;
DWORD len;
int cmdlen;
static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e'};
while(*cmdline == ' ' || *cmdline == '\t')
cmdline++;
cmdlen = lstrlenA(cmdline);
cmdlen = strlenW(cmdline);
if(cmdlen > 2 && cmdline[0] == '"' && cmdline[cmdlen-1] == '"') {
cmdline++;
cmdlen -= 2;
}
if(cmdlen == 7 && !memcmp(cmdline, "-nohome", 7)) {
if(cmdlen == sizeof(nohomeW)/sizeof(*nohomeW) && !memcmp(cmdline, nohomeW, sizeof(nohomeW))) {
ie->nohome = TRUE;
}else {
V_VT(&var_url) = VT_BSTR;
len = MultiByteToWideChar(CP_ACP, 0, cmdline, cmdlen, NULL, 0);
V_BSTR(&var_url) = SysAllocStringLen(NULL, len);
MultiByteToWideChar(CP_ACP, 0, cmdline, cmdlen, V_BSTR(&var_url), len);
V_BSTR(&var_url) = SysAllocStringLen(cmdline, cmdlen);
/* navigate to the first page */
IWebBrowser2_Navigate2(&ie->IWebBrowser2_iface, &var_url, NULL, NULL, NULL, NULL);
@ -1020,12 +1019,14 @@ static void release_dde(void)
*
* Only returns on error.
*/
DWORD WINAPI IEWinMain(const char *szCommandLine, int nShowWindow)
DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
{
MSG msg;
HRESULT hres;
TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow);
static const WCHAR embeddingW[] = {'-','e','m','b','e','d','d','i','n','g',0};
TRACE("%s %d\n", debugstr_w(cmdline), nShowWindow);
CoInitialize(NULL);
@ -1037,8 +1038,8 @@ DWORD WINAPI IEWinMain(const char *szCommandLine, int nShowWindow)
init_dde();
if(strcasecmp(szCommandLine, "-embedding")) {
if(!create_ie_window(szCommandLine)) {
if(strcmpiW(cmdline, embeddingW)) {
if(!create_ie_window(cmdline)) {
CoUninitialize();
ExitProcess(1);
}

View File

@ -117,7 +117,9 @@ HRESULT WINAPI DllUnregisterServer(void)
*/
DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
{
DWORD (WINAPI *pIEWinMain)(LPSTR,int);
DWORD (WINAPI *pIEWinMain)(const WCHAR*,int);
WCHAR *cmdline;
DWORD ret, len;
TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow);
@ -125,7 +127,16 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
if(!pIEWinMain)
ExitProcess(1);
return pIEWinMain(szCommandLine, nShowWindow);
len = MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, NULL, 0);
cmdline = heap_alloc(len*sizeof(WCHAR));
if(!cmdline)
ExitProcess(1);
MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, cmdline, len);
ret = pIEWinMain(cmdline, nShowWindow);
heap_free(cmdline);
return ret;
}
/*************************************************************************

View File

@ -1,6 +1,6 @@
EXTRADEFS = -DWINE_NO_UNICODE_MACROS
MODULE = iexplore.exe
APPMODE = -mwindows
APPMODE = -mwindows -municode
IMPORTS = ieframe
DELAYIMPORTS = advpack version

View File

@ -25,7 +25,7 @@
#include "wine/unicode.h"
#include "wine/debug.h"
extern DWORD WINAPI IEWinMain(LPSTR, int);
extern DWORD WINAPI IEWinMain(const WCHAR*, int);
static BOOL check_native_ie(void)
{
@ -68,13 +68,15 @@ static DWORD register_iexplore(BOOL doregister)
return FAILED(hres);
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prev, WCHAR *cmdline, int show)
{
static const WCHAR regserverW[] = {'r','e','g','s','e','r','v','e','r',0};
static const WCHAR unregserverW[] = {'u','n','r','e','g','s','e','r','v','e','r',0};
if(*cmdline == '-' || *cmdline == '/') {
if(!strcasecmp(cmdline+1, "regserver"))
if(!strcmpiW(cmdline+1, regserverW))
return register_iexplore(TRUE);
if(!strcasecmp(cmdline+1, "unregserver"))
if(!strcmpiW(cmdline+1, unregserverW))
return register_iexplore(FALSE);
}