FindExecutableImageExW function (dbghelp.h)

Locates the specified executable file.

Syntax

HANDLE IMAGEAPI FindExecutableImageExW(
  [in]           PCWSTR                   FileName,
  [in]           PCWSTR                   SymbolPath,
  [out]          PWSTR                    ImageFilePath,
  [in, optional] PFIND_EXE_FILE_CALLBACKW Callback,
  [in, optional] PVOID                    CallerData
);

Parameters

[in] FileName

The name of the symbol file to be located. This parameter can be a partial path.

[in] SymbolPath

The path where symbol files are located. This string can contain multiple paths separated by semicolons. To retrieve the symbol path, use the SymGetSearchPath function.

[out] ImageFilePath

A pointer to a buffer that receives the full path of the executable file.

[in, optional] Callback

An application-defined callback function that verifies whether the correct executable file was found, or whether the function should continue its search. For more information, see FindExecutableImageProc.

This parameter can be NULL.

[in, optional] CallerData

Optional user-defined data for the callback function. This parameter can be NULL.

Return value

If the function succeeds, the return value is an open handle to the executable file.

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

Remarks

The FindExecutableImageEx function is provided so executable files can be found in several different directories by using a single function call. If the SymbolPath parameter contains multiple paths, the function searches each specified directory tree for the executable file. When the file is found, the search stops. Thus, be sure to specify SymbolPath with the paths in the correct order.

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.

Note

The dbghelp.h header defines FindExecutableImageEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

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

See also

DbgHelp Functions

FindExecutableImageProc

SymGetSearchPath