Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendebug.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS Task Manager 00003 * 00004 * debug.c 00005 * 00006 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org> 00007 * 2005 Klemens Friedl <frik85@reactos.at> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #include <precomp.h> 00025 00026 void ProcessPage_OnDebug(void) 00027 { 00028 DWORD dwProcessId; 00029 WCHAR strErrorText[260]; 00030 HKEY hKey; 00031 WCHAR strDebugPath[260]; 00032 WCHAR strDebugger[260]; 00033 DWORD dwDebuggerSize; 00034 PROCESS_INFORMATION pi; 00035 STARTUPINFOW si; 00036 HANDLE hDebugEvent; 00037 WCHAR szTemp[256]; 00038 WCHAR szTempA[256]; 00039 00040 dwProcessId = GetSelectedProcessId(); 00041 00042 if (dwProcessId == 0) 00043 return; 00044 00045 LoadStringW(hInst, IDS_MSG_WARNINGDEBUG, szTemp, 256); 00046 LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTempA, 256); 00047 00048 if (MessageBoxW(hMainWnd, szTemp, szTempA, MB_YESNO|MB_ICONWARNING) != IDYES) 00049 { 00050 GetLastErrorText(strErrorText, 260); 00051 LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); 00052 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); 00053 return; 00054 } 00055 00056 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) != ERROR_SUCCESS) 00057 { 00058 GetLastErrorText(strErrorText, 260); 00059 LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); 00060 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); 00061 return; 00062 } 00063 00064 dwDebuggerSize = 260; 00065 if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS) 00066 { 00067 GetLastErrorText(strErrorText, 260); 00068 LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); 00069 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); 00070 RegCloseKey(hKey); 00071 return; 00072 } 00073 00074 RegCloseKey(hKey); 00075 00076 hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL); 00077 if (!hDebugEvent) 00078 { 00079 GetLastErrorText(strErrorText, 260); 00080 LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); 00081 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); 00082 return; 00083 } 00084 00085 wsprintfW(strDebugPath, strDebugger, dwProcessId, hDebugEvent); 00086 00087 memset(&pi, 0, sizeof(PROCESS_INFORMATION)); 00088 memset(&si, 0, sizeof(STARTUPINFOW)); 00089 si.cb = sizeof(STARTUPINFOW); 00090 if (!CreateProcessW(NULL, strDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) 00091 { 00092 GetLastErrorText(strErrorText, 260); 00093 LoadStringW(hInst, IDS_MSG_UNABLEDEBUGPROCESS, szTemp, 256); 00094 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); 00095 } 00096 00097 CloseHandle(hDebugEvent); 00098 } Generated on Sun May 27 2012 04:17:45 for ReactOS by
1.7.6.1
|