Bug 420928, 457331. Fixes main entry point on windows ce. minor windows mobile fixes in XR. r=bsmedberg
authorDoug Turner <dougt@meer.net>
Tue, 30 Sep 2008 14:34:55 -0700
changeset 19937 a6b61745090e6799d77194d555093a03ac63c06d
parent 19930 dc707697d319f09a1384ba11907219c928d84489
child 19938 649a5c8ecc6fedda065d1613d9fb87fcb8891fc3
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs420928, 457331
milestone1.9.1b1pre
Bug 420928, 457331. Fixes main entry point on windows ce. minor windows mobile fixes in XR. r=bsmedberg
toolkit/mozapps/update/src/updater/Makefile.in
xulrunner/app/Makefile.in
xulrunner/app/nsXULRunnerApp.cpp
xulrunner/stub/Makefile.in
xulrunner/stub/nsXULStub.cpp
--- a/toolkit/mozapps/update/src/updater/Makefile.in
+++ b/toolkit/mozapps/update/src/updater/Makefile.in
@@ -105,18 +105,22 @@ MOZ_WINCONSOLE = 0
 endif
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DNS_NO_XPCOM
 
 ifdef _MSC_VER
+ifdef WINCE
+WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
+else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
+endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 libs::
 	$(NSINSTALL) -D $(DIST)/bin/updater.app
 	rsync -a -C --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/bin/updater.app 
 	sed -e "s/%APP_NAME%/$(MOZ_APP_DISPLAYNAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
 	  iconv -f UTF-8 -t UTF-16 > $(DIST)/bin/updater.app/Contents/Resources/English.lproj/InfoPlist.strings
 	$(NSINSTALL) -D $(DIST)/bin/updater.app/Contents/MacOS
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -79,17 +79,17 @@ REQUIRES = \
         string \
         appshell \
         xulapp \
         xulrunner \
 	$(NULL)
 
 CPPSRCS = nsXULRunnerApp.cpp
 
-ifeq ($(OS_ARCH),WINNT)
+ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
 CPPSRCS += nsRegisterGREWin.cpp
 else
 ifneq (,$(filter OS2 Darwin,$(OS_ARCH)))
 CPPSRCS += nsRegisterGREVoid.cpp
 else
 CPPSRCS += nsRegisterGREUnix.cpp
 endif
 endif
@@ -140,18 +140,22 @@ DEFINES += -DMOZ_WINCONSOLE=$(MOZ_WINCON
 
 NSDISTMODE = copy
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
+ifdef WINCE
+WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
+else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
+endif
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
 RCINCLUDE = splash.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
@@ -195,17 +199,17 @@ ifeq ($(OS_ARCH),WINNT)
 #
 # Set it to 256k.  See bug 127069.
 #
 ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 endif
 endif
 
-ifneq (,$(filter-out OS2 WINNT Darwin BeOS,$(OS_ARCH)))
+ifneq (,$(filter-out OS2 WINCE WINNT Darwin BeOS,$(OS_ARCH)))
 
 xulrunner:: mozilla.in Makefile.in Makefile $(DEPTH)/config/autoconf.mk
 	cat $< | sed -e "s|%MOZAPPDIR%|$(mozappdir)|" \
                 -e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
 		-e "s|%MREDIR%|$(mredir)|" > $@
 	chmod +x $@
 
 libs:: xulrunner
--- a/xulrunner/app/nsXULRunnerApp.cpp
+++ b/xulrunner/app/nsXULRunnerApp.cpp
@@ -70,26 +70,36 @@
  * @param fmt
  *        printf-style format string followed by arguments.
  */
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if defined(XP_WIN) && !MOZ_WINCONSOLE
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
   char *msg = PR_vsmprintf(fmt, ap);
   if (msg)
   {
     UINT flags = MB_OK;
     if (isError)
       flags |= MB_ICONERROR;
     else
       flags |= MB_ICONINFORMATION;
-    MessageBox(NULL, msg, "XULRunner", flags);
+    
+    wchar_t wide_msg[1024];
+    MultiByteToWideChar(CP_ACP,
+			0,
+			msg,
+			-1,
+			wide_msg,
+			sizeof(wide_msg) / sizeof(wchar_t));
+    
+    MessageBoxW(NULL, wide_msg, L"XULRunner", flags);
+
     PR_smprintf_free(msg);
   }
 #else
   vfprintf(stderr, fmt, ap);
 #endif
 
   va_end(ap);
 }
--- a/xulrunner/stub/Makefile.in
+++ b/xulrunner/stub/Makefile.in
@@ -68,17 +68,17 @@ LIBS = \
 
 # Need to link with CoreFoundation on Mac
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 LIBS            += \
 		$(TK_LIBS) \
 		$(NULL)
 endif
 
-ifeq (WINNT,$(OS_ARCH))
+ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
 RCINCLUDE = xulrunner-stub.rc
 ifndef GNU_CC
 RCFLAGS += -DMOZ_XULRUNNER -I$(srcdir)
 else
 RCFLAGS += -DMOZ_XULRUNNER --include-dir $(srcdir)
 endif
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 endif
@@ -89,18 +89,22 @@ MOZ_WINCONSOLE = 1
 else
 MOZ_WINCONSOLE = 0
 endif
 endif
 
 include $(topsrcdir)/config/config.mk
 
 ifdef _MSC_VER
+ifdef WINCE
+WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
+else
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
+endif
 
 LIBS += $(JEMALLOC_LIBS)
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,shell32)
 endif
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -82,27 +82,36 @@
 
 #define VERSION_MAXLEN 128
 
 static void Output(PRBool isError, const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
-#if defined(XP_WIN) && !MOZ_WINCONSOLE
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE) || defined(WINCE)
   char msg[2048];
 
   vsnprintf(msg, sizeof(msg), fmt, ap);
 
   UINT flags = MB_OK;
   if (isError)
     flags |= MB_ICONERROR;
   else
     flags |= MB_ICONINFORMATION;
-  MessageBox(NULL, msg, "XULRunner", flags);
+
+  wchar_t wide_msg[1024];
+  MultiByteToWideChar(CP_ACP,
+		      0,
+		      msg,
+		      -1,
+		      wide_msg,
+		      sizeof(wide_msg) / sizeof(wchar_t));
+  
+  MessageBoxW(NULL, wide_msg, L"XULRunner", flags);
 #else
   vfprintf(stderr, fmt, ap);
 #endif
 
   va_end(ap);
 }
 
 class AutoAppData
@@ -171,17 +180,25 @@ main(int argc, char **argv)
 
   CFStringGetCString(iniPathStr, iniPath, sizeof(iniPath),
                      kCFStringEncodingUTF8);
   CFRelease(iniPathStr);
 
 #else
 
 #ifdef XP_WIN
-  if (!::GetModuleFileName(NULL, iniPath, sizeof(iniPath)))
+  wchar_t wide_path[MAX_PATH];
+  MultiByteToWideChar(CP_ACP,
+		      0,
+		      iniPath,
+		      -1,
+		      wide_path,
+		      MAX_PATH);
+  
+  if (!::GetModuleFileNameW(NULL, wide_path, MAX_PATH))
     return 1;
 
 #elif defined(XP_OS2)
    PPIB ppib;
    PTIB ptib;
 
    DosGetInfoBlocks(&ptib, &ppib);
    DosQueryModuleName(ppib->pib_hmte, sizeof(iniPath), iniPath);