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

Management of global variables. More...

#include "pch.h"

Functions

BOOLEAN GlobalGuestStateAllocateZeroedMemory (VOID)
 Allocate guest state memory.
 
VOID GlobalGuestStateFreeMemory (VOID)
 Free guest state memory.
 

Detailed Description

Management of global variables.

Author
Behrooz Abbassi (Behro.nosp@m.ozAb.nosp@m.bassi.nosp@m.@hyp.nosp@m.erdbg.nosp@m..org)
Version
0.1
Date
2022-03-29

Function Documentation

◆ GlobalGuestStateAllocateZeroedMemory()

BOOLEAN GlobalGuestStateAllocateZeroedMemory ( VOID )

Allocate guest state memory.

Returns
BOOLEAN
21{
22 SSIZE_T BufferSizeInByte = sizeof(VIRTUAL_MACHINE_STATE) * KeQueryActiveProcessorCount(0);
23
24 //
25 // Allocate global variable to hold Guest(s) state
26 //
27 if (!g_GuestState)
28 {
30
31 if (!g_GuestState)
32 {
33 LogError("Err, insufficient memory\n");
34 return FALSE;
35 }
36 }
37
38 //
39 // Zero the memory
40 //
41 RtlZeroMemory(g_GuestState, BufferSizeInByte);
42
43 return TRUE;
44}
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
VIRTUAL_MACHINE_STATE * g_GuestState
Save the state and variables related to virtualization on each to logical core.
Definition GlobalVariables.h:38
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
PVOID PlatformMemAllocateNonPagedPool(SIZE_T NumberOfBytes)
Allocate a non-paged buffer.
Definition Mem.c:41
struct _VIRTUAL_MACHINE_STATE VIRTUAL_MACHINE_STATE
The status of each core after and before VMX.

◆ GlobalGuestStateFreeMemory()

VOID GlobalGuestStateFreeMemory ( VOID )

Free guest state memory.

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