От: | ekamaloff | ||
Дата: | 13.03.06 05:51 | ||
Оценка: | 3 (1) +1 | ||
#Имя: | FAQ.winapi.LibraryPath |
...
Otherwise, the function searches for the file in the following sequence:
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT/2000/XP: The name of this directory is System32.
Windows NT/2000/XP: The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
Windows XP: If HKLM\System\CurrentControlSet\Control\SessionManager\SafeDllSearchMode is 1, the current directory is searched after the system and Windows directories, but before the directories in the PATH environment variable. The default value is 0 (current directory is searched before the system and Windows directories).
Windows XP SP1, Windows .NET Server 2003 family: The default value of HKLM\System\CurrentControlSet\Control\SessionManager\SafeDllSearchMode is 1 (current directory is searched after the system and Windows directories).
The first directory searched is the one directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process's installed directory to the PATH environment variable.
Windows XP SP1, Windows .NET Server 2003 family: The search path can be altered using the SetDllDirectory function. This solution is recommended instead of using SetCurrentDirectory or hard-coding the full path to the DLL.
Windows 2000/XP: If a path is specified and there is a redirection file for the application, the function searches for the module in the application's directory. If the module exists in the application's directory, the LoadLibrary function ignores the specified path and loads the module from the application's directory. If the module does not exist in the application's directory, LoadLibrary loads the module from the specified directory. For more information, see Dynamic Link Library Redirection.