Platform SDK: Debugging and Error Handling

Retrieving Undecorated Symbol Names

The following code demonstrates how to retrieve an undecorated symbol name from an IMAGEHLP_SYMBOL structure. In this example, the pSymbol variable must be filled by the SymGetSymFromAddr or SymGetSymFromName function. The undecorated name is stored in szName.

char  szName[1024];
DWORD dwAddress;
DWORD dwDisplacement;
BYTE      buffer[256];
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL)buffer;

if (SymUnDName(pSymbol, szName, sizeof(szName)))
{
    // SymUnDName returned success
    printf ("Symbol : %s\n", szName);
}
else
{
    // SymUnDName failed
    error = GetLastError();
    printf("SymUnDName returned error : %d\n", error);
}