c++ - LoadLibrary A 在哪里寻找文件?

标签 c++ windows dll loadlibrary

我的代码使用 LoadLibraryA("someDLL.dll");它开始搜索文件 someDLL.dll 的路径是什么?另一个问题:LoadLibraryA 函数是否区分大小写?我的意思是如果我有 SomeDLL.dll,它不会加载它?

最佳答案

MSDN 库文章 Dynamic-Link Library Search Order指定启用 SafeDllSearchMode 时桌面应用程序的搜索顺序,这是从 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.

关于c++ - LoadLibrary A 在哪里寻找文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14031749/

相关文章:

c++ - 使用 std::list::sort 挂起我的程序

windows - 如何将 Play Framework 2.4.4 应用程序作为 Windows 服务运行?

windows - 批处理循环错误 - 仅复制 1 个文件

c# - 如果一个应用程序中的多个线程调用单个 DLL 会发生什么

python - 如何使用 ctypes 读取具有自定义结构的 dll 的输出?

winapi - 我可以从另一个进程卸载 DLL 吗? (Win32)

c++ - 如何使用 Directory.GetFiles

c++ - boost 目录迭代器错误 : no match for operator! =

c++ - 使用 Boost.Build 和 C++ 管理库依赖关系

python - 如何使用 "matplotlib.pyplot"在不同窗口中绘制图表?