HyperDbg Debugger
Loading...
Searching...
No Matches
pdb-identity.h File Reference

Internal PDB identity formatting helpers. More...

Go to the source code of this file.

Typedefs

typedef BOOLEAN(* PSYM_PDB_IDENTITY_FALLBACK_CALLBACK) (PVOID Context, CHAR *PdbFile, SIZE_T PdbFileSize, GUID *Guid, DWORD *Age)
typedef BOOLEAN(* PSYM_PDB_IDENTITY_EXTRACTOR_CALLBACK) (const BYTE *PeImageBytes, SIZE_T PeImageSize, CHAR *PdbFile, SIZE_T PdbFileSize, GUID *Guid, DWORD *Age)

Functions

BOOLEAN SymFormatPdbIdentity (const CHAR *PdbFile, const GUID *Guid, DWORD Age, CHAR *SymbolServerRelativePath, SIZE_T SymbolServerRelativePathSize, CHAR *GuidAndAgeDetails, SIZE_T GuidAndAgeDetailsSize)
 Helper function to format the PDB identity information into the specified output buffers.
BOOLEAN SymFormatPdbIdentityFromPeImageOrFallback (const BYTE *PeImageBytes, SIZE_T PeImageSize, CHAR *SymbolServerRelativePath, SIZE_T SymbolServerRelativePathSize, CHAR *PdbFilePath, SIZE_T PdbFilePathSize, CHAR *GuidAndAgeDetails, SIZE_T GuidAndAgeDetailsSize, PSYM_PDB_IDENTITY_FALLBACK_CALLBACK FallbackCallback, PVOID FallbackContext)
 Extracts PDB identity information from a PE image using the specified extractor callback, with an optional fallback if extraction fails.
BOOLEAN SymFormatPdbIdentityFromLoadedPeImageOrFallback (const BYTE *PeImageBytes, SIZE_T PeImageSize, CHAR *SymbolServerRelativePath, SIZE_T SymbolServerRelativePathSize, CHAR *PdbFilePath, SIZE_T PdbFilePathSize, CHAR *GuidAndAgeDetails, SIZE_T GuidAndAgeDetailsSize, PSYM_PDB_IDENTITY_FALLBACK_CALLBACK FallbackCallback, PVOID FallbackContext)
 Extracts PDB identity information from a PE image using the specified extractor callback that parses the image as if it is loaded in memory, with an optional fallback if extraction fails.

Detailed Description

Internal PDB identity formatting helpers.

Author
jtaw5649
Version
0.19
Date
2026-06-02

Typedef Documentation

◆ PSYM_PDB_IDENTITY_EXTRACTOR_CALLBACK

typedef BOOLEAN(* PSYM_PDB_IDENTITY_EXTRACTOR_CALLBACK) (const BYTE *PeImageBytes, SIZE_T PeImageSize, CHAR *PdbFile, SIZE_T PdbFileSize, GUID *Guid, DWORD *Age)

◆ PSYM_PDB_IDENTITY_FALLBACK_CALLBACK

typedef BOOLEAN(* PSYM_PDB_IDENTITY_FALLBACK_CALLBACK) (PVOID Context, CHAR *PdbFile, SIZE_T PdbFileSize, GUID *Guid, DWORD *Age)

Function Documentation

◆ SymFormatPdbIdentity()

BOOLEAN SymFormatPdbIdentity ( const CHAR * PdbFile,
const GUID * Guid,
DWORD Age,
CHAR * SymbolServerRelativePath,
SIZE_T SymbolServerRelativePathSize,
CHAR * GuidAndAgeDetails,
SIZE_T GuidAndAgeDetailsSize )

Helper function to format the PDB identity information into the specified output buffers.

The function formats the PDB file name, GUID, and age into a symbol server relative path and a combined GUID-and-age string according to the standard symbol server layout.

