Adds a directory to the process DLL search path.
DLL_DIRECTORY_COOKIE AddDllDirectory( PCWSTR NewDirectory );
An absolute path to the directory to add to the search path. For example, to add the directory Dir2 to the process DLL search path, specify \Dir2. For more information about paths, see Naming Files, Paths, and Namespaces.
If the function succeeds, the return value is an opaque pointer that can be passed to RemoveDllDirectory to remove the DLL from the process DLL search path.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The AddDllDirectory function can be used to add any absolute path to the set of directories that are searched for a DLL. If SetDefaultDllDirectories is first called with LOAD_LIBRARY_SEARCH_USER_DIRS, directories specified with AddDllDirectory are added to the process DLL search path. Otherwise, directories specified with the AddDllDirectory function are used only for LoadLibraryEx function calls that specify LOAD_LIBRARY_SEARCH_USER_DIRS.
If AddDllDirectory is used to add more than one directory to the process DLL search path, the order in which those directories are searched is unspecified.
To remove a directory added with AddDllDirectory, use the RemoveDllDirectory function.
Windows 7, Windows Server 2008 R2, Windows Vista and Windows Server 2008: To use this function in an application, call GetProcAddress to retrieve the function's address from Kernel32.dll. KB2533623 must be installed on the target platform.
|Minimum supported client||Windows 8 [desktop apps only],KB2533623 on Windows 7, Windows Server 2008 R2, Windows Vista, and Windows Server 2008|
|Minimum supported server||Windows Server 2012 [desktop apps only]|
|Header||libloaderapi.h (include Windows.h)|