HyperDbg Debugger
Loading...
Searching...
No Matches
DebuggerEvents.h File Reference

Implementation of debugger VMCALLs. More...

Go to the source code of this file.

Functions

VOID DebuggerEventEnableEferOnAllProcessors ()
 routines for !syscall command (enable syscall hook)
 
VOID DebuggerEventDisableEferOnAllProcessors ()
 routines for !syscall command (disable syscall hook)
 
VOID DebuggerEventEnableMovToCr3ExitingOnAllProcessors ()
 routines for debugging threads (enable mov-to-cr3 exiting)
 
VOID DebuggerEventDisableMovToCr3ExitingOnAllProcessors ()
 routines for debugging threads (disable mov-to-cr3 exiting)
 
BOOLEAN DebuggerEventEnableMonitorReadWriteExec (EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *HookingDetails, UINT32 ProcessId, BOOLEAN ApplyDirectlyFromVmxRoot)
 Apply monitor ept hook events for address.
 
BOOLEAN DebuggerCheckProcessOrThreadChange (_In_ UINT32 CoreId)
 Handle process or thread switches.
 

Detailed Description

Implementation of debugger VMCALLs.

Headers of Debugger events (triggers and enable events)

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.2
Date
2023-01-22
Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-05-12

Function Documentation

◆ DebuggerCheckProcessOrThreadChange()

BOOLEAN DebuggerCheckProcessOrThreadChange ( _In_ UINT32 CoreId)

Handle process or thread switches.

Parameters
CoreId
Returns
BOOLEAN
115{
116 PROCESSOR_DEBUGGING_STATE * DbgState = &g_DbgState[CoreId];
117
118 //
119 // Check whether intercepting this process or thread is active or not
120 //
123
124 {
125 //
126 // We only handle interrupts that are related to the clock-timer interrupt
127 //
129 {
130 return ThreadHandleThreadChange(DbgState);
131 }
132 else
133 {
134 return ProcessHandleProcessChange(DbgState);
135 }
136 }
137
138 //
139 // Not handled here
140 //
141 return FALSE;
142}
#define FALSE
Definition BasicTypes.h:54
BOOLEAN ProcessHandleProcessChange(PROCESSOR_DEBUGGING_STATE *DbgState)
handle process changes
Definition Process.c:42
BOOLEAN ThreadHandleThreadChange(PROCESSOR_DEBUGGING_STATE *DbgState)
handle thread changes
Definition Thread.c:22
PROCESSOR_DEBUGGING_STATE * g_DbgState
Save the state and variables related to debugging on each to logical core.
Definition Global.h:17
BOOLEAN InterceptClockInterruptsForProcessChange
Definition State.h:63
BOOLEAN InterceptClockInterruptsForThreadChange
Definition State.h:57
Saves the debugger state.
Definition State.h:165
DEBUGGEE_PROCESS_OR_THREAD_TRACING_DETAILS ThreadOrProcessTracingDetails
Definition State.h:178

◆ DebuggerEventDisableEferOnAllProcessors()

VOID DebuggerEventDisableEferOnAllProcessors ( )

routines for !syscall command (disable syscall hook)

Returns
VOID
32{
34}
VOID ConfigureDisableEferSyscallEventsOnAllProcessors()
routines for disabling syscall hooks on all cores
Definition Configuration.c:143

◆ DebuggerEventDisableMovToCr3ExitingOnAllProcessors()

VOID DebuggerEventDisableMovToCr3ExitingOnAllProcessors ( )

routines for debugging threads (disable mov-to-cr3 exiting)

Returns
VOID
54{
56}
VOID ConfigureDisableMovToCr3ExitingOnAllProcessors()
routines for debugging threads (disable mov-to-cr3 exiting)
Definition Configuration.c:116

◆ DebuggerEventEnableEferOnAllProcessors()

VOID DebuggerEventEnableEferOnAllProcessors ( )

routines for !syscall command (enable syscall hook)

Returns
VOID
21{
23}
VOID ConfigureEnableEferSyscallEventsOnAllProcessors()
routines for enabling syscall hooks on all cores
Definition Configuration.c:132

◆ DebuggerEventEnableMonitorReadWriteExec()

BOOLEAN DebuggerEventEnableMonitorReadWriteExec ( EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR * HookingDetails,
UINT32 ProcessId,
BOOLEAN ApplyDirectlyFromVmxRoot )

Apply monitor ept hook events for address.

Parameters
HookingDetails
ProcessId
ApplyDirectlyFromVmxRoot
Returns
VOID
71{
72 //
73 // Check if the detail is ok for either read or write or both
74 //
75 if (!HookingDetails->SetHookForRead && !HookingDetails->SetHookForWrite && !HookingDetails->SetHookForExec)
76 {
77 return FALSE;
78 }
79
80 //
81 // If the read is FALSE and WRITE is TRUE, then the processor doesn't support
82 // such a thing, we will enable the Read silently here if, this problem will be
83 // solved when the trigger works, the trigger routines won't enable reads
84 //
85 if (HookingDetails->SetHookForWrite)
86 {
87 HookingDetails->SetHookForRead = TRUE;
88 }
89
90 //
91 // Perform the EPT Hook
92 //
93 if (ApplyDirectlyFromVmxRoot)
94 {
95 return ConfigureEptHookMonitorFromVmxRoot(KeGetCurrentProcessorNumberEx(NULL),
96 HookingDetails);
97 }
98 else
99 {
100 return ConfigureEptHookMonitor(KeGetCurrentProcessorNumberEx(NULL),
101 HookingDetails,
102 ProcessId);
103 }
104}
#define TRUE
Definition BasicTypes.h:55
BOOLEAN ConfigureEptHookMonitorFromVmxRoot(UINT32 CoreId, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *MemoryAddressDetails)
This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.
Definition Configuration.c:358
BOOLEAN ConfigureEptHookMonitor(UINT32 CoreId, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *HookingDetails, UINT32 ProcessId)
This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.
Definition Configuration.c:318
BOOLEAN SetHookForRead
Definition DataTypes.h:334
BOOLEAN SetHookForWrite
Definition DataTypes.h:335
BOOLEAN SetHookForExec
Definition DataTypes.h:336

◆ DebuggerEventEnableMovToCr3ExitingOnAllProcessors()

VOID DebuggerEventEnableMovToCr3ExitingOnAllProcessors ( )

routines for debugging threads (enable mov-to-cr3 exiting)

Returns
VOID
43{
45}
VOID ConfigureEnableMovToCr3ExitingOnAllProcessors()
routines for debugging threads (enable mov-to-cr3 exiting)
Definition Configuration.c:21