where is LoadLibrary A looking for the file?

百般思念 提交于 2019-12-02 02:51:13

The MSDN Library article Dynamic-Link Library Search Order specifies the search order for desktop applications when SafeDllSearchMode is enabled, which is the default starting with Windows XP SP2:

  1. The directory from which the application loaded.
  2. The system directory. Use the GetSystemDirectory function to get the path of this directory.
  3. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
  4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  5. The current directory.
  6. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.

LoadlLibrary article specifies search order in Remarks:

If lpFileName does not include a path and there is more than one loaded module with the same base name and extension, the function returns a handle to the module that was loaded first.

If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. However, the file name string can include a trailing point character (.) to indicate that the module name has no extension. When no path is specified, the function searches for loaded modules whose base name matches the base name of the module to be loaded. If the name matches, the load succeeds. Otherwise, the function searches for the file. [...]

For more information on the DLL search order, see Dynamic-Link Library Search Order.

File names are not case sensitive, so NTFS and FAT file names are. It is the fundamental rule to not assume case sensitivity:

Naming Conventions

The following fundamental rules enable applications to create and process valid names for files and directories, regardless of the file system: [...]

Do not assume case sensitivity.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!