Parameters
PdbFileThe base name of the PDB file (e.g., "example.pdb")
GuidThe GUID associated with the PDB
AgeThe age associated with the PDB
SymbolServerRelativePathAn optional output buffer to receive the formatted symbol server relative path. If not NULL, it must have enough space for the formatted string
SymbolServerRelativePathSizeThe size of the SymbolServerRelativePath buffer in bytes
GuidAndAgeDetailsAn optional output buffer to receive the formatted GUID and age details string. If not NULL, it must have enough space for the formatted string
GuidAndAgeDetailsSizeThe size of the GuidAndAgeDetails buffer in bytes
Returns
BOOLEAN TRUE if the formatting succeeded and output buffers were filled as requested, FALSE if there was an error (e.g., invalid parameters or insufficient buffer sizes)
74{
75 const CHAR * FormatStrSymbolServerRelativePath = "%s/%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x%x/%s";
76 const CHAR * FormatStrGuidAndAgeDetails = "%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x%x";
77
78 if (PdbFile == NULL || Guid == NULL || (SymbolServerRelativePath == NULL && GuidAndAgeDetails == NULL))
79 {
80 return FALSE;
81 }
82
83 if (SymbolServerRelativePath != NULL)
84 {
85 HRESULT Result = StringCchPrintfA(SymbolServerRelativePath,
86 SymbolServerRelativePathSize,
87 FormatStrSymbolServerRelativePath,
88 PdbFile,
89 Guid->Data1,
90 Guid->Data2,
91 Guid->Data3,
92 Guid->Data4[0],
93 Guid->Data4[1],
94 Guid->Data4[2],
95 Guid->Data4[3],
96 Guid->Data4[4],
97 Guid->Data4[5],
98 Guid->Data4[6],
99 Guid->Data4[7],
100 Age,
101 PdbFile);
102
103 if (FAILED(Result))
104 {
105 return FALSE;
106 }
107 }
108
109 if (GuidAndAgeDetails != NULL)
110 {
111 HRESULT Result = StringCchPrintfA(GuidAndAgeDetails,
112 GuidAndAgeDetailsSize,
113 FormatStrGuidAndAgeDetails,
114 Guid->Data1,
115 Guid->Data2,
116 Guid->Data3,
117 Guid->Data4[0],
118 Guid->Data4[1],
119 Guid->Data4[2],
120 Guid->Data4[3],
121 Guid->Data4[4],
122 Guid->Data4[5],
123 Guid->Data4[6],
124 Guid->Data4[7],
125 Age);
126
127 if (FAILED(Result))
128 {
129 return FALSE;
130 }
131 }
132
133 return TRUE;
134}
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
char CHAR
Definition BasicTypes.h:33

◆ SymFormatPdbIdentityFromLoadedPeImageOrFallback()

BOOLEAN SymFormatPdbIdentityFromLoadedPeImageOrFallback ( const BYTE * PeImageBytes,
SIZE_T PeImageSize,
CHAR * SymbolServerRelativePath,
SIZE_T SymbolServerRelativePathSize,
CHAR * PdbFilePath,
SIZE_T PdbFilePathSize,
CHAR * GuidAndAgeDetails,
SIZE_T GuidAndAgeDetailsSize,
PSYM_PDB_IDENTITY_FALLBACK_CALLBACK FallbackCallback,
PVOID FallbackContext )

Extracts PDB identity information from a PE image using the specified extractor callback that parses the image as if it is loaded in memory, with an optional fallback if extraction fails.

