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

The functions used in loading the VMM and RM. More...

#include "pch.h"

Functions

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

Detailed Description

The functions used in loading the 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:55
#define FALSE
Definition BasicTypes.h:54
BOOLEAN LogCallbackSendMessageToQueue(UINT32 OperationCode, BOOLEAN IsImmediateMessage, CHAR *LogMessage, UINT32 BufferLen, BOOLEAN Priority)
routines callback for sending message to queue
Definition Callback.c:71
BOOLEAN LogCallbackCheckIfBufferIsFull(BOOLEAN Priority)
routines callback for checking if buffer is full
Definition Callback.c:100
BOOLEAN LogCallbackSendBuffer(_In_ UINT32 OperationCode, _In_reads_bytes_(BufferLength) PVOID Buffer, _In_ UINT32 BufferLength, _In_ BOOLEAN Priority)
routines callback for sending buffer
Definition Callback.c:123
BOOLEAN CoreInitReversingMachine()
Initialize the reversing machine.
Definition Core.c:19
BOOLEAN VmFuncVmxGetCurrentExecutionMode()
Get the current VMX operation state.
Definition Export.c:552
BOOLEAN VmFuncInitVmm(VMM_CALLBACKS *VmmCallbacks)
Initializes hypervisor.
Definition Export.c:530
#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
BOOLEAN LogInitialize(MESSAGE_TRACING_CALLBACKS *MsgTracingCallbacks)
Initialize the buffer relating to log message tracing.
Definition Logging.c:98
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:976
BOOLEAN g_AllowIOCTLFromUsermode
Determines whether the clients are allowed to send IOCTL to the drive or not.
Definition Global.h:42
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:36
Prototype of each function needed by message tracer.
Definition HyperLog.h:49
CHECK_VMX_OPERATION VmxOperationCheck
Definition HyperLog.h:50
Prototype of each function needed by VMM module.
Definition VMM.h:181
LOG_CALLBACK_SEND_BUFFER LogCallbackSendBuffer
Definition VMM.h:187
LOG_CALLBACK_CHECK_IF_BUFFER_IS_FULL LogCallbackCheckIfBufferIsFull
Definition VMM.h:188
LOG_CALLBACK_PREPARE_AND_SEND_MESSAGE_TO_QUEUE LogCallbackPrepareAndSendMessageToQueueWrapper
Definition VMM.h:185
LOG_CALLBACK_SEND_MESSAGE_TO_QUEUE LogCallbackSendMessageToQueue
Definition VMM.h:186

◆ LoaderUninitializeLogTracer()

VOID LoaderUninitializeLogTracer ( )

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}
VOID LogUnInitialize()
Uninitialize the buffer relating to log message tracing.
Definition Logging.c:211