Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
In de volgende code worden de naam, het adres en de grootte van elk geladen symbool in de opgegeven module weergegeven. De functie SymEnumSymbols vereist een callback-functie, die eenmaal wordt aangeroepen voor elke geladen module. In dit voorbeeld is EnumSymProc een implementatie van de callback-functie.
#include <windows.h>
#include <stdio.h>
#include <dbghelp.h>
BOOL CALLBACK EnumSymProc(
PSYMBOL_INFO pSymInfo,
ULONG SymbolSize,
PVOID UserContext)
{
UNREFERENCED_PARAMETER(UserContext);
printf("%08X %4u %s\n",
pSymInfo->Address, SymbolSize, pSymInfo->Name);
return TRUE;
}
void main()
{
HANDLE hProcess = GetCurrentProcess();
DWORD64 BaseOfDll;
char *Mask = "*";
BOOL status;
status = SymInitialize(hProcess, NULL, FALSE);
if (status == FALSE)
{
return;
}
BaseOfDll = SymLoadModuleEx(hProcess,
NULL,
"foo.dll",
NULL,
0,
0,
NULL,
0);
if (BaseOfDll == 0)
{
SymCleanup(hProcess);
return;
}
if (SymEnumSymbols(hProcess, // Process handle from SymInitialize.
BaseOfDll, // Base address of module.
Mask, // Name of symbols to match.
EnumSymProc, // Symbol handler procedure.
NULL)) // User context.
{
// SymEnumSymbols succeeded
}
else
{
// SymEnumSymbols failed
printf("SymEnumSymbols failed: %d\n", GetLastError());
}
SymCleanup(hProcess);
}