Parameters
PeImageBytesA pointer to the bytes of the PE image in memory
PeImageSizeThe size of the PE image in bytes
SymbolServerRelativePathAn optional output buffer to receive the formatted symbol server relative path. If not NULL, it must have enough space for the formatted string
SymbolServerRelativePathSizeThe size of the SymbolServerRelativePath buffer in bytes
PdbFilePathAn optional output buffer to receive the extracted PDB file path. If not NULL, it must have enough space for the file path string
PdbFilePathSizeThe size of the PdbFilePath buffer in bytes
GuidAndAgeDetailsAn optional output buffer to receive the formatted GUID and age details string. If not NULL, it must have enough space for the formatted string
GuidAndAgeDetailsSizeThe size of the GuidAndAgeDetails buffer in bytes
FallbackCallbackAn optional callback function that is invoked if the extractor callback fails. It should attempt to provide the same information as the extractor and return TRUE on success or FALSE on failure
FallbackContextAn optional context pointer that is passed to the fallback callback when invoked
Returns
BOOLEAN TRUE if either extraction method succeeded and output buffers were filled as requested, FALSE if both methods failed or if there was an error with parameters or buffer sizes
318{
319 return SymFormatPdbIdentityFromExtractorOrFallback(PeImageBytes,
320 PeImageSize,
321 SymbolServerRelativePath,
322 SymbolServerRelativePathSize,
323 PdbFilePath,
324 PdbFilePathSize,
325 GuidAndAgeDetails,
326 GuidAndAgeDetailsSize,
328 FallbackCallback,
329 FallbackContext);
330}
BOOLEAN SymExtractCodeViewRsdsInfoFromLoadedPeImage(const BYTE *ImageBase, SIZE_T ImageSize, CHAR *PdbFileName, SIZE_T PdbFileNameSize, GUID *Guid, DWORD *Age)
Extracts CodeView RSDS information from a PE image in memory, interpreting the image as it would be l...
Definition codeview-rsds.cpp:551

◆ SymFormatPdbIdentityFromPeImageOrFallback()

BOOLEAN SymFormatPdbIdentityFromPeImageOrFallback ( const BYTE * PeImageBytes,
SIZE_T PeImageSize,
CHAR * SymbolServerRelativePath,
SIZE_T SymbolServerRelativePathSize,
CHAR * PdbFilePath,
SIZE_T PdbFilePathSize,
CHAR * GuidAndAgeDetails,
SIZE_T GuidAndAgeDetailsSize,
PSYM_PDB_IDENTITY_FALLBACK_CALLBACK FallbackCallback,
PVOID FallbackContext )

Extracts PDB identity information from a PE image using the specified extractor callback, with an optional fallback if extraction fails.

Parameters
PeImageBytesA pointer to the bytes of the PE image in memory
PeImageSizeThe size of the PE image in bytes
SymbolServerRelativePathAn optional output buffer to receive the formatted symbol server relative path. If not NULL, it must have enough space for the formatted string
SymbolServerRelativePathSizeThe size of the SymbolServerRelativePath buffer in bytes
PdbFilePathAn optional output buffer to receive the extracted PDB file path. If not NULL, it must have enough space for the file path string
PdbFilePathSizeThe size of the PdbFilePath buffer in bytes
GuidAndAgeDetailsAn optional output buffer to receive the formatted GUID and age details string. If not NULL, it must have enough space for the formatted string
GuidAndAgeDetailsSizeThe size of the GuidAndAgeDetails buffer in bytes
FallbackCallbackAn optional callback function that is invoked if the extractor callback fails. It should attempt to provide the same information as the extractor and return TRUE on success or FALSE on failure
FallbackContextAn optional context pointer that is passed to the fallback callback when invoked
Returns
BOOLEAN TRUE if either extraction method succeeded and output buffers were filled as requested, FALSE if both methods failed or if there was an error with parameters or buffer sizes
277{
278 return SymFormatPdbIdentityFromExtractorOrFallback(PeImageBytes,
279 PeImageSize,
280 SymbolServerRelativePath,
281 SymbolServerRelativePathSize,
282 PdbFilePath,
283 PdbFilePathSize,
284 GuidAndAgeDetails,
285 GuidAndAgeDetailsSize,
287 FallbackCallback,
288 FallbackContext);
289}
BOOLEAN SymExtractCodeViewRsdsInfoFromPeImage(const BYTE *ImageBase, SIZE_T ImageSize, CHAR *PdbFileName, SIZE_T PdbFileNameSize, GUID *Guid, DWORD *Age)
Extracts CodeView RSDS information from a PE image in memory, interpreting the image as it would be l...
Definition codeview-rsds.cpp:528