Jacek Caban : ieframe: ieframe variant of IEWinMain is Unicode.

Alexandre Julliard julliard at winehq.org
Thu Oct 20 14:25:11 CDT 2011


Module: wine
Branch: master
Commit: 2c47b66b715e36dfc0ea4676b39fb803f3b15cd3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2c47b66b715e36dfc0ea4676b39fb803f3b15cd3

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct 20 16:46:59 2011 +0200

ieframe: ieframe variant of IEWinMain is Unicode.

---

 dlls/ieframe/iexplore.c       |   23 ++++++++++++-----------
 dlls/shdocvw/shdocvw_main.c   |   15 +++++++++++++--
 programs/iexplore/Makefile.in |    2 +-
 programs/iexplore/main.c      |   10 ++++++----
 4 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/dlls/ieframe/iexplore.c b/dlls/ieframe/iexplore.c
index d5fd56c..8dd6287 100644
--- a/dlls/ieframe/iexplore.c
+++ b/dlls/ieframe/iexplore.c
@@ -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);
         }
diff --git a/dlls/shdocvw/shdocvw_main.c b/dlls/shdocvw/shdocvw_main.c
index 88fe5ed..db9034c 100644
--- a/dlls/shdocvw/shdocvw_main.c
+++ b/dlls/shdocvw/shdocvw_main.c
@@ -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;
 }
 
 /*************************************************************************
diff --git a/programs/iexplore/Makefile.in b/programs/iexplore/Makefile.in
index 9bdd85d..aa5ccbe 100644
--- a/programs/iexplore/Makefile.in
+++ b/programs/iexplore/Makefile.in
@@ -1,6 +1,6 @@
 EXTRADEFS = -DWINE_NO_UNICODE_MACROS
 MODULE    = iexplore.exe
-APPMODE   = -mwindows
+APPMODE   = -mwindows -municode
 IMPORTS   = ieframe
 DELAYIMPORTS = advpack version
 
diff --git a/programs/iexplore/main.c b/programs/iexplore/main.c
index 6065ba9..23a738f 100644
--- a/programs/iexplore/main.c
+++ b/programs/iexplore/main.c
@@ -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);
     }
 




More information about the wine-cvs mailing list