HyperDbg Debugger
Loading...
Searching...
No Matches
export.cpp File Reference

Exported functions from libhyperdbg interface. More...

#include "pch.h"

Functions

BOOLEAN hyperdbg_u_detect_vmx_support ()
 Detects the support of VMX.
VOID hyperdbg_u_read_vendor_string (CHAR *vendor_string)
 Read the vendor string of the CPU.
INT hyperdbg_u_load_vmm ()
 Load the VMM.
BOOLEAN hyperdbg_u_is_any_module_loaded ()
 Check if any module is loaded.
INT hyperdbg_u_unload_all_modules ()
 Unload all modules.
INT hyperdbg_u_unload_vmm ()
 Unload the VMM module.
INT hyperdbg_u_unload_hypertrace_module ()
 Unload the trace module.
INT hyperdbg_u_unload_kd ()
 Unload the KD module.
INT hyperdbg_u_install_kd_driver ()
 Install the KD driver.
INT hyperdbg_u_uninstall_kd_driver ()
 Uninstall the KD (Kernel Debugger) driver.
INT hyperdbg_u_start_kd_driver ()
 Start the KD driver.
INT hyperdbg_u_stop_kd_driver ()
 Stop the KD driver.
GENERIC_PROCESSOR_VENDOR hyperdbg_u_get_processor_vendor ()
 Get the vendor of the current processor.
INT hyperdbg_u_load_kd_module ()
 Load the KD module.
INT hyperdbg_u_load_hypertrace_module ()
 Load the hypertrace module.
INT hyperdbg_u_load_all_modules ()
 Load all modules.
INT hyperdbg_u_run_command (CHAR *command)
 Run a command.
BOOLEAN hyperdbg_u_test_command_parser (CHAR *command, UINT32 number_of_tokens, CHAR **tokens_list, UINT32 *failed_token_num, UINT32 *failed_token_position)
 Parse the command (used for testing purposes).
VOID hyperdbg_u_test_command_parser_show_tokens (CHAR *command)
 Parse and show tokens for the command (used for testing purposes).
VOID hyperdbg_u_show_signature ()
 Show the signature of the debugger.
VOID hyperdbg_u_set_text_message_callback (PVOID handler)
 Set the function callback that will be called if any message needs to be shown (by passing message as a parameter).
PVOID hyperdbg_u_set_text_message_callback_using_shared_buffer (PVOID handler)
 Set the function callback that will be called if any message needs to be shown (using shared buffer method).
VOID hyperdbg_u_unset_text_message_callback ()
 Unset the function callback that will be called if any message needs to be shown.
INT hyperdbg_u_script_read_file_and_execute_commandline (INT argc, CHAR *argv[])
 Parsing the command line options for scripts.
BOOLEAN hyperdbg_u_continue_previous_command ()
 Some of commands like stepping commands (i, p, t) and etc. need to be repeated when the user press enter, this function shows whether we should continue the previous command or not.
BOOLEAN hyperdbg_u_check_multiline_command (CHAR *current_command, BOOLEAN reset)
 Check if the command is a multiline command or not.
VOID hyperdbg_u_connect_local_debugger ()
 Connect to the local debugger.
BOOLEAN hyperdbg_u_connect_remote_debugger (const CHAR *ip, const CHAR *port)
 Connect to the remote debugger.
VOID hyperdbg_u_continue_debuggee ()
 Continue the debuggee (equal to the 'g' command).
VOID hyperdbg_u_pause_debuggee ()
 Pause the debuggee (equal to the 'pause' command).
BOOLEAN hyperdbg_u_set_breakpoint (UINT64 address, UINT32 pid, UINT32 tid, UINT32 core_number)
 Set a breakpoint.
BOOLEAN hyperdbg_u_set_custom_driver_path (CHAR *driver_file_path, CHAR *driver_name)
 Set custom driver path.
VOID hyperdbg_u_use_default_driver_path ()
 Use the default driver path.
BOOLEAN hyperdbg_u_read_memory (UINT64 target_address, DEBUGGER_READ_MEMORY_TYPE memory_type, DEBUGGER_READ_READING_TYPE reading_Type, UINT32 pid, UINT32 size, BOOLEAN get_address_mode, DEBUGGER_READ_MEMORY_ADDRESS_MODE *address_mode, BYTE *target_buffer_to_store, UINT32 *return_length)
 Read memory and disassembler.
VOID hyperdbg_u_show_memory_or_disassemble (DEBUGGER_SHOW_MEMORY_STYLE style, UINT64 address, DEBUGGER_READ_MEMORY_TYPE memory_type, DEBUGGER_READ_READING_TYPE reading_type, UINT32 pid, UINT32 size, PDEBUGGER_DT_COMMAND_OPTIONS dt_details)
 Show memory or disassembler.
BOOLEAN hyperdbg_u_read_all_registers (GUEST_REGS *guest_registers, GUEST_EXTRA_REGISTERS *extra_registers)
 Read all registers.
BOOLEAN hyperdbg_u_read_target_register (REGS_ENUM register_id, UINT64 *target_register)
 Read target register.
BOOLEAN hyperdbg_u_write_target_register (REGS_ENUM register_id, UINT64 value)
 Write target register.
BOOLEAN hyperdbg_u_show_all_registers ()
 Show all registers.
BOOLEAN hyperdbg_u_show_target_register (REGS_ENUM register_id)
 Show target register.
BOOLEAN hyperdbg_u_write_memory (PVOID destination_address, DEBUGGER_EDIT_MEMORY_TYPE memory_type, UINT32 process_id, PVOID source_address, UINT32 number_of_bytes)
 Write memory.
UINT64 hyperdbg_u_get_kernel_base ()
 Get the kernel base.
BOOLEAN hyperdbg_u_connect_remote_debugger_using_com_port (const CHAR *port_name, DWORD baudrate, BOOLEAN pause_after_connection)
 Connect to the remote debugger using COM port.
BOOLEAN hyperdbg_u_connect_remote_debugger_using_named_pipe (const CHAR *named_pipe, BOOLEAN pause_after_connection)
 Connect to the remote debugger using named pipe.
