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

Routines for perform initial VMM and RM. More...

Go to the source code of this file.

Functions

VOID LoaderUninitLogTracer ()
 Uninitialize the log tracer.
BOOLEAN LoaderInitVmmAndReversingMachine ()
 Initialize the VMM and Reversing Machine.

Detailed Description

Routines for perform initial VMM and RM.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.2
Date
2023-01-29

Function Documentation

◆ LoaderInitVmmAndReversingMachine()

BOOLEAN LoaderInitVmmAndReversingMachine ( )

Initialize the VMM and Reversing Machine.

Returns
BOOLEAN
20{
21 MESSAGE_TRACING_CALLBACKS MsgTracingCallbacks = {0};
22 VMM_CALLBACKS VmmCallbacks = {0};
23
24 //
25 // Allow to server IOCTL
26 //
28
29 //
30 // Fill the callbacks for the message tracer
31 //
33 // MsgTracingCallbacks.CheckImmediateMessageSending = KdCheckImmediateMessagingMechanism;
34 // MsgTracingCallbacks.SendImmediateMessage = KdLoggingResponsePacketToDebugger;
35
36 //
37 // Fill the callbacks for using hyperlog in VMM
38 //
43
44 //
45 // Fill the VMM callbacks
46 //
47 // VmmCallbacks.VmmCallbackTriggerEvents = DebuggerTriggerEvents;
48
49 //
50 // Initialize message tracer
51 //
52 if (LogInitialize(&MsgTracingCallbacks))
53 {
54 //
55 // Initialize Vmx
56 //
57 if (VmFuncInitVmm(&VmmCallbacks))
58 {
59 LogDebugInfo("HyperDbg's hypervisor loaded successfully");
60
61 //
62 // Initialize the debugger
63 //
65 {
66 LogDebugInfo("HyperDbg's reversing machine loaded successfully");
67
68 //
69 // Set the variable so no one else can get a handle anymore
70 //
72
73 return TRUE;
74 }
75 else
76 {
77 LogError("Err, HyperDbg's debugger was not loaded");
78 }
79 }
80 else
81 {
82 LogError("Err, HyperDbg's hypervisor was not loaded");
83 }
84 }
85 else
86 {
87 LogError("Err, HyperDbg's message tracing module was not loaded");
88 }
89
90 //
91 // Not loaded
92 //
94
95 return FALSE;
96}
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
IMPORT_EXPORT_HYPERLOG BOOLEAN LogCallbackSendBuffer(_In_ UINT32 OperationCode, _In_reads_bytes_(BufferLength) PVOID Buffer, _In_ UINT32 BufferLength, _In_ BOOLEAN Priority)
routines callback for sending buffer
Definition HyperLogCallback.c:123
IMPORT_EXPORT_HYPERLOG BOOLEAN LogCallbackCheckIfBufferIsFull(BOOLEAN Priority)
Checks whether the priority or regular buffer is full or not.
Definition Logging.c:262
IMPORT_EXPORT_HYPERLOG BOOLEAN LogInitialize(MESSAGE_TRACING_CALLBACKS *MsgTracingCallbacks)
Initialize the buffer relating to log message tracing.
Definition Logging.c:98
IMPORT_EXPORT_HYPERLOG BOOLEAN LogCallbackSendMessageToQueue(UINT32 OperationCode, BOOLEAN IsImmediateMessage, CHAR *LogMessage, UINT32 BufferLen, BOOLEAN Priority)
Send string messages and tracing for logging and monitoring.
Definition Logging.c:1214
IMPORT_EXPORT_HYPERLOG BOOLEAN LogCallbackPrepareAndSendMessageToQueueWrapper(UINT32 OperationCode, BOOLEAN IsImmediateMessage, BOOLEAN ShowCurrentSystemTime, BOOLEAN Priority, const CHAR *Fmt, va_list ArgList)
Prepare a printf-style message mapping and send string messages and tracing for logging and monitorin...
Definition Logging.c:987
#define LogDebugInfo(format,...)
Log, initialize boot information and debug information.
Definition HyperDbgHyperLogIntrinsics.h:155
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
IMPORT_EXPORT_VMM BOOLEAN VmFuncVmxGetCurrentExecutionMode()
Get the current VMX operation state.
Definition Export.c:802
IMPORT_EXPORT_VMM BOOLEAN VmFuncInitVmm(VMM_CALLBACKS *VmmCallbacks)
Initializes hypervisor.
Definition Export.c:780
struct _MESSAGE_TRACING_CALLBACKS MESSAGE_TRACING_CALLBACKS
Prototype of each function needed by message tracer.
struct _VMM_CALLBACKS VMM_CALLBACKS
Prototype of each function needed by VMM module.
BOOLEAN CoreInitReversingMachine()
Initialize the reversing machine.
Definition Core.c:19
BOOLEAN g_HandleInUse
Determines whether the one application gets the handle or not this is used to ensure that only one ap...
Definition Global.h:18
BOOLEAN g_VmmInitialized
Shows whether the VMM is initialized or not.
Definition Global.h:24
CHECK_VMX_OPERATION VmxOperationCheck
Definition HyperLog.h:50
LOG_CALLBACK_SEND_BUFFER LogCallbackSendBuffer
Definition VMM.h:188
LOG_CALLBACK_CHECK_IF_BUFFER_IS_FULL LogCallbackCheckIfBufferIsFull
Definition VMM.h:189
LOG_CALLBACK_PREPARE_AND_SEND_MESSAGE_TO_QUEUE LogCallbackPrepareAndSendMessageToQueueWrapper
Definition VMM.h:186
LOG_CALLBACK_SEND_MESSAGE_TO_QUEUE LogCallbackSendMessageToQueue
Definition VMM.h:187

◆ LoaderUninitLogTracer()

VOID LoaderUninitLogTracer ( )

Uninitialize the log tracer.

Returns
VOID
105{
106 LogDebugInfo("Unloading HyperDbg's debugger...\n");
107
108#if !UseDbgPrintInsteadOfUsermodeMessageTracking
109
110 //
111 // Uinitialize log buffer
112 //
113 LogDebugInfo("Uninitializing logs\n");
115#endif
116}
IMPORT_EXPORT_HYPERLOG VOID LogUnInitialize()
Uninitialize the buffer relating to log message tracing.
Definition Logging.c:211