Bug 470165 - Cleanup the GTK nsFilePicker code; r+sr=roc
[wine-gecko.git] / xpcom / windbgdlg / windbgdlg.cpp
blob6fdec56ce00861862f8d799080dc24663f80d286
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is Mozilla Communicator client code, released
17 * March 31, 1998.
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1999
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
25 * John Bandhauer <jband@netscape.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 /* Windows only app to show a modal debug dialog - launched by nsDebug.cpp */
43 #include <windows.h>
44 #include <stdlib.h>
46 int WINAPI
47 wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
48 LPWSTR lpszCmdLine, int nCmdShow)
50 /* support for auto answering based on words in the assertion.
51 * the assertion message is sent as a series of arguements (words) to the commandline.
52 * set a "word" to 0xffffffff to let the word not affect this code.
53 * set a "word" to 0xfffffffe to show the dialog.
54 * set a "word" to 0x5 to ignore (program should continue).
55 * set a "word" to 0x4 to retry (should fall into debugger).
56 * set a "word" to 0x3 to abort (die).
58 DWORD regType;
59 DWORD regValue = -1;
60 DWORD regLength = sizeof regValue;
61 HKEY hkeyCU, hkeyLM;
62 RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
63 RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
64 int argc =0;
65 for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
66 bool ok = false;
67 if (hkeyCU)
68 ok = RegQueryValueExW(hkeyCU, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
69 if (!ok && hkeyLM)
70 ok = RegQueryValueExW(hkeyLM, __wargv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
71 if (!ok)
72 regValue = -1;
74 if (hkeyCU)
75 RegCloseKey(hkeyCU);
76 if (hkeyLM)
77 RegCloseKey(hkeyLM);
78 if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
79 return regValue;
80 static WCHAR msg[4048];
82 wsprintfW(msg,
83 L"%s\n\nClick Abort to exit the Application.\n"
84 L"Click Retry to Debug the Application.\n"
85 L"Click Ignore to continue running the Application.",
86 lpszCmdLine);
88 return MessageBoxW(NULL, msg, L"NSGlue_Assertion",
89 MB_ICONSTOP | MB_SYSTEMMODAL |
90 MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);