SymGetSymbolFile Function

Debug Help Library

SymGetSymbolFile Function

Locates a symbol file in the specified symbol path.

BOOL WINAPI SymGetSymbolFile(
  __in_opt      HANDLE hProcess,
  __in          PCTSTR SymPath,
  __in          PCTSTR ImageFile,
  __in          DWORD Type,
  __out         PTSTR SymbolFile,
  __in          size_t cSymbolFile,
  __out         PTSTR DbgFile,
  __in          size_t cDbgFile
);

Parameters

hProcess

A handle to the process that was originally passed to the SymInitialize function. This parameter is optional.

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

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.

ImageFile

The name of the image file.

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.

SymbolFile

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

cSymbolFile

The size of the SymbolFile buffer, in characters.

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.

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

Redistributable

Requires DbgHelp.dll 6.3 or later.

Header

Declared in Dbghelp.h.

Library

Use Dbghelp.lib.

DLL

Requires Dbghelp.dll.

Unicode

Implemented as SymGetSymbolFileW (Unicode) and SymGetSymbolFile (ANSI).

See Also

DbgHelp Functions
SymInitialize


Send comments about this topic to Microsoft

Build date: 9/25/2007

© 2007 Microsoft Corporation. All rights reserved.