LoadLibraryExW() fails, last error is ERROR_MOD_NOT_FOUND, but no missing dependencies?

后端 未结 3 1999
名媛妹妹
名媛妹妹 2020-12-20 20:28

A customer is using our dll which is creating a child process which uses an open source library, which ultimately fails because of a call to LoadLibraryExW(), the last error

相关标签:
3条回答
  • 2020-12-20 21:06

    The best way is to use loader snaps. Basically you use gflags.exe (which is included with windbg) to enable loader snaps; then, run the process with the debugger attached. Loader snaps will enable the loader to print out dbg messages of the process and it will print the failures.

    gflags.exe -i yourcode.exe +sls
    windbg yourcode.exe
    
    0 讨论(0)
  • 2020-12-20 21:07

    Your dependencies might be present on the system but they could be in a folder that is not part of the search order during LoadLibraryExW(). A SetDllDirectory() or AddDllDirectory() call would ensure that the folder containing the dependencies is searched during the LoadLibraryExW() call

    0 讨论(0)
  • 2020-12-20 21:17

    Use the Profiling option of the Dependency Walker on your application. Possibly the library is trying to resolve some APIs dynamically (using LoadLibrary/GetProcAddress) and this won't show up in the static dependencies.

    0 讨论(0)
提交回复
热议问题