BOOLEAN hyperdbg_u_debug_close_remote_debugger ()
 Close the remote debugger.
BOOLEAN hyperdbg_u_connect_current_debugger_using_com_port (const CHAR *port_name, DWORD baudrate)
 Connect to the current debugger using COM port.
BOOLEAN hyperdbg_u_start_process (const WCHAR *path)
 Start a new process.
BOOLEAN hyperdbg_u_start_process_with_args (const WCHAR *path, const WCHAR *arguments)
 Start a new process.
BOOLEAN hyperdbg_u_assemble_get_length (const CHAR *assembly_code, UINT64 start_address, UINT32 *length)
 Assembler function to get the length of the assembly code.
BOOLEAN hyperdbg_u_assemble (const CHAR *assembly_code, UINT64 start_address, PVOID buffer_to_store_assembled_data, UINT32 buffer_size)
 Assembler function.
BOOLEAN hyperdbg_u_setup_path_for_filename (const CHAR *filename, CHAR *file_location, UINT32 buffer_len, BOOLEAN check_file_existence)
 Setip the path for the filename.
BOOLEAN hyperdbg_u_stepping_instrumentation_step_in ()
 Perform instrumentation step-in.
BOOLEAN hyperdbg_u_stepping_regular_step_in ()
 Perform regular step-in.
BOOLEAN hyperdbg_u_stepping_step_over ()
 Perform step-over.
BOOLEAN hyperdbg_u_stepping_instrumentation_step_in_for_tracking ()
 Perform instrumentation step-in for tracking.
BOOLEAN hyperdbg_u_stepping_step_over_for_gu (BOOLEAN last_instruction)
 Perform step-over for gu.
BOOLEAN hyperdbg_u_get_local_apic (PLAPIC_PAGE local_apic, BOOLEAN *is_using_x2apic)
 Get Local APIC.
BOOLEAN hyperdbg_u_get_io_apic (IO_APIC_ENTRY_PACKETS *io_apic)
 Get I/O APIC.
BOOLEAN hyperdbg_u_get_idt_entry (INTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS *idt_packet)
 Get IDT entry.
BOOLEAN hyperdbg_u_perform_smi_operation (SMI_OPERATION_PACKETS *SmiOperation)
 Perform SMI operation.
BOOLEAN hwdbg_script_run_script (const CHAR *script, const CHAR *instance_filepath_to_read, const CHAR *hardware_script_file_path_to_save, UINT32 initial_bram_buffer_size)
 Run hwdbg script.
VOID hwdbg_script_engine_wrapper_test_parser (const char *Expr)
 Run (test evaluation) hwdbg script.
BOOLEAN hyperdbg_u_enable_transparent_mode (UINT32 ProcessId, CHAR *ProcessName, BOOLEAN IsProcessId)
 Enable transparent mode.
BOOLEAN hyperdbg_u_enable_transparent_mode_ex (UINT32 ProcessId, CHAR *ProcessName, BOOLEAN IsProcessId, UINT32 EvadeMask)
 Enable transparent mode with a feature mask.
BOOLEAN hyperdbg_u_disable_transparent_mode ()
 Disable transparent mode.
BOOLEAN hyperdbg_u_run_script (CHAR *Expr, BOOLEAN ShowErrorMessageIfAny)
 Run HyperDbg scripts in the target process (user debugger) or debuggee (kernel debugger).
UINT64 hyperdbg_u_eval_expression (CHAR *Expr, PBOOLEAN HasError)
 Evaluate expression and return result based on the target process (user debugger) or debuggee (kernel debugger) context.
BOOLEAN hyperdbg_u_lbr_dump (HYPERTRACE_LBR_DUMP_PACKETS *LbrdumpRequest)
 Dump LBR stack.
BOOLEAN hyperdbg_u_pt_operation (HYPERTRACE_PT_OPERATION_PACKETS *PtRequest)
 Perform an Intel PT operation (enable / disable / pause / resume / size / dump / flush / filter).
BOOLEAN hyperdbg_u_pt_mmap (HYPERTRACE_PT_MMAP_PACKETS *MmapRequest)
 Map the per-CPU Intel PT output buffers into the calling process.

Variables

TCHAR g_DriverLocation [MAX_PATH]
 Holds the location driver to install it.
TCHAR g_DriverName [MAX_PATH]
 Holds the name of the driver to install it.
BOOLEAN g_UseCustomDriverLocation
 Whether the user wants to use a custom driver location or not.

Detailed Description

Exported functions from libhyperdbg interface.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
jtaw5649
Version
0.10
Date
2024-06-24

Function Documentation

◆ hwdbg_script_engine_wrapper_test_parser()

VOID hwdbg_script_engine_wrapper_test_parser ( const char * Expr)

Run (test evaluation) hwdbg script.

Parameters
Expr
Returns
VOID
873{
874 std::string StrExpr = Expr; // Convert const char* to std::string
876}
VOID ScriptEngineWrapperTestParserForHwdbg(const string &Expr)
test parser for hwdbg
Definition script-engine-wrapper.cpp:752

◆ hwdbg_script_run_script()

BOOLEAN hwdbg_script_run_script ( const CHAR * script,
const CHAR * instance_filepath_to_read,
const CHAR * hardware_script_file_path_to_save,
UINT32 initial_bram_buffer_size )

Run hwdbg script.

Parameters
script
instance_filepath_to_read
hardware_script_file_path_to_save
initial_bram_buffer_size
Returns
BOOLEAN
857{
859 instance_filepath_to_read,
860 hardware_script_file_path_to_save,
861 initial_bram_buffer_size);
862}
_____________________________________________________________ salam khobi salam khobi _____________________________________________________________ !monitor script
Definition command-parser-testcases.txt:12
BOOLEAN HwdbgScriptRunScript(const CHAR *Script, const TCHAR *InstanceFilePathToRead, const TCHAR *HardwareScriptFilePathToSave, UINT32 InitialBramBufferSize)
Run script in hwdbg.
Definition hwdbg-scripts.cpp:460

◆ hyperdbg_u_assemble()

BOOLEAN hyperdbg_u_assemble ( const CHAR * assembly_code,
UINT64 start_address,
PVOID buffer_to_store_assembled_data,
UINT32 buffer_size )

