6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * 2005 Klemens Friedl <frik85@reactos.at>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 void ProcessPage_OnDebug(void)
29 WCHAR strErrorText
[260];
31 WCHAR strDebugPath
[260];
32 WCHAR strDebugger
[260];
34 PROCESS_INFORMATION pi
;
40 dwProcessId
= GetSelectedProcessId();
45 LoadStringW(hInst
, IDS_MSG_WARNINGDEBUG
, szTemp
, 256);
46 LoadStringW(hInst
, IDS_MSG_TASKMGRWARNING
, szTempA
, 256);
48 if (MessageBoxW(hMainWnd
, szTemp
, szTempA
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
50 GetLastErrorText(strErrorText
, 260);
51 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, 256);
52 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
56 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
58 GetLastErrorText(strErrorText
, 260);
59 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, 256);
60 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
65 if (RegQueryValueExW(hKey
, L
"Debugger", NULL
, NULL
, (LPBYTE
)strDebugger
, &dwDebuggerSize
) != ERROR_SUCCESS
)
67 GetLastErrorText(strErrorText
, 260);
68 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, 256);
69 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
76 hDebugEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
79 GetLastErrorText(strErrorText
, 260);
80 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, 256);
81 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
85 wsprintfW(strDebugPath
, strDebugger
, dwProcessId
, hDebugEvent
);
87 memset(&pi
, 0, sizeof(PROCESS_INFORMATION
));
88 memset(&si
, 0, sizeof(STARTUPINFOW
));
89 si
.cb
= sizeof(STARTUPINFOW
);
90 if (!CreateProcessW(NULL
, strDebugPath
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
))
92 GetLastErrorText(strErrorText
, 260);
93 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, 256);
94 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
97 CloseHandle(hDebugEvent
);