Bug 468002 Really make windbgdlg a Unicode application r=blassey sr=bsmedberg
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Fri, 05 Dec 2008 21:30:17 +0000
changeset 22393 79c0238573553a6b02743f564a776e61a5765c0c
parent 22392 4f38214f17c016f99fd9a2bab6e37d78240bc7c9
child 22394 43ed1b0f68eb7440ebad19c83b539acb90f85089
push id3959
push userneil@parkwaycc.co.uk
push dateFri, 05 Dec 2008 21:30:47 +0000
treeherdermozilla-central@79c023857355 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, bsmedberg
bugs468002
milestone1.9.2a1pre
Bug 468002 Really make windbgdlg a Unicode application r=blassey sr=bsmedberg
xpcom/windbgdlg/Makefile.in
xpcom/windbgdlg/windbgdlg.cpp
--- a/xpcom/windbgdlg/Makefile.in
+++ b/xpcom/windbgdlg/Makefile.in
@@ -41,12 +41,10 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 SIMPLE_PROGRAMS	= windbgdlg$(BIN_SUFFIX)
 
 CPPSRCS		= windbgdlg.cpp
 
-OS_LIBS += $(call EXPAND_LIBNAME, shell32)
-
 include $(topsrcdir)/config/rules.mk
 
--- a/xpcom/windbgdlg/windbgdlg.cpp
+++ b/xpcom/windbgdlg/windbgdlg.cpp
@@ -37,57 +37,55 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* Windows only app to show a modal debug dialog - launched by nsDebug.cpp */
 
 #include <windows.h>
 #include <stdlib.h>
-#include <shellapi.h>
 
-int WINAPI 
-WinMain(HINSTANCE  hInstance, HINSTANCE  hPrevInstance, 
-        LPSTR  lpszCmdLine, int  nCmdShow)
+int WINAPI
+wWinMain(HINSTANCE  hInstance, HINSTANCE  hPrevInstance,
+         LPWSTR  lpszCmdLine, int  nCmdShow)
 {
     /* support for auto answering based on words in the assertion.
      * the assertion message is sent as a series of arguements (words) to the commandline.
      * set a "word" to 0xffffffff to let the word not affect this code.
      * set a "word" to 0xfffffffe to show the dialog.
      * set a "word" to 0x5 to ignore (program should continue).
      * set a "word" to 0x4 to retry (should fall into debugger).
      * set a "word" to 0x3 to abort (die).
      */
     DWORD regType;
     DWORD regValue = -1;
     DWORD regLength = sizeof regValue;
     HKEY hkeyCU, hkeyLM;
     RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
     RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
     int argc =0;
-    LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
-    for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) {
+    for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
         bool ok = false;
         if (hkeyCU)
-            ok = RegQueryValueExW(hkeyCU, argv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
+            ok = RegQueryValueExW(hkeyCU, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
         if (!ok && hkeyLM)
-            ok = RegQueryValueExW(hkeyLM, argv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
+            ok = RegQueryValueExW(hkeyLM, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
         if (!ok)
             regValue = -1;
     }
     if (hkeyCU)
         RegCloseKey(hkeyCU);
     if (hkeyLM)
         RegCloseKey(hkeyLM);
     if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
         return regValue;
     static WCHAR msg[4048];
 
     wsprintfW(msg,
-             L"%s\n\nClick Abort to exit the Application.\n"
-             L"Click Retry to Debug the Application..\n"
-             L"Click Ignore to continue running the Application.", 
-             lpszCmdLine);
-             
+              L"%s\n\nClick Abort to exit the Application.\n"
+              L"Click Retry to Debug the Application.\n"
+              L"Click Ignore to continue running the Application.",
+              lpszCmdLine);
+
     return MessageBoxW(NULL, msg, L"NSGlue_Assertion",
-                      MB_ICONSTOP | MB_SYSTEMMODAL| 
-                      MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
+                       MB_ICONSTOP | MB_SYSTEMMODAL |
+                       MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
 }