Assembler function.

Parameters
assembly_codeThe assembly code
start_addressThe start address of the assembly code
buffer_to_store_assembled_dataThe buffer to store the assembled data
buffer_sizeThe size of the buffer
Returns
BOOLEAN Returns true if it was successful
710{
711 return HyperDbgAssemble(assembly_code, start_address, buffer_to_store_assembled_data, buffer_size);
712}
BOOLEAN HyperDbgAssemble(const CHAR *AssemblyCode, UINT64 StartAddress, PVOID BufferToStoreAssembledData, UINT32 BufferSize)
Assembler function.
Definition assembler.cpp:234

◆ hyperdbg_u_assemble_get_length()

BOOLEAN hyperdbg_u_assemble_get_length ( const CHAR * assembly_code,
UINT64 start_address,
UINT32 * length )

Assembler function to get the length of the assembly code.

Parameters
assembly_codeThe assembly code
start_addressThe start address of the assembly code
lengthThe length of the assembly code
Returns
BOOLEAN Returns true if it was successful
694{
695 return HyperDbgAssembleGetLength(assembly_code, start_address, length);
696}
BOOLEAN HyperDbgAssembleGetLength(const CHAR *AssemblyCode, UINT64 StartAddress, UINT32 *Length)
Assembler function.
Definition assembler.cpp:196

◆ hyperdbg_u_check_multiline_command()

BOOLEAN hyperdbg_u_check_multiline_command ( CHAR * current_command,
BOOLEAN reset )

Check if the command is a multiline command or not.

Parameters
current_commandThe current command
resetIf it's true, it will reset the multiline command
Returns
BOOLEAN
329{
330 return CheckMultilineCommand(current_command, reset);
331}
BOOLEAN CheckMultilineCommand(CHAR *CurrentCommand, BOOLEAN Reset)
check for multi-line commands
Definition interpreter.cpp:1132

◆ hyperdbg_u_connect_current_debugger_using_com_port()

BOOLEAN hyperdbg_u_connect_current_debugger_using_com_port ( const CHAR * port_name,
DWORD baudrate )

Connect to the current debugger using COM port.

Parameters
port_nameThe port name
baudrateThe baudrate
Returns
BOOLEAN Returns true if it was successful
646{
647 return HyperDbgDebugCurrentDeviceUsingComPort(port_name, baudrate);
648}
BOOLEAN HyperDbgDebugCurrentDeviceUsingComPort(const CHAR *PortName, DWORD Baudrate)
Connect to a remote serial device (Debuggee).
Definition debug.cpp:171

◆ hyperdbg_u_connect_local_debugger()

VOID hyperdbg_u_connect_local_debugger ( )

Connect to the local debugger.

Returns
VOID
340{
342}
VOID ConnectLocalDebugger()
Connect to local debugger.
Definition connect.cpp:50

◆ hyperdbg_u_connect_remote_debugger()

BOOLEAN hyperdbg_u_connect_remote_debugger ( const CHAR * ip,
const CHAR * port )

Connect to the remote debugger.

Parameters
ipThe IP address of the remote debugger
portThe port of the remote debugger
Returns
BOOLEAN Returns true if it was successful
353{
354 return ConnectRemoteDebugger(ip, port);
355}
BOOLEAN ConnectRemoteDebugger(const CHAR *Ip, const CHAR *Port)
Connect to remote debugger.
Definition connect.cpp:61

◆ hyperdbg_u_connect_remote_debugger_using_com_port()

BOOLEAN hyperdbg_u_connect_remote_debugger_using_com_port ( const CHAR * port_name,
DWORD baudrate,
BOOLEAN pause_after_connection )

Connect to the remote debugger using COM port.

Parameters
port_nameThe port name
baudrateThe baudrate
pause_after_connectionPause after connection
Returns
BOOLEAN Returns true if it was successful
607{
608 return HyperDbgDebugRemoteDeviceUsingComPort(port_name, baudrate, pause_after_connection);
609}
BOOLEAN HyperDbgDebugRemoteDeviceUsingComPort(const CHAR *PortName, DWORD Baudrate, BOOLEAN PauseAfterConnection)
Connect to a remote serial device (Debugger).
Definition debug.cpp:116

◆ hyperdbg_u_connect_remote_debugger_using_named_pipe()

BOOLEAN hyperdbg_u_connect_remote_debugger_using_named_pipe ( const CHAR * named_pipe,
BOOLEAN pause_after_connection )

Connect to the remote debugger using named pipe.

Parameters
named_pipeThe named pipe
pause_after_connectionPause after connection
Returns
BOOLEAN Returns true if it was successful
621{
622 return HyperDbgDebugRemoteDeviceUsingNamedPipe(named_pipe, pause_after_connection);
623}
BOOLEAN HyperDbgDebugRemoteDeviceUsingNamedPipe(const CHAR *NamedPipe, BOOLEAN PauseAfterConnection)
Connect to a remote named pipe (Debugger).
Definition debug.cpp:157

◆ hyperdbg_u_continue_debuggee()

VOID hyperdbg_u_continue_debuggee ( )

Continue the debuggee (equal to the 'g' command).

Returns
VOID
364{
366}
VOID CommandGRequest()
Request to unpause.
Definition g.cpp:41

◆ hyperdbg_u_continue_previous_command()

BOOLEAN hyperdbg_u_continue_previous_command ( )

Some of commands like stepping commands (i, p, t) and etc. need to be repeated when the user press enter, this function shows whether we should continue the previous command or not.

Returns
TRUE means the command should be continued, FALSE means command should be ignored
316{
318}
BOOLEAN ContinuePreviousCommand()
Some of commands like stepping commands (i, p, t) and etc. need to be repeated when the user press en...
Definition interpreter.cpp:1229

◆ hyperdbg_u_debug_close_remote_debugger()

BOOLEAN hyperdbg_u_debug_close_remote_debugger ( )

Close the remote debugger.

Returns
BOOLEAN Returns true if it was successful
632{
634}
BOOLEAN HyperDbgDebugCloseRemoteDebugger()
Connect to a remote serial device (Debuggee).
Definition debug.cpp:211

