Platform SDK: Debugging and Error Handling |
The following code displays the name, address, and size of each loaded symbol in the specified module. The SymEnumerateSymbols function requires a callback function, which will be called once for each module loaded. In this example, EnumSymbols
is an implementation of the callback function.
BOOL CALLBACK EnumSymbols(LPSTR SymbolName, ULONG SymbolAddress, ULONG SymbolSize, PVOID UserContext) { printf("%08X %4u %s\n", SymbolAddress, SymbolSize, SymbolName); return TRUE; } if (SymEnumerateSymbols(hProcess, BaseOfDll, EnumSymbols, NULL)) { // SymEnumerateSymbols returned success } else { // SymEnumerateSymbols failed error = GetLastError(); printf("SymEnumerateSymbols returned error : %d\n", error); }