|
HyperDbg Debugger
|
control the user-mode debugging affairs More...
#include "pch.h"Functions | |
| VOID | UdInitializeUserDebugger () |
| Initialize the user debugger in user mode. | |
| VOID | UdUninitializeUserDebugger () |
| Uninitialize the user debugger in user mode. | |
| VOID | UdSetActiveDebuggingProcess (UINT64 DebuggingId, UINT64 Rip, UINT32 ProcessId, UINT32 ThreadId, BOOLEAN Is32Bit, BOOLEAN IsPaused, BYTE InstructionBytesOnRip[]) |
| set the current active debugging process (thread) | |
| VOID | UdRemoveActiveDebuggingProcess () |
| Remove the current active debugging process (thread). | |
| VOID | UdPrintError () |
| print error messages relating to the finding thread id | |
| BOOLEAN | UdListProcessThreads (DWORD OwnerPID) |
| List of threads by owner process id. | |
| BOOLEAN | UdCheckThreadByProcessId (DWORD Pid, DWORD Tid) |
| Check if a thread belongs to special process. | |
| BOOLEAN | UdCreateSuspendedProcess (const WCHAR *FileName, const WCHAR *CommandLine, PPROCESS_INFORMATION ProcessInformation) |
| Attach to a target process. | |
| BOOLEAN | UdAttachToProcess (UINT32 TargetPid, const WCHAR *TargetFileAddress, const WCHAR *CommandLine, BOOLEAN RunCallbackAtTheFirstInstruction) |
| Attach to target process. | |
| BOOLEAN | UdTerminateProcessByPid (DWORD TargetPid) |
| Check if process exists or not. | |
| BOOLEAN | UdDoesProcessExistByPid (DWORD TargetPid) |
| Check if process exists or not by process id. | |
| BOOLEAN | UdDoesProcessExistByHandle (HANDLE TargetHandle) |
| Check if process exists or not by handle. | |
| BOOLEAN | UdKillProcess (UINT32 TargetPid) |
| Kill the target process from kernel. | |
| BOOLEAN | UdDetachProcess (UINT32 TargetPid, UINT64 ProcessDetailToken) |
| Detach the target process. | |
| BOOLEAN | UdPauseProcess (UINT64 ProcessDebuggingToken) |
| Pause the target process. | |
| BOOLEAN | UdContinueProcess (UINT64 ProcessDebuggingToken) |
| Continue the target process. | |
| BOOLEAN | UdSendCommand (UINT64 ProcessDetailToken, UINT32 ThreadId, DEBUGGER_UD_COMMAND_ACTION_TYPE ActionType, PVOID OptionalBuffer, UINT32 OptionalBufferSize, BOOLEAN ApplyToAllPausedThreads, BOOLEAN WaitForEventCompletion, UINT64 OptionalParam1, UINT64 OptionalParam2, UINT64 OptionalParam3, UINT64 OptionalParam4) |
| Send the command to the user debugger. | |
| BOOLEAN | UdSendReadRegisterToUserDebugger (UINT64 ProcessDetailToken, UINT32 TargetThreadId, PDEBUGGEE_REGISTER_READ_DESCRIPTION RegDes, UINT32 RegBuffSize) |
| Send the command to the user debugger. | |
| BOOLEAN | UdSendScriptBufferToProcess (UINT64 ProcessDetailToken, UINT32 TargetThreadId, UINT64 BufferAddress, UINT32 BufferLength, UINT32 Pointer, BOOLEAN IsFormat) |
| Send script buffer to the user debugger. | |
| BOOLEAN | UdSendStepPacketToDebuggee (UINT64 ProcessDetailToken, UINT32 TargetThreadId, DEBUGGER_REMOTE_STEPPING_REQUEST StepType) |
| Send stepping instructions packet to user debugger. | |
| BOOLEAN | UdSetActiveDebuggingThreadByPidOrTid (UINT32 TargetPidOrTid, BOOLEAN IsTid) |
| Set the active debugging thread by process id or thread id. | |
| BOOLEAN | UdShowListActiveDebuggingProcessesAndThreads () |
| Show list of active debugging processes and threads. | |
Variables | |
| UINT32 | g_ProcessIdOfLatestStartingProcess |
| The process id of the latest starting process. | |
| ACTIVE_DEBUGGING_PROCESS | g_ActiveProcessDebuggingState |
| State of active debugging thread. | |
| BOOLEAN | g_IsUserDebuggerInitialized |
| Whether the user debugger is initialized or not. | |
| BOOLEAN | g_IsVmmModuleLoaded |
| shows whether the VMM module is loaded or not | |
| UINT64 | g_ResultOfEvaluatedExpression |
| Result of the expression that is evaluated in the debuggee. | |
| UINT32 | g_ErrorStateOfResultOfEvaluatedExpression |
| Shows the state of the evaluation of expression which whether contains error or not. | |
| CommandType | g_CommandsList |
| List of command and attributes. | |
| DEBUGGER_SYNCRONIZATION_EVENTS_STATE | g_UserSyncronizationObjectsHandleTable [DEBUGGER_MAXIMUM_SYNCRONIZATION_USER_DEBUGGER_OBJECTS] |
| In debugger (not debuggee), we save the handle of the user-mode listening thread for pauses here for user debugger. | |
control the user-mode debugging affairs
| BOOLEAN UdAttachToProcess | ( | UINT32 | TargetPid, |
| const WCHAR * | TargetFileAddress, | ||
| const WCHAR * | CommandLine, | ||
| BOOLEAN | RunCallbackAtTheFirstInstruction ) |
Attach to target process.
this function will not check whether the process id is valid or not
| TargetPid | |
| TargetFileAddress | |
| CommandLine | |
| RunCallbackAtTheFirstInstruction |
Check if a thread belongs to special process.
| Pid | Process id |
| Tid | Thread id |
| BOOLEAN UdContinueProcess | ( | UINT64 | ProcessDebuggingToken | ) |
Continue the target process.
| ProcessDebuggingToken |
| BOOLEAN UdCreateSuspendedProcess | ( | const WCHAR * | FileName, |
| const WCHAR * | CommandLine, | ||
| PPROCESS_INFORMATION | ProcessInformation ) |
Attach to a target process.
| FileName | |
| CommandLine | |
| ProcessInformation |
Detach the target process.
this function will not check whether the process id and thread id is valid or not
| TargetPid | |
| ProcessDetailToken |
| BOOLEAN UdDoesProcessExistByHandle | ( | HANDLE | TargetHandle | ) |
Check if process exists or not by handle.
| TargetHandle |
Check if process exists or not by process id.
| TargetPid |
| VOID UdInitializeUserDebugger | ( | ) |
Initialize the user debugger in user mode.
initialize user debugger
this function should be called on vmx non-root
Kill the target process from kernel.
this function will not check whether the process id and thread id is valid or not
| TargetPid |
List of threads by owner process id.
| OwnerPID |
| BOOLEAN UdPauseProcess | ( | UINT64 | ProcessDebuggingToken | ) |
Pause the target process.
| ProcessDebuggingToken |
| VOID UdPrintError | ( | ) |
print error messages relating to the finding thread id
this function is used only in the scope of Thread32First
| VOID UdRemoveActiveDebuggingProcess | ( | ) |
Remove the current active debugging process (thread).
| BOOLEAN UdSendCommand | ( | UINT64 | ProcessDetailToken, |
| UINT32 | ThreadId, | ||
| DEBUGGER_UD_COMMAND_ACTION_TYPE | ActionType, | ||
| PVOID | OptionalBuffer, | ||
| UINT32 | OptionalBufferSize, | ||
| BOOLEAN | ApplyToAllPausedThreads, | ||
| BOOLEAN | WaitForEventCompletion, | ||
| UINT64 | OptionalParam1, | ||
| UINT64 | OptionalParam2, | ||
| UINT64 | OptionalParam3, | ||
| UINT64 | OptionalParam4 ) |
Send the command to the user debugger.
| ProcessDetailToken | |
| ThreadId | |
| ActionType | |
| OptionalBuffer | |
| OptionalBufferSize | |
| ApplyToAllPausedThreads | |
| WaitForEventCompletion | |
| OptionalParam1 | |
| OptionalParam2 | |
| OptionalParam3 | |
| OptionalParam4 |
| BOOLEAN UdSendReadRegisterToUserDebugger | ( | UINT64 | ProcessDetailToken, |
| UINT32 | TargetThreadId, | ||
| PDEBUGGEE_REGISTER_READ_DESCRIPTION | RegDes, | ||
| UINT32 | RegBuffSize ) |
Send the command to the user debugger.
| ProcessDetailToken | |
| TargetThreadId | |
| RegDes | |
| RegBuffSize |
| BOOLEAN UdSendScriptBufferToProcess | ( | UINT64 | ProcessDetailToken, |
| UINT32 | TargetThreadId, | ||
| UINT64 | BufferAddress, | ||
| UINT32 | BufferLength, | ||
| UINT32 | Pointer, | ||
| BOOLEAN | IsFormat ) |
Send script buffer to the user debugger.
| ProcessDetailToken | |
| TargetThreadId | |
| BufferAddress | |
| BufferLength | |
| Pointer |
| BOOLEAN UdSendStepPacketToDebuggee | ( | UINT64 | ProcessDetailToken, |
| UINT32 | TargetThreadId, | ||
| DEBUGGER_REMOTE_STEPPING_REQUEST | StepType ) |
Send stepping instructions packet to user debugger.
| ProcessDetailToken | |
| TargetThreadId | |
| StepType |
| VOID UdSetActiveDebuggingProcess | ( | UINT64 | DebuggingId, |
| UINT64 | Rip, | ||
| UINT32 | ProcessId, | ||
| UINT32 | ThreadId, | ||
| BOOLEAN | Is32Bit, | ||
| BOOLEAN | IsPaused, | ||
| BYTE | InstructionBytesOnRip[] ) |
set the current active debugging process (thread)
| DebuggingId | |
| Rip | |
| ProcessId | |
| ThreadId | |
| Is32Bit | |
| InstructionBytesOnRip |
Set the active debugging thread by process id or thread id.
| TargetPidOrTid | |
| IsTid |
| BOOLEAN UdShowListActiveDebuggingProcessesAndThreads | ( | ) |
Show list of active debugging processes and threads.
Check if process exists or not.
| TargetPid |
| VOID UdUninitializeUserDebugger | ( | ) |
Uninitialize the user debugger in user mode.
uninitialize user debugger
this function should be called on vmx non-root
|
extern |
State of active debugging thread.
|
extern |
List of command and attributes.
|
extern |
Shows the state of the evaluation of expression which whether contains error or not.
|
extern |
Whether the user debugger is initialized or not.
|
extern |
shows whether the VMM module is loaded or not
|
extern |
The process id of the latest starting process.
|
extern |
Result of the expression that is evaluated in the debuggee.
|
extern |
In debugger (not debuggee), we save the handle of the user-mode listening thread for pauses here for user debugger.