ReactOS 0.4.15-dev-5669-g09dde2c
debug.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ProcessPage_OnDebug (void)
 

Function Documentation

◆ ProcessPage_OnDebug()

void ProcessPage_OnDebug ( void  )

Definition at line 26 of file debug.c.

27{
28 DWORD dwProcessId;
29 WCHAR strErrorText[260];
30 HKEY hKey;
31 WCHAR strDebugPath[260];
32 WCHAR strDebugger[260];
33 DWORD dwDebuggerSize;
35 STARTUPINFOW si;
36 HANDLE hDebugEvent;
37 WCHAR szTemp[256];
38 WCHAR szTempA[256];
39
40 dwProcessId = GetSelectedProcessId();
41
42 if (dwProcessId == 0)
43 return;
44
47
48 if (MessageBoxW(hMainWnd, szTemp, szTempA, MB_YESNO | MB_ICONWARNING) != IDYES)
49 {
50 GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
52 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
53 return;
54 }
55
56 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
57 {
58 GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
60 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
61 return;
62 }
63
64 dwDebuggerSize = sizeof(strDebugger);
65 if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
66 {
67 GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
69 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
71 return;
72 }
73
75
76 hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
77 if (!hDebugEvent)
78 {
79 GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
81 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
82 return;
83 }
84
85 wsprintfW(strDebugPath, strDebugger, dwProcessId, hDebugEvent);
86
87 ZeroMemory(&pi, sizeof(pi));
88 ZeroMemory(&si, sizeof(si));
89 si.cb = sizeof(si);
90 if (!CreateProcessW(NULL, strDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
91 {
92 GetLastErrorText(strErrorText, ARRAYSIZE(strErrorText));
94 MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK | MB_ICONSTOP);
95 }
96 else
97 {
98 CloseHandle(pi.hThread);
99 CloseHandle(pi.hProcess);
100 }
101
102 CloseHandle(hDebugEvent);
103}
#define IDS_MSG_UNABLEDEBUGPROCESS
Definition: resource.h:245
#define IDS_MSG_TASKMGRWARNING
Definition: resource.h:247
#define IDS_MSG_WARNINGDEBUG
Definition: resource.h:246
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4593
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
HWND hMainWnd
Definition: magnifier.c:32
static refpint_t pi[]
Definition: server.c:96
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define L(x)
Definition: ntvdm.h:50
DWORD GetSelectedProcessId(void)
Definition: procpage.c:103
DWORD cb
Definition: winbase.h:852
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
LPWSTR GetLastErrorText(LPWSTR lpszBuf, DWORD dwSize)
Definition: taskmgr.c:1155
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ZeroMemory
Definition: winbase.h:1670
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define MB_YESNO
Definition: winuser.h:811
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:784
#define MB_ICONWARNING
Definition: winuser.h:780
#define MB_ICONSTOP
Definition: winuser.h:797
#define IDYES
Definition: winuser.h:829
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by TaskManagerWndProc().