HyperDbg Debugger
|
header for HyperDbg's general functions for reading and converting and etc More...
Go to the source code of this file.
Macros | |
#define | AssertReturn return; |
#define | AssertReturnFalse return FALSE; |
#define | AssertReturnOne return 1; |
#define | ASSERT_MESSAGE_DRIVER_NOT_LOADED "handle of the driver not found, probably the driver is not loaded. Did you use 'load' command?\n" |
#define | ASSERT_MESSAGE_BUILD_SIGNATURE_DOESNT_MATCH |
#define | ASSERT_MESSAGE_CANNOT_SPECIFY_PID |
#define | AssertReturnStmt(expr, stmt, rc) |
#define | AssertShowMessageReturnStmt(expr, message, rc) |
#define | PAGE_SIZE 0x1000 |
Size of each page (4096 bytes) | |
#define | PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) |
Aligning a page. | |
#define | CPUID_ADDR_WIDTH 0x80000008 |
Cpuid to get virtual address width. | |
Functions | |
bool | AsmVmxSupportDetection () |
void | SpinlockLock (volatile LONG *Lock) |
Tries to get the lock and won't return until successfully get the lock. | |
void | SpinlockLockWithCustomWait (volatile LONG *Lock, unsigned MaximumWait) |
Tries to get the lock and won't return until successfully get the lock. | |
void | SpinlockUnlock (volatile LONG *Lock) |
Release the lock. | |
VOID | PrintBits (const UINT32 size, const void *ptr) |
print bits and bytes for d* commands | |
BOOL | Replace (std::string &str, const std::string &from, const std::string &to) |
general replace all function | |
VOID | ReplaceAll (string &str, const string &from, const string &to) |
general replace all function | |
const vector< string > | Split (const string &s, const char &c) |
general split command | |
BOOLEAN | IsNumber (const string &str) |
check if given string is a numeric string or not | |
UINT32 | Log2Ceil (UINT32 n) |
Function to compute log2Ceil. | |
vector< string > | SplitIp (const string &str, char delim) |
BOOLEAN | IsHexNotation (const string &s) |
check whether the string is hex or not | |
vector< char > | HexToBytes (const string &hex) |
converts hex to bytes | |
BOOLEAN | ConvertStringToUInt64 (string TextToConvert, PUINT64 Result) |
check and convert string to a 64 bit unsigned integer and also check for special notations like 0x, 0n, etc. | |
BOOLEAN | ConvertStringToUInt32 (string TextToConvert, PUINT32 Result) |
check and convert string to a 32 bit unsigned it and also check for special notations like 0x etc. | |
BOOLEAN | HasEnding (string const &fullString, string const &ending) |
checks whether the string ends with a special string or not | |
BOOLEAN | ValidateIP (const string &ip) |
Function to validate an IP address. | |
BOOL | SetPrivilege (HANDLE Token, LPCTSTR Privilege, BOOL EnablePrivilege) |
SetPrivilege enables/disables process token privilege. | |
void | Trim (std::string &s) |
trim from both ends and start of a string (in place) | |
std::string | RemoveSpaces (std::string str) |
Remove all the spaces in a string. | |
BOOLEAN | IsFileExistA (const char *FileName) |
check if a file exist or not (ASCII) | |
BOOLEAN | IsFileExistW (const wchar_t *FileName) |
check if a file exist or not (wide-char) | |
VOID | GetConfigFilePath (PWCHAR ConfigPath) |
Get config path. | |
VOID | StringToWString (std::wstring &ws, const std::string &s) |
convert std::string to std::wstring | |
VOID | SplitPathAndArgs (std::vector< std::string > &Qargs, const std::string &Command) |
Split path and arguments and handle strings between quotes. | |
size_t | FindCaseInsensitive (std::string Input, std::string ToSearch, size_t Pos) |
Find case insensitive sub string in a given substring. | |
size_t | FindCaseInsensitiveW (std::wstring Input, std::wstring ToSearch, size_t Pos) |
Find case insensitive sub string in a given substring (unicode) | |
char * | ConvertStringVectorToCharPointerArray (const std::string &s) |
Convert vector<string> to char*. | |
std::vector< std::string > | ListDirectory (const std::string &Directory, const std::string &Extension) |
Create a list of special files in a directory. | |
BOOLEAN | IsEmptyString (char *Text) |
Is empty character. | |
VOID | CommonCpuidInstruction (UINT32 Func, UINT32 SubFunc, int *CpuInfo) |
Get cpuid results. | |
BOOLEAN | CheckCpuSupportRtm () |
Check whether the processor supports RTM or not. | |
UINT32 | Getx86VirtualAddressWidth () |
Get virtual address width for x86 processors. | |
BOOLEAN | CheckAccessValidityAndSafety (UINT64 TargetAddress, UINT32 Size) |
Check the safety to access the memory. | |
BOOLEAN | VmxSupportDetection () |
Detect whether the VMX is supported or not. | |
header for HyperDbg's general functions for reading and converting and etc
#define ASSERT_MESSAGE_BUILD_SIGNATURE_DOESNT_MATCH |
#define ASSERT_MESSAGE_CANNOT_SPECIFY_PID |
#define ASSERT_MESSAGE_DRIVER_NOT_LOADED "handle of the driver not found, probably the driver is not loaded. Did you use 'load' command?\n" |
#define AssertReturn return; |
#define AssertReturnFalse return FALSE; |
#define AssertReturnOne return 1; |
#define AssertReturnStmt | ( | expr, | |
stmt, | |||
rc ) |
#define AssertShowMessageReturnStmt | ( | expr, | |
message, | |||
rc ) |
#define CPUID_ADDR_WIDTH 0x80000008 |
Cpuid to get virtual address width.
#define PAGE_ALIGN | ( | Va | ) | ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1))) |
Aligning a page.
#define PAGE_SIZE 0x1000 |
Size of each page (4096 bytes)
|
extern |
Check the safety to access the memory.
TargetAddress | |
Size |
BOOLEAN CheckCpuSupportRtm | ( | ) |
Check whether the processor supports RTM or not.
Get cpuid results.
UINT32 | Func |
UINT32 | SubFunc |
int | * CpuInfo |
check and convert string to a 32 bit unsigned it and also check for special notations like 0x etc.
TextToConvert | the target string |
Result | result will be save to the pointer |
check and convert string to a 64 bit unsigned integer and also check for special notations like 0x, 0n, etc.
TextToConvert | the target string |
Result | result will be save to the pointer |
char * ConvertStringVectorToCharPointerArray | ( | const std::string & | s | ) |
Convert vector<string> to char*.
use it like : std::transform(vs.begin(), vs.end(), std::back_inserter(vc), ConvertStringVectorToCharPointerArray); from: https://stackoverflow.com/questions/7048888/stdvectorstdstring-to-char-array
Input | |
ToSearch | |
Pos |
size_t FindCaseInsensitive | ( | std::string | Input, |
std::string | ToSearch, | ||
size_t | Pos ) |
Find case insensitive sub string in a given substring.
Input | |
ToSearch | |
Pos |
size_t FindCaseInsensitiveW | ( | std::wstring | Input, |
std::wstring | ToSearch, | ||
size_t | Pos ) |
Find case insensitive sub string in a given substring (unicode)
Input | |
ToSearch | |
Pos |
VOID GetConfigFilePath | ( | PWCHAR | ConfigPath | ) |
Get config path.
ConfigPath |
UINT32 Getx86VirtualAddressWidth | ( | ) |
Get virtual address width for x86 processors.
BOOLEAN HasEnding | ( | string const & | fullString, |
string const & | ending ) |
checks whether the string ends with a special string or not
fullString | |
ending |
vector< char > HexToBytes | ( | const string & | hex | ) |
converts hex to bytes
hex |
BOOLEAN IsEmptyString | ( | char * | Text | ) |
Is empty character.
Text |
BOOLEAN IsFileExistA | ( | const char * | FileName | ) |
check if a file exist or not (ASCII)
FileName | path of file |
BOOLEAN IsFileExistW | ( | const wchar_t * | FileName | ) |
check if a file exist or not (wide-char)
FileName | path of file |
BOOLEAN IsHexNotation | ( | const string & | s | ) |
check whether the string is hex or not
s |
BOOLEAN IsNumber | ( | const string & | str | ) |
check if given string is a numeric string or not
str |
std::vector< std::string > ListDirectory | ( | const std::string & | Directory, |
const std::string & | Extension ) |
Create a list of special files in a directory.
Directory | |
Extension |
Function to compute log2Ceil.
n |
print bits and bytes for d* commands
Size | |
Ptr |
std::string RemoveSpaces | ( | std::string | str | ) |
Remove all the spaces in a string.
str |
BOOL Replace | ( | std::string & | str, |
const std::string & | from, | ||
const std::string & | to ) |
VOID ReplaceAll | ( | string & | str, |
const string & | from, | ||
const string & | to ) |
general replace all function
str | |
from | |
to |
SetPrivilege enables/disables process token privilege.
Token | |
Privilege | |
EnablePrivilege |
void SpinlockLock | ( | volatile LONG * | Lock | ) |
Tries to get the lock and won't return until successfully get the lock.
LONG | Lock variable |
void SpinlockLockWithCustomWait | ( | volatile LONG * | Lock, |
unsigned | MaximumWait ) |
Tries to get the lock and won't return until successfully get the lock.
LONG | Lock variable |
LONG | MaxWait Maximum wait (pause) count |
void SpinlockUnlock | ( | volatile LONG * | Lock | ) |
Release the lock.
LONG | Lock variable |
const vector< string > Split | ( | const string & | s, |
const char & | c ) |
general split command
s | target string |
c | splitter (delimiter) |
vector< string > SplitIp | ( | const string & | str, |
char | delim ) |
VOID SplitPathAndArgs | ( | std::vector< std::string > & | Qargs, |
const std::string & | Command ) |
Split path and arguments and handle strings between quotes.
Qargs | |
Command |
VOID StringToWString | ( | std::wstring & | ws, |
const std::string & | s ) |
convert std::string to std::wstring
ws | |
s |
void Trim | ( | std::string & | s | ) |
trim from both ends and start of a string (in place)
s |
BOOLEAN ValidateIP | ( | const string & | ip | ) |
Function to validate an IP address.
ip |
BOOLEAN VmxSupportDetection | ( | ) |
Detect whether the VMX is supported or not.