◆ hyperdbg_u_detect_vmx_support()

BOOLEAN hyperdbg_u_detect_vmx_support ( )

Detects the support of VMX.

Returns
BOOLEAN Returns true if the CPU supports VMX
29{
30 return VmxSupportDetection();
31}
BOOLEAN VmxSupportDetection()
Detect whether the VMX is supported or not.
Definition common.cpp:626

◆ hyperdbg_u_disable_transparent_mode()

BOOLEAN hyperdbg_u_disable_transparent_mode ( )

Disable transparent mode.

Returns
BOOLEAN
914{
916}
BOOLEAN HyperDbgDisableTransparentMode()
Disable transparent mode.
Definition unhide.cpp:41

◆ hyperdbg_u_enable_transparent_mode()

BOOLEAN hyperdbg_u_enable_transparent_mode ( UINT32 ProcessId,
CHAR * ProcessName,
BOOLEAN IsProcessId )

Enable transparent mode.

Parameters
ProcessIdThe process ID to enable transparent mode for
ProcessNameThe process name to enable transparent mode for
IsProcessIdIf true, ProcessId is used, otherwise ProcessName is used
Returns
BOOLEAN
888{
889 return HyperDbgEnableTransparentMode(ProcessId, ProcessName, IsProcessId);
890}
BOOLEAN HyperDbgEnableTransparentMode(UINT32 ProcessId, CHAR *ProcessName, BOOLEAN IsProcessId)
Enable transparent mode.
Definition hide.cpp:382

◆ hyperdbg_u_enable_transparent_mode_ex()

BOOLEAN hyperdbg_u_enable_transparent_mode_ex ( UINT32 ProcessId,
CHAR * ProcessName,
BOOLEAN IsProcessId,
UINT32 EvadeMask )

Enable transparent mode with a feature mask.

Parameters
ProcessIdThe process ID to enable transparent mode for
ProcessNameThe process name to enable transparent mode for
IsProcessIdIf true, ProcessId is used, otherwise ProcessName is used
EvadeMaskThe transparent-mode feature mask, or zero for default behavior
Returns
BOOLEAN
903{
904 return HyperDbgEnableTransparentModeEx(ProcessId, ProcessName, IsProcessId, EvadeMask);
905}
BOOLEAN HyperDbgEnableTransparentModeEx(UINT32 ProcessId, CHAR *ProcessName, BOOLEAN IsProcessId, UINT32 EvadeMask)
Enable transparent mode.
Definition hide.cpp:235

◆ hyperdbg_u_eval_expression()

UINT64 hyperdbg_u_eval_expression ( CHAR * Expr,
PBOOLEAN HasError )

Evaluate expression and return result based on the target process (user debugger) or debuggee (kernel debugger) context.

Parameters
ExprThe expression to evaluate
HasErrorIf true, there was an error in evaluation
Returns
UINT64 The result of the evaluated expression
943{
944 return ScriptEngineEvalSingleExpression(Expr, HasError);
945}
UINT64 ScriptEngineEvalSingleExpression(string Expr, PBOOLEAN HasError)
Get the value from the evaluation of single expression from local debuggee and remote debuggee.
Definition script-engine.cpp:31

◆ hyperdbg_u_get_idt_entry()

BOOLEAN hyperdbg_u_get_idt_entry ( INTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS * idt_packet)

Get IDT entry.

Parameters
idt_packet
Returns
BOOLEAN
825{
826 return HyperDbgGetIdtEntry(idt_packet);
827}
BOOLEAN HyperDbgGetIdtEntry(INTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS *IdtPacket)
Send IDT entry requests.
Definition idt.cpp:46

◆ hyperdbg_u_get_io_apic()

BOOLEAN hyperdbg_u_get_io_apic ( IO_APIC_ENTRY_PACKETS * io_apic)

Get I/O APIC.

Parameters
io_apic
Returns
BOOLEAN
812{
813 return HyperDbgGetIoApic(io_apic);
814}
BOOLEAN HyperDbgGetIoApic(IO_APIC_ENTRY_PACKETS *IoApic)
Request to get I/O APIC.
Definition ioapic.cpp:38

◆ hyperdbg_u_get_kernel_base()

UINT64 hyperdbg_u_get_kernel_base ( )

Get the kernel base.

Returns
UINT64 The kernel base
592{
593 return DebuggerGetKernelBase();
594}
UINT64 DebuggerGetKernelBase()
Get the base address of the kernel module.
Definition debugger.cpp:698

◆ hyperdbg_u_get_local_apic()

BOOLEAN hyperdbg_u_get_local_apic ( PLAPIC_PAGE local_apic,
BOOLEAN * is_using_x2apic )

Get Local APIC.

The system automatically detects whether to read it in the xAPIC or x2APIC mode

Parameters
local_apic
is_using_x2apic
Returns
BOOLEAN
799{
800 return HyperDbgGetLocalApic(local_apic, is_using_x2apic);
801}
BOOLEAN HyperDbgGetLocalApic(PLAPIC_PAGE LocalApic, PBOOLEAN IsUsingX2APIC)
Request to get Local APIC.
Definition apic.cpp:169

◆ hyperdbg_u_get_processor_vendor()

GENERIC_PROCESSOR_VENDOR hyperdbg_u_get_processor_vendor ( )

Get the vendor of the current processor.

Returns
GENERIC_PROCESSOR_VENDOR the vendor of the processor
162{
164}
GENERIC_PROCESSOR_VENDOR HyperDbgGetProcessorVendor()
Get the vendor of the current processor.
Definition libhyperdbg.cpp:718

◆ hyperdbg_u_install_kd_driver()

INT hyperdbg_u_install_kd_driver ( )

Install the KD driver.

Returns
INT Returns 0 if it was successful and 1 if it was failed
118{
120}
INT HyperDbgInstallKdDriver()
Install KD (Kernel Debugger) driver.
Definition libhyperdbg.cpp:81

◆ hyperdbg_u_is_any_module_loaded()

BOOLEAN hyperdbg_u_is_any_module_loaded ( )

Check if any module is loaded.

