28 printf(
"*** Native (DbgUi) Debugging Test Application\n");
29 printf(
"Press any key to connect to Dbgk...");
33 printf(
" Connection Established. Status: %lx\n",
Status);
35 printf(
"Press any key to debug services.exe...");
37 printf(
"*** Win32 (Debug) Debugging Test Application\n");
38 printf(
"Press any key to debug services.exe...");
60 printf(
"Press any key to get first debug event... ");
68 printf(
"New State: %lx. Application Client ID: %lx/%lx\n",
70 State.AppClientId.UniqueProcess,
State.AppClientId.UniqueThread);
74 printf(
"New State: %lx. Application Client ID: %lx/%lx\n",
80 switch (
State.NewState)
87 printf(
"Process Handle: %lx. Thread Handle: %lx\n",
88 State.StateInfo.CreateProcessInfo.HandleToProcess,
89 State.StateInfo.CreateProcessInfo.HandleToThread);
90 printf(
"Process image handle: %lx\n",
91 State.StateInfo.CreateProcessInfo.NewProcess.FileHandle);
92 printf(
"Process image base: %lx\n",
93 State.StateInfo.CreateProcessInfo.NewProcess.BaseOfImage);
96 printf(
"Process Handle: %lx. Thread Handle: %lx\n",
99 printf(
"Process image handle: %lx\n",
101 printf(
"Process image base: %lx\n",
102 DebugEvent.u.CreateProcessInfo.lpBaseOfImage);
109 printf(
"New thread: %lx\n",
State.StateInfo.CreateThread.HandleToThread);
110 printf(
"Thread Start Address: %p\n",
State.StateInfo.CreateThread.NewThread.StartAddress);
114 printf(
"Thread Start Address: %p\n",
121 printf(
"New DLL: %lx\n",
State.StateInfo.LoadDll.FileHandle);
122 printf(
"DLL LoadAddress: %p\n",
State.StateInfo.LoadDll.BaseOfDll);
146 printf(
"Initial breakpoint hit at: %p!\n",
147 State.StateInfo.Exception.ExceptionRecord.ExceptionAddress);
155 printf(
"Thread exited: %lx\n",
State.StateInfo.ExitThread.ExitStatus);
163 printf(
"Process exited: %lx\n",
State.StateInfo.ExitProcess.ExitStatus);
171 printf(
"Press any key to continue debuggee...");
186 printf(
"Press any key to get next debug event... ");
189 printf(
"*** End of test\n");
#define UlongToHandle(ul)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
@ DbgBreakpointStateChange
@ DbgCreateProcessStateChange
@ DbgCreateThreadStateChange
@ DbgExitProcessStateChange
@ DbgExitThreadStateChange
NTSTATUS NTAPI DbgUiContinue(IN PCLIENT_ID ClientId, IN NTSTATUS ContinueStatus)
NTSTATUS NTAPI DbgUiDebugActiveProcess(IN HANDLE Process)
NTSTATUS NTAPI DbgUiConnectToDbg(VOID)
NTSTATUS NTAPI DbgUiWaitStateChange(OUT PDBGUI_WAIT_STATE_CHANGE WaitStateChange, IN PLARGE_INTEGER TimeOut OPTIONAL)
#define ReadProcessMemory(a, b, c, d, e)
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
_Check_return_ _CRTIMP int __cdecl getchar(void)
_In_ BOOL _In_ HANDLE hProcess
static const char * ImageName
#define InitializeObjectAttributes(p, n, a, r, s)
#define PROCESS_ALL_ACCESS
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
#define CREATE_PROCESS_DEBUG_EVENT
#define LOAD_DLL_DEBUG_EVENT
#define CREATE_THREAD_DEBUG_EVENT
_Out_ PCLIENT_ID ClientId