Platform SDK: Debugging and Error Handling

SymGetSymFromAddr

The SymGetSymFromAddr function locates the symbol for the specified address.

This function is implemented as a wrapper that calls SymGetSymFromAddr64. For more information, see New 64-bit Functions.

BOOL SymGetSymFromAddr(
  HANDLE hProcess,             
  DWORD Address,               
  PDWORD Displacement,       
  PIMAGEHLP_SYMBOL Symbol  
);

For SymGetSymFromAddr64, the parameter list is as follows.

BOOL SymGetSymFromAddr64(
  HANDLE hProcess,             
  DWORD64 Address,               
  PDWORD64 Displacement,       
  PIMAGEHLP_SYMBOL64 Symbol  
);

Parameters

hProcess
[in] Handle to the process that was originally passed to the SymInitialize function.
Address
[in] Specifies the address for which a symbol should be located. The address does not have to be on a symbol boundary. If the address comes after the beginning of a symbol and before the end of the symbol (the beginning of the symbol plus the symbol size), the symbol is found.
Displacement
[out] The displacement from the beginning of the symbol, or zero.
Symbol
[out] Pointer to an IMAGEHLP_SYMBOL structure.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.

Remarks

The SymGetSymFromAddr function locates the symbol for a specified address. The modules are searched for the one the address belongs to. When the module is found, its symbol table is searched for a match. When the symbol is found, the symbol information is copied into the Symbol buffer provided by the caller. The caller must allocate the Symbol buffer properly and fill in the required parameters in the IMAGEHLP_SYMBOL structure before calling SymGetSymFromAddr.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Dbghelp.h.
  Library: Use Dbghelp.lib.

See Also

Debug Help Library Overview, DbgHelp Functions, IMAGEHLP_SYMBOL, SymInitialize