Returns
BOOLEAN Returns true if any module is loaded and false if no module is loaded
63{
65}
BOOLEAN HyperDbgIsAnyModuleLoaded()
check if any module is loaded (KD, VMM, HyperTrace, etc.)
Definition libhyperdbg.cpp:604

◆ hyperdbg_u_lbr_dump()

BOOLEAN hyperdbg_u_lbr_dump ( HYPERTRACE_LBR_DUMP_PACKETS * LbrdumpRequest)

Dump LBR stack.

Parameters
LbrdumpRequestThe LBR dump request packet
Returns
BOOLEAN
956{
957 return HyperDbgLbrdumpSendRequest(LbrdumpRequest);
958}
BOOLEAN HyperDbgLbrdumpSendRequest(HYPERTRACE_LBR_DUMP_PACKETS *LbrdumpRequest)
Send LBR dump requests.
Definition lbrdump.cpp:29

◆ hyperdbg_u_load_all_modules()

INT hyperdbg_u_load_all_modules ( )

Load all modules.

Returns
INT Returns 0 if it was successful and 1 if it was failed
195{
196 return HyperDbgLoadAllModules();
197}
INT HyperDbgLoadAllModules()
load all modules (KD, VMM, HyperTrace, etc.)
Definition libhyperdbg.cpp:908

◆ hyperdbg_u_load_hypertrace_module()

INT hyperdbg_u_load_hypertrace_module ( )

Load the hypertrace module.

Returns
INT Returns 0 if it was successful and 1 if it was failed
184{
186}
INT HyperDbgLoadHyperTraceModule()
load hypertrace module
Definition libhyperdbg.cpp:838

◆ hyperdbg_u_load_kd_module()

INT hyperdbg_u_load_kd_module ( )

Load the KD module.

Returns
INT Returns 0 if it was successful and 1 if it was failed
173{
174 return HyperDbgLoadKdModule();
175}
INT HyperDbgLoadKdModule()
load kd module
Definition libhyperdbg.cpp:665

◆ hyperdbg_u_load_vmm()

INT hyperdbg_u_load_vmm ( )

Load the VMM.

Returns
INT Returns 0 if it was successful and 1 if it was failed
52{
53 return HyperDbgLoadVmmModule();
54}
INT HyperDbgLoadVmmModule()
load vmm module
Definition libhyperdbg.cpp:749

◆ hyperdbg_u_pause_debuggee()

VOID hyperdbg_u_pause_debuggee ( )

Pause the debuggee (equal to the 'pause' command).

Returns
VOID
375{
377}
VOID CommandPauseRequest()
request to pause
Definition pause.cpp:40

◆ hyperdbg_u_perform_smi_operation()

BOOLEAN hyperdbg_u_perform_smi_operation ( SMI_OPERATION_PACKETS * SmiOperation)

Perform SMI operation.

Parameters
SmiOperationThe SMI operation packet
Returns
838{
839 return HyperDbgPerformSmiOperation(SmiOperation);
840}
BOOLEAN HyperDbgPerformSmiOperation(SMI_OPERATION_PACKETS *SmiOperation)
Request to perform an SMI operation.
Definition smi.cpp:109

◆ hyperdbg_u_pt_mmap()

BOOLEAN hyperdbg_u_pt_mmap ( HYPERTRACE_PT_MMAP_PACKETS * MmapRequest)

Map the per-CPU Intel PT output buffers into the calling process.

Parameters
MmapRequestThe PT mmap request packet; filled with per-CPU { UserVa, Size } on success
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
984{
985 return HyperDbgPtMmapSendRequest(MmapRequest);
986}
BOOLEAN HyperDbgPtMmapSendRequest(HYPERTRACE_PT_MMAP_PACKETS *MmapRequest)
Map the per-CPU PT output buffers into the current process.
Definition pt.cpp:151

◆ hyperdbg_u_pt_operation()

BOOLEAN hyperdbg_u_pt_operation ( HYPERTRACE_PT_OPERATION_PACKETS * PtRequest)

Perform an Intel PT operation (enable / disable / pause / resume / size / dump / flush / filter).

Parameters
PtRequestThe PT operation request packet
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
970{
971 return HyperDbgPerformPtOperation(PtRequest);
972}
BOOLEAN HyperDbgPerformPtOperation(HYPERTRACE_PT_OPERATION_PACKETS *PtRequest)
Request to perform an PT operation.
Definition pt.cpp:134

◆ hyperdbg_u_read_all_registers()

BOOLEAN hyperdbg_u_read_all_registers ( GUEST_REGS * guest_registers,
GUEST_EXTRA_REGISTERS * extra_registers )

Read all registers.

Parameters
guest_registersThe buffer to store the registers
extra_registersThe buffer to store the extra registers
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
512{
513 return HyperDbgReadAllRegisters(guest_registers, extra_registers);
514}
BOOLEAN HyperDbgReadAllRegisters(GUEST_REGS *GuestRegisters, GUEST_EXTRA_REGISTERS *ExtraRegisters)
Read all registers.
Definition r.cpp:175

◆ hyperdbg_u_read_memory()

BOOLEAN hyperdbg_u_read_memory ( UINT64 target_address,
DEBUGGER_READ_MEMORY_TYPE memory_type,
DEBUGGER_READ_READING_TYPE reading_Type,
UINT32 pid,
UINT32 size,
BOOLEAN get_address_mode,
DEBUGGER_READ_MEMORY_ADDRESS_MODE * address_mode,
BYTE * target_buffer_to_store,
UINT32 * return_length )

Read memory and disassembler.

Parameters
target_addresslocation of where to read the memory
memory_typetype of memory (phyical or virtual)
reading_Typeread from kernel or vmx-root
pidThe target process id
sizesize of memory to read
get_address_modecheck for address mode
address_modeAddress mode (32 or 64)
target_buffer_to_storeThe buffer to store the read memory
return_lengthThe length of the read memory
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
474{
475 return HyperDbgReadMemory(target_address, memory_type, reading_Type, pid, size, get_address_mode, address_mode, target_buffer_to_store, return_length);
476}
BOOLEAN HyperDbgReadMemory(UINT64 TargetAddress, DEBUGGER_READ_MEMORY_TYPE MemoryType, DEBUGGER_READ_READING_TYPE ReadingType, UINT32 Pid, UINT32 Size, BOOLEAN GetAddressMode, DEBUGGER_READ_MEMORY_ADDRESS_MODE *AddressMode, BYTE *TargetBufferToStore, UINT32 *ReturnLength)
Read memory and disassembler.
Definition readmem.cpp:37

