If LoadLibraryExW(..., LOAD_WITH_ALTERED_SEARCH_PATH) fails, then this tries LoadLibraryExW(... , LOAD_LIBRARY_SEARCH_DEFAULT_DIRS).
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
This value is a combination of LOAD_LIBRARY_SEARCH_APPLICATION_DIR, LOAD_LIBRARY_SEARCH_SYSTEM32, and LOAD_LIBRARY_SEARCH_USER_DIRS. Directories in the standard search path are not searched. This value cannot be combined with LOAD_WITH_ALTERED_SEARCH_PATH.
This value represents the recommended maximum number of directories an application should include in its DLL search path.
LOAD_LIBRARY_SEARCH_USER_DIRS
If this value is used, directories added using the AddDllDirectory or the SetDllDirectory function are searched for the DLL and its dependencies. If more than one directory has been added, the order in which the directories are searched is unspecified. Directories in the standard search path are not searched. This value cannot be combined with LOAD_WITH_ALTERED_SEARCH_PATH.
Order
An application can specify the directories to search for a single LoadLibraryEx call by using the LOAD_LIBRARYSEARCH* flags. If more than one LOAD_LIBRARY_SEARCH flag is specified, the directories are searched in the following order:
The directory that contains the DLL (LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR). This directory is searched only for dependencies of the DLL to be loaded.
The application directory (LOAD_LIBRARY_SEARCH_APPLICATION_DIR).
Paths explicitly added to the application search path with the AddDllDirectory function (LOAD_LIBRARY_SEARCH_USER_DIRS) or the SetDllDirectory function. If more than one path has been added, the order in which the paths are searched is unspecified.
The System32 directory (LOAD_LIBRARY_SEARCH_SYSTEM32).
If
LoadLibraryExW(..., LOAD_WITH_ALTERED_SEARCH_PATH)
fails, then this triesLoadLibraryExW(... , LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)
.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
LOAD_LIBRARY_SEARCH_USER_DIRS
Order