Platform SDK: Debugging and Error Handling

Enumerating Symbol Modules

The following code lists the modules that have been loaded by the SymLoadModule or SymInitialize function. The SymEnumerateModules function requires a callback function, which will be called once for each module loaded. In this example, EnumModules is an implementation of the callback function.

BOOL CALLBACK EnumModules(
    LPSTR ModuleName, 
    ULONG BaseOfDll,  
    PVOID UserContext )
{
    printf("%08X %s\n", BaseOfDll, ModuleName);
    return TRUE;
}

if (SymEnumerateModules(hProcess, EnumModules, NULL))
{
    // SymEnumerateModules returned success
}
else
{
    // SymEnumerateModules failed
    error = GetLastError();
    printf("SymEnumerateModules returned error : %d\n", error);
}