◆ hyperdbg_u_read_target_register()

BOOLEAN hyperdbg_u_read_target_register ( REGS_ENUM register_id,
UINT64 * target_register )

Read target register.

Parameters
register_idThe target register
target_registerThe buffer to store the register
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
525{
526 return HyperDbgReadTargetRegister(register_id, target_register);
527}
BOOLEAN HyperDbgReadTargetRegister(REGS_ENUM RegisterId, UINT64 *TargetRegister)
Read target register.
Definition r.cpp:268

◆ hyperdbg_u_read_vendor_string()

VOID hyperdbg_u_read_vendor_string ( CHAR * vendor_string)

Read the vendor string of the CPU.

Parameters
vendor_stringThe buffer to store the vendor string
Returns
VOID
41{
42 CpuReadVendorString(vendor_string);
43}
VOID CpuReadVendorString(CHAR *Result)
Reads the CPU vendor string.
Definition cpu.cpp:252

◆ hyperdbg_u_run_command()

INT hyperdbg_u_run_command ( CHAR * command)

Run a command.

Returns
INT Returns 0 if it was successful and 1 if it was failed
206{
207 return HyperDbgInterpreter(command);
208}
INT HyperDbgInterpreter(CHAR *Command)
Interpret commands.
Definition interpreter.cpp:800

◆ hyperdbg_u_run_script()

BOOLEAN hyperdbg_u_run_script ( CHAR * Expr,
BOOLEAN ShowErrorMessageIfAny )

Run HyperDbg scripts in the target process (user debugger) or debuggee (kernel debugger).

Parameters
ExprThe expression to run
ShowErrorMessageIfAnyIf true, show error message if any
Returns
BOOLEAN
928{
929 return ScriptEngineExecuteSingleExpression(Expr, ShowErrorMessageIfAny, FALSE);
930}
#define FALSE
Definition BasicTypes.h:113
BOOLEAN ScriptEngineExecuteSingleExpression(CHAR *Expr, BOOLEAN ShowErrorMessageIfAny, BOOLEAN IsFormat)
Execute single expression for the kernel debugger and the user-mode debugger.
Definition script-engine.cpp:100

◆ hyperdbg_u_script_read_file_and_execute_commandline()

INT hyperdbg_u_script_read_file_and_execute_commandline ( INT argc,
CHAR * argv[] )

Parsing the command line options for scripts.

Parameters
argc
argv
Returns
INT
302{
304}
INT HyperDbgScriptReadFileAndExecuteCommandline(INT argc, CHAR *argv[])
Parsing the command line options for scripts.
Definition script.cpp:225
char ** argv
Definition symbol-parser.h:47

◆ hyperdbg_u_set_breakpoint()

BOOLEAN hyperdbg_u_set_breakpoint ( UINT64 address,
UINT32 pid,
UINT32 tid,
UINT32 core_number )

Set a breakpoint.

Parameters
addressThe address of the breakpoint
pidThe process ID of the breakpoint
tidThe thread ID of the breakpoint
core_numberThe core number of the breakpoint
Returns
BOOLEAN
390{
391 return CommandBpRequest(address, pid, tid, core_number);
392}
BOOLEAN CommandBpRequest(UINT64 Address, UINT32 Pid, UINT32 Tid, UINT32 CoreNumer)
request breakpoint
Definition bp.cpp:119

◆ hyperdbg_u_set_custom_driver_path()

BOOLEAN hyperdbg_u_set_custom_driver_path ( CHAR * driver_file_path,
CHAR * driver_name )

Set custom driver path.

Parameters
driver_file_pathThe path of the driver
driver_nameThe name of the driver
Returns
BOOLEAN Returns true if it was successful
404{
405 if (strlen(driver_file_path) > MAX_PATH)
406 {
407 ShowMessages("The driver path is too long, the maximum length is %d\n", MAX_PATH);
408 return FALSE;
409 }
410
411 if (strlen(driver_name) > MAX_PATH)
412 {
413 ShowMessages("The driver name is too long, the maximum length is %d\n", MAX_PATH);
414 return FALSE;
415 }
416
417 //
418 // Copy the driver path
419 //
420 strcpy_s(g_DriverLocation, MAX_PATH, driver_file_path);
421
422 //
423 // Copy the driver name
424 //
425 strcpy_s(g_DriverName, MAX_PATH, driver_name);
426
427 //
428 // Set the flag to use the custom driver path
429 //
431
432 return TRUE;
433}
#define TRUE
Definition BasicTypes.h:114
TCHAR g_DriverLocation[MAX_PATH]
Holds the location driver to install it.
Definition globals.h:433
TCHAR g_DriverName[MAX_PATH]
Holds the name of the driver to install it.
Definition globals.h:439
BOOLEAN g_UseCustomDriverLocation
Whether the user wants to use a custom driver location or not.
Definition globals.h:445

◆ hyperdbg_u_set_text_message_callback()

VOID hyperdbg_u_set_text_message_callback ( PVOID handler)

Set the function callback that will be called if any message needs to be shown (by passing message as a parameter).

Parameters
handlerFunction that handles the messages
Returns
VOID
263{
264 SetTextMessageCallback(handler);
265}
VOID SetTextMessageCallback(PVOID Handler)
Set the function callback that will be called if any message needs to be shown.
Definition messaging.cpp:33

◆ hyperdbg_u_set_text_message_callback_using_shared_buffer()

PVOID hyperdbg_u_set_text_message_callback_using_shared_buffer ( PVOID handler)

Set the function callback that will be called if any message needs to be shown (using shared buffer method).

Parameters
handlerFunction that handles the messages
Returns
PVOID
277{
279}
PVOID SetTextMessageCallbackUsingSharedBuffer(PVOID Handler)
Set the function callback that will be called if any message needs to be shown.
Definition messaging.cpp:46

