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
, ARRAYSIZE(szTemp
));
46 LoadStringW(hInst
, IDS_MSG_TASKMGRWARNING
, szTempA
, ARRAYSIZE(szTempA
));
48 if (MessageBoxW(hMainWnd
, szTemp
, szTempA
, MB_YESNO
| MB_ICONWARNING
) != IDYES
)
50 GetLastErrorText(strErrorText
, ARRAYSIZE(strErrorText
));
51 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, ARRAYSIZE(szTemp
));
52 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
| MB_ICONSTOP
);
56 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_QUERY_VALUE
, &hKey
) != ERROR_SUCCESS
)
58 GetLastErrorText(strErrorText
, ARRAYSIZE(strErrorText
));
59 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, ARRAYSIZE(szTemp
));
60 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
| MB_ICONSTOP
);
64 dwDebuggerSize
= sizeof(strDebugger
);
65 if (RegQueryValueExW(hKey
, L
"Debugger", NULL
, NULL
, (LPBYTE
)strDebugger
, &dwDebuggerSize
) != ERROR_SUCCESS
)
67 GetLastErrorText(strErrorText
, ARRAYSIZE(strErrorText
));
68 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, ARRAYSIZE(szTemp
));
69 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
| MB_ICONSTOP
);
76 hDebugEvent
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
79 GetLastErrorText(strErrorText
, ARRAYSIZE(strErrorText
));
80 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, ARRAYSIZE(szTemp
));
81 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
| MB_ICONSTOP
);
85 wsprintfW(strDebugPath
, strDebugger
, dwProcessId
, hDebugEvent
);
87 ZeroMemory(&pi
, sizeof(pi
));
88 ZeroMemory(&si
, sizeof(si
));
90 if (!CreateProcessW(NULL
, strDebugPath
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
))
92 GetLastErrorText(strErrorText
, ARRAYSIZE(strErrorText
));
93 LoadStringW(hInst
, IDS_MSG_UNABLEDEBUGPROCESS
, szTemp
, ARRAYSIZE(szTemp
));
94 MessageBoxW(hMainWnd
, strErrorText
, szTemp
, MB_OK
| MB_ICONSTOP
);
98 CloseHandle(pi
.hThread
);
99 CloseHandle(pi
.hProcess
);
102 CloseHandle(hDebugEvent
);