HyperDbg Debugger
|
symbol parser More...
#include "pch.h"
Functions | |
void | SymSetTextMessageCallback (PVOID Handler) |
Set the function callback that will be called if any message needs to be shown. | |
VOID | ShowMessages (const char *Fmt,...) |
Show messages. | |
PSYMBOL_LOADED_MODULE_DETAILS | SymGetModuleBaseFromSearchMask (const char *SearchMask, BOOLEAN SetModuleNameGlobally) |
Interpret and find module base, based on module name. | |
BOOLEAN | SymGetFieldOffsetFromModule (UINT64 Base, WCHAR *TypeName, WCHAR *FieldName, UINT32 *FieldOffset) |
Get the offset of a field from the top of a structure. | |
BOOLEAN | SymGetDataTypeSizeFromModule (UINT64 Base, WCHAR *TypeName, UINT64 *TypeSize) |
Get the size of a data type (structure) | |
BOOLEAN | SymInit () |
initialize the DbgHelp symbols | |
BOOLEAN | SymCheckAndRemoveWow64Prefix (const char *ModuleAddress, const char *PdbFileName, std::string &CustomModuleName) |
Remove wow64 extension to the module names. | |
BOOLEAN | SymCheckNtoskrnlPrefix (const char *PdbFileName, std::string &CustomModuleName) |
Check for alternative name of ntoskrn;. | |
UINT32 | SymLoadFileSymbol (UINT64 BaseAddress, const char *PdbFileName, const char *CustomModuleName) |
load symbol based on a file name and GUID | |
UINT32 | SymUnloadModuleSymbol (char *ModuleName) |
Unload one module symbol. | |
UINT32 | SymUnloadAllSymbols () |
Unload all the symbols. | |
UINT64 | SymConvertNameToAddress (const char *FunctionOrVariableName, PBOOLEAN WasFound) |
Convert function name to address. | |
BOOLEAN | SymGetFieldOffset (CHAR *TypeName, CHAR *FieldName, UINT32 *FieldOffset) |
Search and show symbols. | |
BOOLEAN | SymGetDataTypeSize (CHAR *TypeName, UINT64 *TypeSize) |
Get the size of structures from the symbols. | |
UINT32 | SymSearchSymbolForMask (const char *SearchMask) |
Gets the offset from the symbol. | |
BOOLEAN | SymCreateSymbolTableForDisassembler (void *CallbackFunction) |
Create symbol table for disassembler. | |
string | SymSeparateTo64BitValue (UINT64 Value) |
add ` between 64 bit values and convert them to string | |
BOOL | SymGetFileParams (const char *FileName, DWORD &FileSize) |
Get symbol file parameters. | |
BOOL | SymGetFileSize (const char *FileName, DWORD &FileSize) |
Get symbol file size. | |
VOID | SymShowSymbolInfo (UINT64 ModuleBase) |
Show symbol info. | |
BOOL CALLBACK | SymDisplayMaskSymbolsCallback (SYMBOL_INFO *SymInfo, ULONG SymbolSize, PVOID UserContext) |
Callback for showing and enumerating symbols. | |
BOOL CALLBACK | SymDeliverDisassemblerSymbolMapCallback (SYMBOL_INFO *SymInfo, ULONG SymbolSize, PVOID UserContext) |
Callback for delivering module!ObjectName to disassembler symbol map. | |
VOID | SymShowSymbolDetails (SYMBOL_INFO &SymInfo) |
Show symbols details. | |
const char * | SymTagStr (ULONG Tag) |
Interpret different tags for pdbs. | |
BOOLEAN | SymConvertFileToPdbPath (const char *LocalFilePath, char *ResultPath) |
Convert a DLL to a Microsoft Symbol path. | |
VOID | SymConvertWow64CompatibilityPaths (const char *LocalFilePath, std::string &Wow64ConvertedPath) |
Convert redirection of 32-bit compatibility path. | |
BOOLEAN | SymConvertFileToPdbFileAndGuidAndAgeDetails (const char *LocalFilePath, char *PdbFilePath, char *GuidAndAgeDetails, BOOLEAN Is32BitModule) |
Convert a DLL to a Microsoft Symbol details like pdb file path and GUID. | |
BOOLEAN | SymbolInitLoad (PVOID BufferToStoreDetails, UINT32 StoredLength, BOOLEAN DownloadIfAvailable, const char *SymbolPath, BOOLEAN IsSilentLoad) |
check if the pdb files of loaded symbols are available or not | |
BOOLEAN | SymbolPdbDownload (std::string SymName, const std::string &GUID, const std::string &SymPath, BOOLEAN IsSilentLoad) |
download pdb file | |
VOID | SymbolAbortLoading () |
In the case of pressing CTRL+C, it sets a flag to abort the execution of the 'reload'ing and the 'download'ing. | |
BOOLEAN | SymShowDataBasedOnSymbolTypes (const char *TypeName, UINT64 Address, BOOLEAN IsStruct, PVOID BufferAddress, const char *AdditionalParameters) |
Perform task for showing structures and data. | |
Variables | |
std::vector< PSYMBOL_LOADED_MODULE_DETAILS > | g_LoadedModules |
BOOLEAN | g_IsLoadedModulesInitialized = FALSE |
BOOLEAN | g_AbortLoadingExecution = FALSE |
CHAR * | g_CurrentModuleName = NULL |
PVOID | g_MessageHandler = NULL |
The handler for ShowMessages function this is because the user might choose not to use printf and instead use his/her handler for showing messages. | |
SymbolMapCallback | g_SymbolMapForDisassembler = NULL |
symbol parser
VOID ShowMessages | ( | const char * | Fmt, |
... ) |
Show messages.
Fmt | format string message |
VOID SymbolAbortLoading | ( | ) |
In the case of pressing CTRL+C, it sets a flag to abort the execution of the 'reload'ing and the 'download'ing.
return VOID
BOOLEAN SymbolInitLoad | ( | PVOID | BufferToStoreDetails, |
UINT32 | StoredLength, | ||
BOOLEAN | DownloadIfAvailable, | ||
const char * | SymbolPath, | ||
BOOLEAN | IsSilentLoad ) |
check if the pdb files of loaded symbols are available or not
BufferToStoreDetails | Pointer to a buffer to store the symbols details this buffer will be allocated by this function and needs to be freed by caller |
StoredLength | The length that stored on the BufferToStoreDetails |
DownloadIfAvailable | Download the file if its available online |
SymbolPath | The path of symbols |
IsSilentLoad |
BOOLEAN SymbolPdbDownload | ( | std::string | SymName, |
const std::string & | GUID, | ||
const std::string & | SymPath, | ||
BOOLEAN | IsSilentLoad ) |
download pdb file
BufferToStoreDetails | Pointer to a buffer to store the symbols details this buffer will be allocated by this function and needs to be freed by caller |
StoredLength | The length that stored on the BufferToStoreDetails |
SymPath | The path of symbols |
IsSilentLoad | Download without any message |
return BOOLEAN
BOOLEAN SymCheckAndRemoveWow64Prefix | ( | const char * | ModuleAddress, |
const char * | PdbFileName, | ||
std::string & | CustomModuleName ) |
Remove wow64 extension to the module names.
ModuleAddress | |
PdbFileName |
BOOLEAN SymCheckNtoskrnlPrefix | ( | const char * | PdbFileName, |
std::string & | CustomModuleName ) |
Check for alternative name of ntoskrn;.
PdbFileName | |
CustomModuleName |
BOOLEAN SymConvertFileToPdbFileAndGuidAndAgeDetails | ( | const char * | LocalFilePath, |
char * | PdbFilePath, | ||
char * | GuidAndAgeDetails, | ||
BOOLEAN | Is32BitModule ) |
Convert a DLL to a Microsoft Symbol details like pdb file path and GUID.
LocalFilePath | |
PdbFilePath | |
GuidAndAgeDetails | |
Is32BitModule |
BOOLEAN SymConvertFileToPdbPath | ( | const char * | LocalFilePath, |
char * | ResultPath ) |
Convert a DLL to a Microsoft Symbol path.
LocalFilePath | |
ResultPath |
Convert function name to address.
FunctionName | |
WasFound |
VOID SymConvertWow64CompatibilityPaths | ( | const char * | LocalFilePath, |
std::string & | Wow64ConvertedPath ) |
Convert redirection of 32-bit compatibility path.
LocalFilePath |
BOOLEAN SymCreateSymbolTableForDisassembler | ( | void * | CallbackFunction | ) |
Create symbol table for disassembler.
mainly used by disassembler for 'u' command
CallbackFunction |
BOOL CALLBACK SymDeliverDisassemblerSymbolMapCallback | ( | SYMBOL_INFO * | SymInfo, |
ULONG | SymbolSize, | ||
PVOID | UserContext ) |
Callback for delivering module!ObjectName to disassembler symbol map.
SymInfo | |
SymbolSize | |
UserContext |
BOOL CALLBACK SymDisplayMaskSymbolsCallback | ( | SYMBOL_INFO * | SymInfo, |
ULONG | SymbolSize, | ||
PVOID | UserContext ) |
Callback for showing and enumerating symbols.
SymInfo | |
SymbolSize | |
UserContext |
Get the size of structures from the symbols.
TypeName | |
FieldName | |
FieldOffset |
Get the size of a data type (structure)
Base | |
TypeName | |
TypeSize |
Search and show symbols.
mainly used by the 'x' command
TypeName | |
FieldName | |
FieldOffset |
BOOLEAN SymGetFieldOffsetFromModule | ( | UINT64 | Base, |
WCHAR * | TypeName, | ||
WCHAR * | FieldName, | ||
UINT32 * | FieldOffset ) |
Get the offset of a field from the top of a structure.
Base | |
TypeName | |
FieldName | |
FieldOffset |
This function is derived from: https://github.com/0vercl0k/sic/blob/master/src/sic/sym.cc
Get symbol file parameters.
FileName | |
BaseAddr | |
FileSize |
Get symbol file size.
FileName | |
FileSize |
PSYMBOL_LOADED_MODULE_DETAILS SymGetModuleBaseFromSearchMask | ( | const char * | SearchMask, |
BOOLEAN | SetModuleNameGlobally ) |
Interpret and find module base, based on module name.
SearchMask |
BOOLEAN SymInit | ( | ) |
initialize the DbgHelp symbols
UINT32 SymLoadFileSymbol | ( | UINT64 | BaseAddress, |
const char * | PdbFileName, | ||
const char * | CustomModuleName ) |
load symbol based on a file name and GUID
BaseAddress | |
PdbFileName | |
CustomModuleName |
UINT32 SymSearchSymbolForMask | ( | const char * | SearchMask | ) |
Gets the offset from the symbol.
SearchMask |
string SymSeparateTo64BitValue | ( | UINT64 | Value | ) |
add ` between 64 bit values and convert them to string
Value |
void SymSetTextMessageCallback | ( | PVOID | Handler | ) |
Set the function callback that will be called if any message needs to be shown.
Handler | Function that handles the messages |
BOOLEAN SymShowDataBasedOnSymbolTypes | ( | const char * | TypeName, |
UINT64 | Address, | ||
BOOLEAN | IsStruct, | ||
PVOID | BufferAddress, | ||
const char * | AdditionalParameters ) |
Perform task for showing structures and data.
used by dt command
TypeName | |
Address | |
IsStruct | |
BufferAddress | |
AdditionalParameters |
VOID SymShowSymbolDetails | ( | SYMBOL_INFO & | SymInfo | ) |
Show symbols details.
SymInfo |
Show symbol info.
ModuleBase |
const char * SymTagStr | ( | ULONG | Tag | ) |
Interpret different tags for pdbs.
Tag |
UINT32 SymUnloadAllSymbols | ( | ) |
Unload all the symbols.
UINT32 SymUnloadModuleSymbol | ( | char * | ModuleName | ) |
Unload one module symbol.
ModuleName |
CHAR* g_CurrentModuleName = NULL |
std::vector<PSYMBOL_LOADED_MODULE_DETAILS> g_LoadedModules |
PVOID g_MessageHandler = NULL |
The handler for ShowMessages function this is because the user might choose not to use printf and instead use his/her handler for showing messages.
SymbolMapCallback g_SymbolMapForDisassembler = NULL |