SymGetSymbolFile function (dbghelp.h)

Locates a symbol file in the specified symbol path.

Syntax

BOOL IMAGEAPI SymGetSymbolFile(
  [in, optional] HANDLE hProcess,
  [in, optional] PCSTR  SymPath,
  [in]           PCSTR  ImageFile,
  [in]           DWORD  Type,
  [out]          PSTR   SymbolFile,
  [in]           size_t cSymbolFile,
  [out]          PSTR   DbgFile,
  [in]           size_t cDbgFile
);

Parameters

[in, optional] hProcess

A handle to the process that was originally passed to the SymInitialize function.

If this handle is 0, SymPath cannot be NULL. Use this option to load a symbol file without calling SymInitialize or SymCleanup.

[in, optional] SymPath

The symbol path. If this parameter is NULL or an empty string, the function uses the symbol path set using the SymInitialize or SymSetSearchPath function.

[in] ImageFile

The name of the image file.

[in] Type

The type of symbol file. This parameter can be one of the following values.

Value Meaning
sfImage
0
A .exe or .dll file.
sfDbg
1
A .dbg file.
sfPdb
2
A .pdb file.
sfMpd
3
Reserved.

[out] SymbolFile

A pointer to a null-terminated string that receives the name of the symbol file.

[in] cSymbolFile

The size of the SymbolFile buffer, in characters.

[out] DbgFile

A pointer to a buffer that receives the fully qualified path to the symbol file. This buffer must be at least MAX_PATH characters.

[in] cDbgFile

The size of the DbgFile buffer, in characters.

Return value

If the server locates a valid symbol file, it returns TRUE; otherwise, it returns FALSE and GetLastError returns a value that indicates why the symbol file was not returned.

Remarks

All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR.

Requirements

Requirement Value
Target Platform Windows
Header dbghelp.h
Library Dbghelp.lib
DLL Dbghelp.dll
Redistributable DbgHelp.dll 6.3 or later

See also

DbgHelp Functions

SymInitialize