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

Headers for management of global variables. More...

Go to the source code of this file.

Functions

BOOLEAN GlobalDebuggingStateAllocateZeroedMemory (VOID)
 Allocate debugging state memory.
 
BOOLEAN GlobalEventsAllocateZeroedMemory (VOID)
 Allocate event store memory.
 
VOID GlobalEventsFreeMemory (VOID)
 Free event store memory.
 
VOID GlobalDebuggingStateFreeMemory (VOID)
 Free debugging state memory.
 

Detailed Description

Headers for management of global variables.

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

Function Documentation

◆ GlobalDebuggingStateAllocateZeroedMemory()

BOOLEAN GlobalDebuggingStateAllocateZeroedMemory ( VOID )

Allocate debugging state memory.

Returns
BOOLEAN
22{
23 SSIZE_T BufferSizeInByte = sizeof(PROCESSOR_DEBUGGING_STATE) * KeQueryActiveProcessorCount(0);
24
25 //
26 // Allocate global variable to hold Debugging(s) state
27 //
29
30 if (!g_DbgState)
31 {
32 //
33 // we use DbgPrint as the vmx-root or non-root is not initialized
34 //
35
36 LogInfo("err, insufficient memory for allocating debugging state\n");
37 return FALSE;
38 }
39
40 return TRUE;
41}
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
#define LogInfo(format,...)
Define log variables.
Definition HyperDbgHyperLogIntrinsics.h:71
PVOID PlatformMemAllocateZeroedNonPagedPool(SIZE_T NumberOfBytes)
Allocate a non-paged buffer (zeroed)
Definition Mem.c:69
struct _PROCESSOR_DEBUGGING_STATE PROCESSOR_DEBUGGING_STATE
Saves the debugger state.
PROCESSOR_DEBUGGING_STATE * g_DbgState
Save the state and variables related to debugging on each to logical core.
Definition Global.h:17

◆ GlobalDebuggingStateFreeMemory()

VOID GlobalDebuggingStateFreeMemory ( VOID )

Free debugging state memory.

Returns
VOID
50{
53}
VOID PlatformMemFreePool(PVOID BufferAddress)
Free (dellocate) a non-paged buffer.
Definition Mem.c:86
NULL()
Definition test-case-generator.py:530

◆ GlobalEventsAllocateZeroedMemory()

BOOLEAN GlobalEventsAllocateZeroedMemory ( VOID )

Allocate event store memory.

Returns
BOOLEAN
62{
63 //
64 // Allocate buffer for saving events
65 //
66 if (!g_Events)
67 {
69 }
70
71 if (g_Events)
72 {
73 //
74 // Zero the buffer
75 //
76 RtlZeroBytes(g_Events, sizeof(DEBUGGER_CORE_EVENTS));
77 }
78
79 return g_Events != NULL;
80}
PVOID PlatformMemAllocateNonPagedPool(SIZE_T NumberOfBytes)
Allocate a non-paged buffer.
Definition Mem.c:41
DEBUGGER_CORE_EVENTS * g_Events
events list (for debugger)
Definition Global.h:48
List of all the different events.
Definition Debugger.h:37

◆ GlobalEventsFreeMemory()

VOID GlobalEventsFreeMemory ( VOID )

Free event store memory.

Returns
VOID
89{
90 if (g_Events != NULL)
91 {
93 g_Events = NULL;
94 }
95}