|
HyperDbg Debugger
|
General debugger headers. More...
Go to the source code of this file.
Classes | |
| struct | _DEBUGGER_CORE_EVENTS |
| List of all the different events. More... | |
| struct | _DEBUGGER_EVENT_ACTION |
| The structure of actions in HyperDbg. More... | |
| struct | _DEBUGGER_EVENT |
| The structure of events in HyperDbg. More... | |
Macros | |
| #define | DEBUGGER_DEBUG_REGISTER_FOR_STEP_OVER 0 |
| debug register for step-over | |
| #define | DEBUGGER_DEBUG_REGISTER_FOR_THREAD_MANAGEMENT 1 |
| debug register to monitor thread changes | |
Typedefs | |
| typedef struct _DEBUGGER_CORE_EVENTS | DEBUGGER_CORE_EVENTS |
| List of all the different events. | |
| typedef struct _DEBUGGER_CORE_EVENTS * | PDEBUGGER_CORE_EVENTS |
| typedef struct _DEBUGGER_EVENT_ACTION | DEBUGGER_EVENT_ACTION |
| The structure of actions in HyperDbg. | |
| typedef struct _DEBUGGER_EVENT_ACTION * | PDEBUGGER_EVENT_ACTION |
| typedef struct _DEBUGGER_EVENT | DEBUGGER_EVENT |
| The structure of events in HyperDbg. | |
| typedef struct _DEBUGGER_EVENT * | PDEBUGGER_EVENT |
| typedef UINT64 | DebuggerCheckForCondition(PGUEST_REGS Regs, PVOID Context) |
| The prototype that Condition codes are called. | |
| typedef PVOID | DebuggerRunCustomCodeFunc(PVOID PreAllocatedBufferAddress, PGUEST_REGS Regs, PVOID Context) |
| The prototype that Custom code buffers are called. | |
Functions | |
| UINT64 | DebuggerGetRegValueWrapper (PGUEST_REGS GuestRegs, UINT32 RegId) |
| A wrapper for GetRegValue() in script-engine. | |
| UINT32 | DebuggerGetLastError () |
| Debugger get the last error. | |
| VOID | DebuggerSetLastError (UINT32 LastError) |
| Debugger set the last error. | |
| BOOLEAN | DebuggerInitialize () |
| Initialize Debugger Structures and Routines. | |
| VOID | DebuggerUninitialize () |
| Uninitialize Debugger Structures and Routines. | |
| PDEBUGGER_EVENT | DebuggerCreateEvent (BOOLEAN Enabled, UINT32 CoreId, UINT32 ProcessId, VMM_EVENT_TYPE_ENUM EventType, UINT64 Tag, DEBUGGER_EVENT_OPTIONS *Options, UINT32 ConditionsBufferSize, PVOID ConditionBuffer, PDEBUGGER_EVENT_AND_ACTION_RESULT ResultsToReturn, BOOLEAN InputFromVmxRoot) |
| Create an Event Object. | |
| PDEBUGGER_EVENT_ACTION | DebuggerAddActionToEvent (PDEBUGGER_EVENT Event, DEBUGGER_EVENT_ACTION_TYPE_ENUM ActionType, BOOLEAN SendTheResultsImmediately, PDEBUGGER_EVENT_REQUEST_CUSTOM_CODE InTheCaseOfCustomCode, PDEBUGGER_EVENT_ACTION_RUN_SCRIPT_CONFIGURATION InTheCaseOfRunScript, PDEBUGGER_EVENT_AND_ACTION_RESULT ResultsToReturn, BOOLEAN InputFromVmxRoot) |
| Create an action and add the action to an event. | |
| BOOLEAN | DebuggerRegisterEvent (PDEBUGGER_EVENT Event) |
| Register an event to a list of active events. | |
| VMM_CALLBACK_TRIGGERING_EVENT_STATUS_TYPE | DebuggerTriggerEvents (VMM_EVENT_TYPE_ENUM EventType, VMM_CALLBACK_EVENT_CALLING_STAGE_TYPE CallingStage, PVOID Context, BOOLEAN *PostEventRequired, GUEST_REGS *Regs) |
| Trigger events of a special type to be managed by debugger. | |
| PDEBUGGER_EVENT | DebuggerGetEventByTag (UINT64 Tag) |
| Find event object by tag. | |
| BOOLEAN | DebuggerRemoveEvent (UINT64 Tag, BOOLEAN PoolManagerAllocatedMemory) |
| Remove the event by its tags and also remove its actions and de-allocate their buffers. | |
| BOOLEAN | DebuggerQueryDebuggerStatus () |
| Detect whether the user or kernel debugger is active or not. | |
| BOOLEAN | DebuggerParseEvent (PDEBUGGER_GENERAL_EVENT_DETAIL EventDetails, PDEBUGGER_EVENT_AND_ACTION_RESULT ResultsToReturn, BOOLEAN InputFromVmxRoot) |
| Routine for parsing events. | |
| BOOLEAN | DebuggerApplyEvent (PDEBUGGER_EVENT Event, PDEBUGGER_EVENT_AND_ACTION_RESULT ResultsToReturn, BOOLEAN InputFromVmxRoot) |
| Applying events. | |
| BOOLEAN | DebuggerParseAction (PDEBUGGER_GENERAL_ACTION Action, PDEBUGGER_EVENT_AND_ACTION_RESULT ResultsToReturn, BOOLEAN InputFromVmxRoot) |
| Routine for validating and parsing actions that are coming from the user-mode. | |
| BOOLEAN | DebuggerParseEventsModification (PDEBUGGER_MODIFY_EVENTS DebuggerEventModificationRequest, BOOLEAN InputFromVmxRoot, BOOLEAN PoolManagerAllocatedMemory) |
| Parse and validate requests to enable/disable/clear from the user-mode. | |
| BOOLEAN | DebuggerTerminateEvent (UINT64 Tag, BOOLEAN InputFromVmxRoot) |
| Terminate one event's effect by its tag. | |
| UINT32 | DebuggerEventListCount (PLIST_ENTRY TargetEventList) |
| Count the list of events in a special list. | |
| VOID | DebuggerClearAllEvents (BOOLEAN InputFromVmxRoot, BOOLEAN PoolManagerAllocatedMemory) |
| Clear all events. | |
| BOOLEAN | DebuggerEnableOrDisableAllEvents (BOOLEAN IsEnable) |
| Enable or disable all events from all the types. | |
| UINT32 | DebuggerEventListCountByCore (PLIST_ENTRY TargetEventList, UINT32 TargetCore) |
| Count the list of events in a special list that are activate on a target core. | |
| UINT32 | DebuggerEventListCountByEventType (VMM_EVENT_TYPE_ENUM EventType, UINT32 TargetCore) |
| Count the list of events by a special event type that are activate on a target core. | |
| UINT32 | DebuggerExceptionEventBitmapMask (UINT32 CoreIndex) |
| Get the mask related to the !exception command for the target core. | |
| BOOLEAN | DebuggerIsTagValid (UINT64 Tag) |
| Detect whether the tag exists or not. | |
| BOOLEAN | DebuggerEnableEvent (UINT64 Tag) |
| Enable an event by tag. | |
| BOOLEAN | DebuggerQueryStateEvent (UINT64 Tag) |
| returns whether an event is enabled/disabled by tag | |
| BOOLEAN | DebuggerDisableEvent (UINT64 Tag) |
| Disable an event by tag. | |
| BOOLEAN | DebuggerClearEvent (UINT64 Tag, BOOLEAN InputFromVmxRoot, BOOLEAN PoolManagerAllocatedMemory) |
| Clear an event by tag. | |
| VOID | DebuggerPerformActions (PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGER_EVENT *Event, DEBUGGER_TRIGGERED_EVENT_DETAILS *EventTriggerDetail) |
| Run a special event's action(s) | |
| VOID | DebuggerPerformBreakToDebugger (PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGER_EVENT_ACTION *Action, DEBUGGER_TRIGGERED_EVENT_DETAILS *EventTriggerDetail) |
| Manage breaking to the debugger action. | |
| BOOLEAN | DebuggerPerformRunScript (PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGER_EVENT_ACTION *Action, DEBUGGEE_SCRIPT_PACKET *ScriptDetails, DEBUGGER_TRIGGERED_EVENT_DETAILS *EventTriggerDetail) |
| Managing run script action. | |
| VOID | DebuggerPerformRunTheCustomCode (PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGER_EVENT_ACTION *Action, DEBUGGER_TRIGGERED_EVENT_DETAILS *EventTriggerDetail) |
| Manage running the custom code action. | |
| PLIST_ENTRY | DebuggerGetEventListByEventType (VMM_EVENT_TYPE_ENUM EventType) |
| Get List of event based on event type. | |
General debugger headers.
| #define DEBUGGER_DEBUG_REGISTER_FOR_STEP_OVER 0 |
debug register for step-over
| #define DEBUGGER_DEBUG_REGISTER_FOR_THREAD_MANAGEMENT 1 |
debug register to monitor thread changes
| typedef struct _DEBUGGER_CORE_EVENTS DEBUGGER_CORE_EVENTS |
List of all the different events.
| typedef struct _DEBUGGER_EVENT DEBUGGER_EVENT |
The structure of events in HyperDbg.
| typedef struct _DEBUGGER_EVENT_ACTION DEBUGGER_EVENT_ACTION |
The structure of actions in HyperDbg.
| typedef UINT64 DebuggerCheckForCondition(PGUEST_REGS Regs, PVOID Context) |
The prototype that Condition codes are called.
| Regs | Guest registers |
| Context | Optional parameter which is different for each event and shows a unique description about the event |
| typedef PVOID DebuggerRunCustomCodeFunc(PVOID PreAllocatedBufferAddress, PGUEST_REGS Regs, PVOID Context) |
The prototype that Custom code buffers are called.
| PreAllocatedBufferAddress | The address of a pre-allocated non-paged pool if the user-requested for it |
| Regs | Guest registers |
| Context | Optional parameter which is different for each event and shows a unique description about the event |
| typedef struct _DEBUGGER_CORE_EVENTS * PDEBUGGER_CORE_EVENTS |
| typedef struct _DEBUGGER_EVENT * PDEBUGGER_EVENT |
| typedef struct _DEBUGGER_EVENT_ACTION * PDEBUGGER_EVENT_ACTION |
| PDEBUGGER_EVENT_ACTION DebuggerAddActionToEvent | ( | PDEBUGGER_EVENT | Event, |
| DEBUGGER_EVENT_ACTION_TYPE_ENUM | ActionType, | ||
| BOOLEAN | SendTheResultsImmediately, | ||
| PDEBUGGER_EVENT_REQUEST_CUSTOM_CODE | InTheCaseOfCustomCode, | ||
| PDEBUGGER_EVENT_ACTION_RUN_SCRIPT_CONFIGURATION | InTheCaseOfRunScript, | ||
| PDEBUGGER_EVENT_AND_ACTION_RESULT | ResultsToReturn, | ||
| BOOLEAN | InputFromVmxRoot ) |
Create an action and add the action to an event.
| Event | Target event object |
| ActionType | Type of action |
| SendTheResultsImmediately | whether the results should be received by the user-mode immediately |
| InTheCaseOfCustomCode | Custom code structure (if any) |
| InTheCaseOfRunScript | Run script structure (if any) |
| ResultsToReturn | The buffer address that should be returned to the user-mode as the result |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| BOOLEAN DebuggerApplyEvent | ( | PDEBUGGER_EVENT | Event, |
| PDEBUGGER_EVENT_AND_ACTION_RESULT | ResultsToReturn, | ||
| BOOLEAN | InputFromVmxRoot ) |
Applying events.
| Event | The created event object |
| ResultsToReturn | Result buffer that should be returned to the user-mode |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
Clear all events.
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| PoolManagerAllocatedMemory | Whether the pools are allocated from the pool manager or original OS pools |
| BOOLEAN DebuggerClearEvent | ( | UINT64 | Tag, |
| BOOLEAN | InputFromVmxRoot, | ||
| BOOLEAN | PoolManagerAllocatedMemory ) |
Clear an event by tag.
| Tag | Tag of target event |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| PoolManagerAllocatedMemory | Whether the pools are allocated from the pool manager or original OS pools |
| PDEBUGGER_EVENT DebuggerCreateEvent | ( | BOOLEAN | Enabled, |
| UINT32 | CoreId, | ||
| UINT32 | ProcessId, | ||
| VMM_EVENT_TYPE_ENUM | EventType, | ||
| UINT64 | Tag, | ||
| DEBUGGER_EVENT_OPTIONS * | Options, | ||
| UINT32 | ConditionsBufferSize, | ||
| PVOID | ConditionBuffer, | ||
| PDEBUGGER_EVENT_AND_ACTION_RESULT | ResultsToReturn, | ||
| BOOLEAN | InputFromVmxRoot ) |
Create an Event Object.
should NOT be called in vmx-root
| Enabled | Is the event enabled or disabled |
| CoreId | The core id that this event is allowed to run |
| ProcessId | The process id that this event is allowed to run |
| EventType | The type of event |
| Tag | User-mode generated unique tag (id) of the event |
| Options | Optional parameters for the event |
| ConditionsBufferSize | Size of condition code buffer (if any) |
| ConditionBuffer | Address of condition code buffer (if any) |
| ResultsToReturn | Result buffer that should be returned to the user-mode |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
Disable an event by tag.
| Tag | Tag of target event |
Enable an event by tag.
| Tag | Tag of target event |
Enable or disable all events from all the types.
| IsEnable | If you want to enable then true and if you want to disable then false |
| UINT32 DebuggerEventListCount | ( | PLIST_ENTRY | TargetEventList | ) |
Count the list of events in a special list.
| TargetEventList | target event list |
Count the list of events in a special list that are activate on a target core.
| TargetEventList | target event list |
| TargetCore | target core |
| UINT32 DebuggerEventListCountByEventType | ( | VMM_EVENT_TYPE_ENUM | EventType, |
| UINT32 | TargetCore ) |
Count the list of events by a special event type that are activate on a target core.
| EventType | target event type |
| TargetCore | target core |
Get the mask related to the !exception command for the target core.
| CoreIndex | The index of core |
| PDEBUGGER_EVENT DebuggerGetEventByTag | ( | UINT64 | Tag | ) |
Find event object by tag.
| Tag | Tag of event |
| PLIST_ENTRY DebuggerGetEventListByEventType | ( | VMM_EVENT_TYPE_ENUM | EventType | ) |
Get List of event based on event type.
| EventType | type of event |
| UINT32 DebuggerGetLastError | ( | ) |
Debugger get the last error.
| UINT64 DebuggerGetRegValueWrapper | ( | PGUEST_REGS | GuestRegs, |
| UINT32 | RegId ) |
A wrapper for GetRegValue() in script-engine.
| BOOLEAN DebuggerInitialize | ( | ) |
Initialize Debugger Structures and Routines.
Detect whether the tag exists or not.
| Tag | Tag of target event |
| BOOLEAN DebuggerParseAction | ( | PDEBUGGER_GENERAL_ACTION | ActionDetails, |
| PDEBUGGER_EVENT_AND_ACTION_RESULT | ResultsToReturn, | ||
| BOOLEAN | InputFromVmxRoot ) |
Routine for validating and parsing actions that are coming from the user-mode.
| ActionDetails | Structure that describes the action that comes from the user-mode |
| ResultsToReturn | The buffer address that should be returned to the user-mode as the result |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| BOOLEAN DebuggerParseEvent | ( | PDEBUGGER_GENERAL_EVENT_DETAIL | EventDetails, |
| PDEBUGGER_EVENT_AND_ACTION_RESULT | ResultsToReturn, | ||
| BOOLEAN | InputFromVmxRoot ) |
Routine for parsing events.
| EventDetails | The structure that describes event that came from the user-mode |
| ResultsToReturn | Result buffer that should be returned to the user-mode |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| BOOLEAN DebuggerParseEventsModification | ( | PDEBUGGER_MODIFY_EVENTS | DebuggerEventModificationRequest, |
| BOOLEAN | InputFromVmxRoot, | ||
| BOOLEAN | PoolManagerAllocatedMemory ) |
Parse and validate requests to enable/disable/clear from the user-mode.
| DebuggerEventModificationRequest | event modification request details |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| PoolManagerAllocatedMemory | Whether the pools are allocated from the pool manager or original OS pools |
| VOID DebuggerPerformActions | ( | PROCESSOR_DEBUGGING_STATE * | DbgState, |
| DEBUGGER_EVENT * | Event, | ||
| DEBUGGER_TRIGGERED_EVENT_DETAILS * | EventTriggerDetail ) |
Run a special event's action(s)
| DbgState | The state of the debugger on the current core |
| Event | Event Object |
| EventTriggerDetail | Event trigger details |
| VOID DebuggerPerformBreakToDebugger | ( | PROCESSOR_DEBUGGING_STATE * | DbgState, |
| DEBUGGER_EVENT_ACTION * | Action, | ||
| DEBUGGER_TRIGGERED_EVENT_DETAILS * | EventTriggerDetail ) |
Manage breaking to the debugger action.
| DbgState | The state of the debugger on the current core |
| Tag | Tag of event |
| Action | Action object |
| EventTriggerDetail | Event trigger detail |
| BOOLEAN DebuggerPerformRunScript | ( | PROCESSOR_DEBUGGING_STATE * | DbgState, |
| DEBUGGER_EVENT_ACTION * | Action, | ||
| DEBUGGEE_SCRIPT_PACKET * | ScriptDetails, | ||
| DEBUGGER_TRIGGERED_EVENT_DETAILS * | EventTriggerDetail ) |
Managing run script action.
| DbgState | The state of the debugger on the current core |
| Action | Action object |
| ScriptDetails | Details of script |
| EventTriggerDetail | Event trigger detail |
| VOID DebuggerPerformRunTheCustomCode | ( | PROCESSOR_DEBUGGING_STATE * | DbgState, |
| DEBUGGER_EVENT_ACTION * | Action, | ||
| DEBUGGER_TRIGGERED_EVENT_DETAILS * | EventTriggerDetail ) |
Manage running the custom code action.
| DbgState | The state of the debugger on the current core |
| Action | Action object |
| EventTriggerDetail | Event trigger detail |
| BOOLEAN DebuggerQueryDebuggerStatus | ( | ) |
Detect whether the user or kernel debugger is active or not.
returns whether an event is enabled/disabled by tag
this function won't check for Tag validity and if not found then returns false
| Tag | Tag of target event |
| BOOLEAN DebuggerRegisterEvent | ( | PDEBUGGER_EVENT | Event | ) |
Register an event to a list of active events.
| Event | Event structure |
Remove the event by its tags and also remove its actions and de-allocate their buffers.
it won't terminate their effects, so the events should be terminated first then we can remove them
| Tag | Target event tag |
| PoolManagerAllocatedMemory | Whether the pools are allocated from the pool manager or original OS pools |
Debugger set the last error.
| LastError | The value of last error |
Terminate one event's effect by its tag.
This function won't remove the event from the lists of event or de-allocated them, this should be called BEFORE the removing function
| Tag | Target event's tag |
| InputFromVmxRoot | Whether the input comes from VMX root-mode or IOCTL |
| VMM_CALLBACK_TRIGGERING_EVENT_STATUS_TYPE DebuggerTriggerEvents | ( | VMM_EVENT_TYPE_ENUM | EventType, |
| VMM_CALLBACK_EVENT_CALLING_STAGE_TYPE | CallingStage, | ||
| PVOID | Context, | ||
| BOOLEAN * | PostEventRequired, | ||
| GUEST_REGS * | Regs ) |
Trigger events of a special type to be managed by debugger.
| EventType | Type of events |
| CallingStage | Stage of calling (pre-event or post-event) |
| Context | An optional parameter (different in each event) |
| PostEventRequired | Whether the caller is requested to trigger a post-event event |
| Regs | Guest gp-registers |
| VOID DebuggerUninitialize | ( | ) |
Uninitialize Debugger Structures and Routines.