HyperDbg Debugger
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1
12#pragma once
13
15// Module Loading Status //
17
23
29
35
37// Feature Indicators //
39
45
51
53// Interpreter Variables //
55
60
65
70
72// Remote and Local Connection //
74
83
90
97
104
112
119SOCKET g_SeverSocket = {0};
120
126
132string g_ServerPort = "";
133
139string g_ServerIp = "";
140
147
153
160
167
174
181
183// User Debugging Variables //
185
190
196
199
201// Serial Debugging Variables //
203
212
218
221
227
233
240
247
254
261
267
273
280
286
293
300
306
313
320#ifdef _WIN32
323
324OVERLAPPED g_OverlappedIoStructureForReadDebuggee = {0};
325#endif // _WIN32
326
332
334// Global Variables //
336
343
349
355
361
367
373
379
386
393
401
410LIST_ENTRY g_EventTrace = {0};
411
419
427LIST_ENTRY g_OutputSources = {0};
428
433TCHAR g_DriverLocation[MAX_PATH] = {0};
434
439TCHAR g_DriverName[MAX_PATH] = {0};
440
446
451TCHAR g_TestLocation[MAX_PATH] = {0};
452
461
467
473
482
489
495
503
510
517
522std::map<UINT64, LOCAL_FUNCTION_DESCRIPTION> g_DisassemblerSymbolMap;
523
531
536UINT64 g_CpuidAverage = 0;
537
543
548UINT64 g_CpuidMedian = 0;
549
554UINT64 g_RdtscAverage = 0;
555
561
566UINT64 g_RdtscMedian = 0;
567
572
577
579// Settings //
581
588
595
602
609
611// Symbol Table //
613
620
627
634
641
648
650// User mode Debugging //
652
657std::wstring g_StartCommandPath = L"";
658
664
666// Script engine tests //
668
675
682
684// hwdbg //
686
692
698
703std::vector<UINT32> g_HwdbgPortConfiguration;
704
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest).
Definition globals.h:253
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
State of active debugging thread.
Definition globals.h:372
BOOLEAN g_IsExecutingSymbolLoadingRoutines
Executing symbol reloading or downloading routines.
Definition globals.h:516
BOOLEAN g_IgnorePauseRequests
Show whether the pause request (CTRL+C or CTRL+BREAK) should be ignored or not.
Definition globals.h:180
UCHAR BOOLEAN
Definition BasicTypes.h:35
void * PVOID
Definition BasicTypes.h:56
unsigned char BYTE
Definition BasicTypes.h:40
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
unsigned int UINT32
Definition BasicTypes.h:54
unsigned long ULONG
Definition BasicTypes.h:31
#define TCP_END_OF_BUFFER_CHARS_COUNT
count of characters for tcp end of buffer
Definition Constants.h:442
#define SERIAL_END_OF_BUFFER_CHAR_4
Definition Constants.h:437
#define DebuggerOutputSourceTagStartSeed
The seeds that user-mode codes use as the starter of their output source tag.
Definition Constants.h:244
#define SERIAL_END_OF_BUFFER_CHAR_2
Definition Constants.h:435
#define SERIAL_END_OF_BUFFER_CHAR_1
characters of the buffer that we set at the end of buffers for serial
Definition Constants.h:434
#define DEBUGGER_DEBUGGEE_IS_RUNNING_NO_CORE
Apply the event to all the cores.
Definition Constants.h:733
#define SERIAL_END_OF_BUFFER_CHARS_COUNT
count of characters for serial end of buffer
Definition Constants.h:428
#define TCP_END_OF_BUFFER_CHAR_2
Definition Constants.h:449
#define SERIAL_END_OF_BUFFER_CHAR_3
Definition Constants.h:436
#define TCP_END_OF_BUFFER_CHAR_1
characters of the buffer that we set at the end of buffers for tcp
Definition Constants.h:448
#define MAXIMUM_INSTR_SIZE
maximum instruction size in Intel
Definition Constants.h:470
#define TCP_END_OF_BUFFER_CHAR_4
Definition Constants.h:451
#define TCP_END_OF_BUFFER_CHAR_3
Definition Constants.h:450
#define DebuggerEventTagStartSeed
The seeds that user-mode codes use as the starter of their events' tag.
Definition Constants.h:230
struct _DEBUGGER_EVENT_AND_ACTION_RESULT DEBUGGER_EVENT_AND_ACTION_RESULT
Status of register buffers.
struct _HWDBG_INSTANCE_INFORMATION HWDBG_INSTANCE_INFORMATION
The structure of script capabilities information in hwdbg.
struct _MODULE_SYMBOL_DETAIL * PMODULE_SYMBOL_DETAIL
std::map< std::string, COMMAND_DETAIL > CommandType
Type saving commands and mapping to command string.
Definition commands.h:207
UINT32 g_VirtualAddressWidth
Virtual address width for x86 processors.
Definition globals.h:50
BOOLEAN g_RtmSupport
check for RTM support
Definition globals.h:44
string g_ServerPort
In debugger (not debuggee), we save the port of server debuggee in this variable to use it later e....
Definition globals.h:132
string g_ServerIp
In debugger (not debuggee), we save the port of server debuggee in this variable to use it later e....
Definition globals.h:139
ULONG g_CurrentRemoteCore
Current core that the debuggee is debugging.
Definition globals.h:285
UINT64 g_KernelBaseAddress
Shows the kernel base address.
Definition globals.h:576
std::map< UINT64, LOCAL_FUNCTION_DESCRIPTION > g_DisassemblerSymbolMap
Symbol table for disassembler.
Definition globals.h:522
HANDLE g_RemoteDebuggeeListeningThread
In debugger (not debuggee), we save the ip of server debuggee in this variable to use it later e....
Definition globals.h:146
HANDLE g_EndOfMessageReceivedEvent
Handle to if the end of the message received (for showing signature).
Definition globals.h:159
BOOLEAN g_IsConnectedToRemoteDebuggee
Shows whether the current debugger is the host and connected to a remote debuggee (guest).
Definition globals.h:96
UINT64 g_EventTag
This variable holds the trace and generate numbers for new tags of events.
Definition globals.h:385
BOOLEAN g_EventTraceInitialized
it shows whether the debugger started using events or not or in other words, is g_EventTrace initiali...
Definition globals.h:400
BOOLEAN g_AutoFlush
Whether auto-flush mode is enabled or not enabled.
Definition globals.h:601
BOOLEAN g_IsConnectedToHyperDbgLocally
Shows whether the user is allowed to use 'load' command to load modules locally in VMI (virtual machi...
Definition globals.h:89
UINT64 g_OutputSourceTag
This variable holds the trace and generate numbers for unique tag of the output resources.
Definition globals.h:392
BOOLEAN g_IsRunningInstruction32Bit
whether the Current executing instructions is 32-bit or 64 bit
Definition globals.h:232
BOOLEAN g_IsInstrumentingInstructions
Shows whether the user is running 't', 'p', or 'i' command.
Definition globals.h:571
BYTE g_CurrentRunningInstruction[MAXIMUM_INSTR_SIZE]
Current executing instructions.
Definition globals.h:226
BOOLEAN g_HwdbgInstanceInfoIsValid
Shows whether the instance info is valid (received) or not.
Definition globals.h:697
HWDBG_INSTANCE_INFORMATION g_HwdbgInstanceInfo
Instance information of the current hwdbg debuggee.
Definition globals.h:691
std::vector< UINT32 > g_HwdbgPortConfiguration
Ports configuration of hwdbg.
Definition globals.h:703
UINT64 * g_ScriptGlobalVariables
Holder of script engines global variables.
Definition Global.h:71
UINT32 g_InterpreterCountOfOpenCurlyBrackets
Keeps the trace of curly brackets in the interpreter.
Definition globals.h:69
BOOLEAN g_ShouldPreviousCommandBeContinued
Shows whether the previous command should be continued or not.
Definition globals.h:342
BOOLEAN g_IsCommandListInitialized
Is list of command initialized.
Definition globals.h:366
BOOLEAN g_IsInterpreterPreviousCharacterABackSlash
Is interpreter encountered a back slash at previous run.
Definition globals.h:64
BOOLEAN g_IsInterpreterOnString
shows whether the interpreter is currently on a string or not
Definition globals.h:59
CommandType g_CommandsList
List of command and attributes.
Definition globals.h:348
HANDLE g_DebuggeeStopCommandEventHandle
An event to make sure that the user won't give any command in debuggee and all the commands are comin...
Definition globals.h:299
DEBUGGER_EVENT_AND_ACTION_RESULT g_DebuggeeResultOfRegisteringEvent
Holds the result of registering events from the remote debuggee.
Definition globals.h:305
BYTE g_EndOfBufferCheckSerial[4]
the buffer that we set at the end of buffers for serial
Definition globals.h:207
BOOLEAN g_SerialConnectionAlreadyClosed
In both debuggee and debugger we save the state of the closed connection to avoid double close.
Definition globals.h:173
BOOLEAN g_IsDebuggeeRunning
Shows if the debuggee is running or not.
Definition globals.h:272
HANDLE g_SerialRemoteComPortHandle
In debugger (not debuggee), we save the handle of the user-mode listening thread for remote system he...
Definition globals.h:246
DEBUGGER_SYNCRONIZATION_EVENTS_STATE g_KernelSyncronizationObjectsHandleTable[DEBUGGER_MAXIMUM_SYNCRONIZATION_KERNEL_DEBUGGER_OBJECTS]
In debugger (not debuggee), we save the handle of the user-mode listening thread for pauses here for ...
Definition globals.h:220
BOOLEAN g_IgnoreNewLoggingMessages
Shows if the debugger should show debuggee's messages or not.
Definition globals.h:279
DEBUGGER_EVENT_AND_ACTION_RESULT g_DebuggeeResultOfAddingActionsToEvent
Holds the result of adding action to events from the remote debuggee.
Definition globals.h:311
HANDLE g_SerialListeningThreadHandle
In debuggee and debugger, we save the handle of the user-mode listening thread for pauses here.
Definition globals.h:239
BOOLEAN g_IsDebuggeeInHandshakingPhase
Shows if the debuggee is in the handshake phase or not.
Definition globals.h:266
BOOLEAN g_SharedEventStatus
This is an OVERLAPPED structure for managing simultaneous read and writes for debugger (in current de...
Definition globals.h:331
BOOLEAN g_IsDebuggerConntectedToNamedPipe
Shows if the debugger is connected to the guest using named pipe.
Definition globals.h:292
UINT64 g_ResultOfEvaluatedExpression
Result of the expression that is evaluated in the debuggee.
Definition globals.h:640
UINT32 g_ErrorStateOfResultOfEvaluatedExpression
Shows the state of the evaluation of expression which whether contains error or not.
Definition globals.h:647
UINT32 g_ProcessIdOfLatestStartingProcess
The process id of the latest starting process.
Definition globals.h:378
OVERLAPPED g_OverlappedIoStructureForWriteDebugger
OVERLAPPED g_OverlappedIoStructureForReadDebugger
#define DEBUGGER_MAXIMUM_SYNCRONIZATION_KERNEL_DEBUGGER_OBJECTS
maximum number of event handles in kernel-debugger
Definition debugger.h:22
struct _DEBUGGER_SYNCRONIZATION_EVENTS_STATE DEBUGGER_SYNCRONIZATION_EVENTS_STATE
In debugger holds the state of events.
#define DEBUGGER_MAXIMUM_SYNCRONIZATION_USER_DEBUGGER_OBJECTS
Maximum number of event handles in user-debugger.
Definition debugger.h:96
struct _ACTIVE_DEBUGGING_PROCESS ACTIVE_DEBUGGING_PROCESS
structures related to current thread debugging state
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:481
BOOLEAN g_IsHyperTraceModuleLoaded
shows whether the HyperTrace module is loaded or not
Definition lbrdump.cpp:19
HANDLE g_IsDriverLoadedSuccessfully
Handle to show that if the debugger is loaded successfully.
Definition globals.h:152
TCHAR g_DriverLocation[MAX_PATH]
Holds the location driver to install it.
Definition globals.h:433
LIST_ENTRY g_EventTrace
Holds a list of events in kernel and the state of events and the commands to show the state of each c...
Definition globals.h:410
BOOLEAN g_IsMessageLoggingWindowClosed
Shows whether the message logging window is closed or not.
Definition globals.h:472
BOOLEAN g_IsKdModuleLoaded
shows whether the kernel debugger (KD) module is loaded or not
Definition globals.h:22
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
BOOLEAN g_IsVmmModuleLoaded
shows whether the VMM module is loaded or not
Definition globals.h:28
ofstream g_LogOpenFile
The object of log file ('.logopen' command).
Definition globals.h:494
UINT64 g_CpuidStandardDeviation
The standard deviation calculated from the measurements of cpuid '!measure' command.
Definition globals.h:542
UINT64 g_RdtscAverage
The average calculated from the measurements of rdtsc/p '!measure' command.
Definition globals.h:554
UINT64 g_RdtscMedian
The median calculated from the measurements of rdtsc/p '!measure' command.
Definition globals.h:566
BOOLEAN g_TransparentResultsMeasured
Shows whether the user executed and mesaured '!measure' command or not, it is because we want to use ...
Definition globals.h:530
UINT64 g_CpuidMedian
The median calculated from the measurements of cpuid '!measure' command.
Definition globals.h:548
UINT64 g_RdtscStandardDeviation
The standard deviation calculated from the measurements of rdtsc/p '!measure' command.
Definition globals.h:560
UINT64 g_CpuidAverage
The average calculated from the measurements of cpuid '!measure' command.
Definition globals.h:536
BOOLEAN g_IsSerialConnectedToRemoteDebugger
Shows if the debugger was connected to remote debugger (A remote host).
Definition rev.cpp:18
BOOLEAN g_LogOpened
Shows whether the '.logopen' command is executed and the log file is open or not.
Definition globals.h:488
PVOID g_MessageHandlerSharedBuffer
The shared buffer for the handler of ShowMessages function.
Definition globals.h:466
BOOLEAN g_IsConnectedToRemoteDebugger
Shows whether the current system is a guest (debuggee) and a remote debugger is connected to this sys...
Definition globals.h:103
PVOID g_MessageHandler
The handler for ShowMessages function this is because the user might choose not to use printf and ins...
Definition globals.h:460
LIST_ENTRY g_OutputSources
Holds a list of output sources created by output command.
Definition globals.h:427
BOOLEAN g_OutputSourcesInitialized
it shows whether the debugger started using output sources or not or in other words,...
Definition globals.h:418
BOOLEAN g_BreakPrintingOutput
Shows whether the pause command or CTRL+C or CTRL+Break is executed or not.
Definition globals.h:509
BOOLEAN g_IsEndOfMessageReceived
variable to keep track if the end of the message received (for showing signature)
Definition globals.h:166
BYTE g_EndOfBufferCheckTcp[TCP_END_OF_BUFFER_CHARS_COUNT]
the buffer that we set at the end of buffers for tcp connection
Definition globals.h:78
SOCKET g_ServerListenSocket
Server in debuggee needs an extra socket.
Definition globals.h:125
SOCKET g_SeverSocket
The socket object of guest debuggee (not debugger) it is because in HyperDbg, debugger is client and ...
Definition globals.h:119
SOCKET g_ClientConnectSocket
The socket object of host debugger (not debuggee) it is because in HyperDbg, debuggee is server and d...
Definition globals.h:111
std::wstring g_StartCommandPathAndArguments
the start arguments used in .start command
Definition globals.h:663
std::wstring g_StartCommandPath
the start path used in .start command
Definition globals.h:657
BOOLEAN g_CurrentExprEvalResultHasError
global variable to detect if there was an error in the result of script-engine statement tests
Definition globals.h:681
UINT64 * g_ScriptStackBuffer
Holder of stack buffer for script engine.
Definition globals.h:360
UINT64 * g_HwdbgPinsStatus
Holder of pins (and ports) status of hwdbg.
Definition globals.h:709
UINT64 g_CurrentExprEvalResult
global variable to save the result of script-engine statement tests
Definition globals.h:674
BOOLEAN g_ExecutingScript
Shows whether the target is executing a script form '.script' command or executing script by an argum...
Definition globals.h:502
BOOLEAN g_AddressConversion
Whether converting addresses to object names or not.
Definition globals.h:594
BOOLEAN g_AutoUnpause
Whether auto-unpause mode is enabled or not enabled.
Definition globals.h:587
UINT32 g_DisassemblerSyntax
Shows the syntax used in !u !u2 u u2 commands.
Definition globals.h:608
UINT32 g_SymbolTableCurrentIndex
The index to hold the track of added symbols.
Definition globals.h:633
PMODULE_SYMBOL_DETAIL g_SymbolTable
The buffer that stores the details of symbol table.
Definition globals.h:619
UINT32 g_SymbolTableSize
The buffer that stores size of the details of symbol table.
Definition globals.h:626
TCHAR g_TestLocation[MAX_PATH]
Holds the location test-hyperdbg.exe.
Definition globals.h:451
DEBUGGER_SYNCRONIZATION_EVENTS_STATE g_UserSyncronizationObjectsHandleTable[DEBUGGER_MAXIMUM_SYNCRONIZATION_USER_DEBUGGER_OBJECTS]
In debugger (not debuggee), we save the handle of the user-mode listening thread for pauses here for ...
Definition globals.h:198
BOOLEAN g_IsUserDebuggerInitialized
Whether the user debugger is initialized or not.
Definition globals.h:189