Re[2]: Типы данных?
От: ekamaloff Великобритания  
Дата: 13.03.06 05:51
Оценка: 3 (1) +1
#Имя: FAQ.winapi.LibraryPath
Здравствуйте, rg45, Вы писали:

R>Еще одно замечание: если в функцию LoadLibrary имя файла динамической библитеки передается без указания пути (полного или относительного), то эта библиотека должна находиться либо в текущей директории, либо в одной из директорий, перечисленных в переменной среды окружения PATH.


На самом деле все ку-у-да сложнее:

...
Otherwise, the function searches for the file in the following sequence:


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.

It is always bad to give advices, but you will be never forgiven for a good one.
Oscar Wilde
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.