◆ hyperdbg_u_setup_path_for_filename()

BOOLEAN hyperdbg_u_setup_path_for_filename ( const CHAR * filename,
CHAR * file_location,
UINT32 buffer_len,
BOOLEAN check_file_existence )

Setip the path for the filename.

Parameters
filenameThe filename
file_location
buffer_len
check_file_existence
Returns
BOOLEAN
726{
727 return SetupPathForFileName(filename, file_location, buffer_len, check_file_existence);
728}
BOOLEAN SetupPathForFileName(const CHAR *FileName, _Inout_updates_bytes_all_(BufferLength) PCHAR FileLocation, ULONG BufferLength, BOOLEAN CheckFileExists)
Setup file name.
Definition install.cpp:472

◆ hyperdbg_u_show_all_registers()

BOOLEAN hyperdbg_u_show_all_registers ( )

Show all registers.

Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
549{
551}
BOOLEAN HyperDbgRegisterShowAll()
handler of r show all registers
Definition r.cpp:354

◆ hyperdbg_u_show_memory_or_disassemble()

VOID hyperdbg_u_show_memory_or_disassemble ( DEBUGGER_SHOW_MEMORY_STYLE style,
UINT64 address,
DEBUGGER_READ_MEMORY_TYPE memory_type,
DEBUGGER_READ_READING_TYPE reading_type,
UINT32 pid,
UINT32 size,
PDEBUGGER_DT_COMMAND_OPTIONS dt_details )

Show memory or disassembler.

Parameters
stylestyle of show memory (as byte, dwrod, qword)
addresslocation of where to read the memory
memory_typetype of memory (phyical or virtual)
reading_typeread from kernel or vmx-root
pidThe target process id
sizesize of memory to read
dt_detailsOptions for dt structure show details
Returns
VOID
499{
500 HyperDbgShowMemoryOrDisassemble(style, address, memory_type, reading_type, pid, size, dt_details);
501}
VOID HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_MEMORY_STYLE Style, UINT64 Address, DEBUGGER_READ_MEMORY_TYPE MemoryType, DEBUGGER_READ_READING_TYPE ReadingType, UINT32 Pid, UINT32 Size, PDEBUGGER_DT_COMMAND_OPTIONS DtDetails)
Show memory or disassembler.
Definition readmem.cpp:193

◆ hyperdbg_u_show_signature()

VOID hyperdbg_u_show_signature ( )

Show the signature of the debugger.

Returns
VOID
249{
251}
VOID HyperDbgShowSignature()
Show signature of HyperDbg.
Definition interpreter.cpp:1086

◆ hyperdbg_u_show_target_register()

BOOLEAN hyperdbg_u_show_target_register ( REGS_ENUM register_id)

Show target register.

Parameters
register_idThe target register
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
561{
562 return HyperDbgRegisterShowTargetRegister(register_id);
563}
BOOLEAN HyperDbgRegisterShowTargetRegister(REGS_ENUM RegisterId)
handler of r show the target register
Definition r.cpp:424

◆ hyperdbg_u_start_kd_driver()

INT hyperdbg_u_start_kd_driver ( )

Start the KD driver.

Returns
INT Returns 0 if it was successful and 1 if it was failed
140{
141 return HyperDbgStartKdDriver();
142}
INT HyperDbgStartKdDriver()
Start KD driver.
Definition libhyperdbg.cpp:133

◆ hyperdbg_u_start_process()

BOOLEAN hyperdbg_u_start_process ( const WCHAR * path)

Start a new process.

Parameters
pathThe path of the process
Returns
BOOLEAN Returns true if it was successful
659{
660 return UdAttachToProcess(NULL,
661 path,
662 NULL,
663 FALSE);
664}
BOOLEAN UdAttachToProcess(UINT32 TargetPid, const WCHAR *TargetFileAddress, const WCHAR *CommandLine, BOOLEAN RunCallbackAtTheFirstInstruction)
Attach to target process.
Definition ud.cpp:372

◆ hyperdbg_u_start_process_with_args()

BOOLEAN hyperdbg_u_start_process_with_args ( const WCHAR * path,
const WCHAR * arguments )

Start a new process.

Parameters
pathThe path of the process
argumentsThe arguments of the process
Returns
BOOLEAN Returns true if it was successful
676{
677 return UdAttachToProcess(NULL,
678 path,
679 arguments,
680 FALSE);
681}

◆ hyperdbg_u_stepping_instrumentation_step_in()

BOOLEAN hyperdbg_u_stepping_instrumentation_step_in ( )

Perform instrumentation step-in.

Returns
BOOLEAN
737{
739}
BOOLEAN SteppingInstrumentationStepIn()
Perform Instrumentation Step-in.
Definition steppings.cpp:26

◆ hyperdbg_u_stepping_instrumentation_step_in_for_tracking()

BOOLEAN hyperdbg_u_stepping_instrumentation_step_in_for_tracking ( )

Perform instrumentation step-in for tracking.

Returns
BOOLEAN
770{
772}
BOOLEAN SteppingInstrumentationStepInForTracking()
Perform Instrumentation Step-in for Tracking.
Definition steppings.cpp:53

◆ hyperdbg_u_stepping_regular_step_in()

BOOLEAN hyperdbg_u_stepping_regular_step_in ( )

Perform regular step-in.

Returns
BOOLEAN
748{
749 return SteppingRegularStepIn();
750}
BOOLEAN SteppingRegularStepIn()
Perform Regular Step-in.
Definition steppings.cpp:80

◆ hyperdbg_u_stepping_step_over()

BOOLEAN hyperdbg_u_stepping_step_over ( )

Perform step-over.

Returns
BOOLEAN
759{
760 return SteppingStepOver();
761}
BOOLEAN SteppingStepOver()
Perform Step-over.
Definition steppings.cpp:117

◆ hyperdbg_u_stepping_step_over_for_gu()

BOOLEAN hyperdbg_u_stepping_step_over_for_gu ( BOOLEAN last_instruction)

Perform step-over for gu.

Parameters
last_instruction
Returns
BOOLEAN
783{
784 return SteppingStepOverForGu(last_instruction);
785}
BOOLEAN SteppingStepOverForGu(BOOLEAN LastInstruction)
Perform Step-over for GU.
Definition steppings.cpp:155

