EnumDirTreeW function (dbghelp.h)

Enumerates all occurrences of the specified file in the specified directory tree.

Syntax

BOOL IMAGEAPI EnumDirTreeW(
  [in, optional]  HANDLE                 hProcess,
  [in]            PCWSTR                 RootPath,
  [in]            PCWSTR                 InputPathName,
  [out, optional] PWSTR                  OutputPathBuffer,
  [in, optional]  PENUMDIRTREE_CALLBACKW cb,
  [in, optional]  PVOID                  data
);

Parameters

[in, optional] hProcess

A handle to a process. This handle must have been previously passed to the SymInitialize function.

[in] RootPath

The path where the function should begin searching for the file.

[in] InputPathName

The name of the file to be found. You can specify a partial path.

[out, optional] OutputPathBuffer

A pointer to a buffer that receives the full path of the file. If the function fails or does not find a matching file, this buffer will still contain the last full path that was found.

This parameter is optional and can be NULL.

[in, optional] cb

An application-defined callback function, or NULL. For more information, see EnumDirTreeProc.

[in, optional] data

The user-defined data or NULL. This value is passed to the callback function.

Return value

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 search can be canceled if you register a SymRegisterCallbackProc64 callback function. For every file operation, EnumDirTree calls this callback function with CBA_DEFERRED_SYMBOL_LOAD_CANCEL. If the callback function returns TRUE, EnumDirTree cancels the search.

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 EnumDirTree as an alias which 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 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 6.0 or later

See also

DbgHelp Functions

EnumDirTreeProc