Bug 468002 Really make windbgdlg a Unicode application r=blassey sr=bsmedberg
--- 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, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
+ ok = RegQueryValueExW(hkeyCU, __wargv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
if (!ok && hkeyLM)
- ok = RegQueryValueExW(hkeyLM, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
+ ok = RegQueryValueExW(hkeyLM, __wargv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == 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);
}