◆ hyperdbg_u_stop_kd_driver()

INT hyperdbg_u_stop_kd_driver ( )

Stop the KD driver.

Returns
INT Returns 0 if it was successful and 1 if it was failed
151{
152 return HyperDbgStopKdDriver();
153}
INT HyperDbgStopKdDriver()
Stop KD driver.
Definition libhyperdbg.cpp:144

◆ hyperdbg_u_test_command_parser()

BOOLEAN hyperdbg_u_test_command_parser ( CHAR * command,
UINT32 number_of_tokens,
CHAR ** tokens_list,
UINT32 * failed_token_num,
UINT32 * failed_token_position )

Parse the command (used for testing purposes).

Parameters
commandThe text of command
number_of_tokensThe number of tokens
tokens_listThe list of tokens
Returns
BOOLEAN returns true if the command was parsed successfully and false if there was an error
225{
226 return HyperDbgTestCommandParser(command, number_of_tokens, tokens_list, failed_token_num, failed_token_position);
227}
BOOLEAN HyperDbgTestCommandParser(CHAR *Command, UINT32 NumberOfTokens, CHAR **TokensList, UINT32 *FailedTokenNum, UINT32 *FailedTokenPosition)
Parse the command (used for testing purposes).
Definition interpreter.cpp:712

◆ hyperdbg_u_test_command_parser_show_tokens()

VOID hyperdbg_u_test_command_parser_show_tokens ( CHAR * command)

Parse and show tokens for the command (used for testing purposes).

Parameters
commandThe text of command
Returns
VOID
238{
240}
VOID HyperDbgTestCommandParserShowTokens(CHAR *Command)
Parse the command and show tokens (used for testing purposes).
Definition interpreter.cpp:775

◆ hyperdbg_u_uninstall_kd_driver()

INT hyperdbg_u_uninstall_kd_driver ( )

Uninstall the KD (Kernel Debugger) driver.

Returns
INT Returns 0 if it was successful and 1 if it was failed
129{
131}
INT HyperDbgUninstallKdDriver()
Remove the KD (Kernel Debugger) driver.
Definition libhyperdbg.cpp:178

◆ hyperdbg_u_unload_all_modules()

INT hyperdbg_u_unload_all_modules ( )

Unload all modules.

Returns
INT Returns 0 if it was successful and 1 if it was failed
74{
76}
INT HyperDbgUnloadAllModules()
unload all modules (KD, VMM, HyperTrace, etc.)
Definition libhyperdbg.cpp:628

◆ hyperdbg_u_unload_hypertrace_module()

INT hyperdbg_u_unload_hypertrace_module ( )

Unload the trace module.

Returns
INT Returns 0 if it was successful and 1 if it was failed
96{
98}
INT HyperDbgUnloadHyperTrace()
Unload HyperTrace module.
Definition libhyperdbg.cpp:457

◆ hyperdbg_u_unload_kd()

INT hyperdbg_u_unload_kd ( )

Unload the KD module.

Returns
INT Returns 0 if it was successful and 1 if it was failed
107{
108 return HyperDbgUnloadKd();
109}
INT HyperDbgUnloadKd()
Unload KD driver.
Definition libhyperdbg.cpp:505

◆ hyperdbg_u_unload_vmm()

INT hyperdbg_u_unload_vmm ( )

Unload the VMM module.

Returns
INT Returns 0 if it was successful and 1 if it was failed
85{
86 return HyperDbgUnloadVmm();
87}
INT HyperDbgUnloadVmm()
Unload VMM module.
Definition libhyperdbg.cpp:388

◆ hyperdbg_u_unset_text_message_callback()

VOID hyperdbg_u_unset_text_message_callback ( )

Unset the function callback that will be called if any message needs to be shown.

Returns
VOID
289{
291}
VOID UnsetTextMessageCallback()
Unset the function callback that will be called if any message needs to be shown.
Definition messaging.cpp:69

◆ hyperdbg_u_use_default_driver_path()

VOID hyperdbg_u_use_default_driver_path ( )

Use the default driver path.

Returns
VOID
442{
443 //
444 // Set the flag to use the default driver path
445 //
447}

◆ hyperdbg_u_write_memory()

BOOLEAN hyperdbg_u_write_memory ( PVOID destination_address,
DEBUGGER_EDIT_MEMORY_TYPE memory_type,
UINT32 process_id,
PVOID source_address,
UINT32 number_of_bytes )

Write memory.

Parameters
destination_addressThe destination address
memory_typeThe type of memory (physical or virtual)
process_idThe target process id (if it's virtual memory)
source_addressThe source address
number_of_bytesThe number of bytes to write
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
581{
582 return HyperDbgWriteMemory(destination_address, memory_type, process_id, source_address, number_of_bytes);
583}
BOOLEAN HyperDbgWriteMemory(PVOID DestinationAddress, DEBUGGER_EDIT_MEMORY_TYPE MemoryType, UINT32 ProcessId, PVOID SourceAddress, UINT32 NumberOfBytes)
API function for writing the memory content.
Definition e.cpp:196

◆ hyperdbg_u_write_target_register()

BOOLEAN hyperdbg_u_write_target_register ( REGS_ENUM register_id,
UINT64 value )

Write target register.

Parameters
register_idThe target register
valueThe value to write
Returns
BOOLEAN TRUE if the operation was successful, otherwise FALSE
538{
539 return HyperDbgWriteTargetRegister(register_id, value);
540}
BOOLEAN HyperDbgWriteTargetRegister(REGS_ENUM RegisterId, UINT64 Value)
Write target register.
Definition r.cpp:322

Variable Documentation

◆ g_DriverLocation

TCHAR g_DriverLocation[MAX_PATH]
extern

Holds the location driver to install it.

433{0};

◆ g_DriverName

TCHAR g_DriverName[MAX_PATH]
extern

Holds the name of the driver to install it.

439{0};

◆ g_UseCustomDriverLocation

BOOLEAN g_UseCustomDriverLocation
extern

Whether the user wants to use a custom driver location or not.