-1

Suppose:

  1. I have an executable file, named A.exe, it's in path: PathA.
  2. A.exe loadlibrary B.dll, B.dll loadlibrary C.dll.
  3. B.dll is in path: PathB. C.dll have a copy in both PathA and PathB.

So my question is: when A.exe loads B.dll, which path of C.dll will be loaded by B.dll?

In my situation, C.dlls have something different,such as one is _cdecl, the other is _stdcall. when removed c.dll in PathA ,A.exe can load B.dll successfully; however when c.dll in PathA exists, it fails

lwiu
  • 179
  • 1
  • 9
  • 2
    `PathA\C.dll` will be loaded in your scenario. `LoadLibrary` can't know which specific module is calling it; only the directory of the EXE is on the search path. The documentation for `LoadLibrary` describes the search algorithm in detail (as it has security implications). – Igor Tandetnik Dec 23 '16 at 14:45
  • Yes,you are right.And after debugging,I know if PathA\c.dll doesn't exist,it would load PathB\c.dll. All is about the search strategy of loadlibrary. Thank you for your help! – lwiu Dec 23 '16 at 14:59

1 Answers1

0

I guess C.dll in PathA will be loaded because of your working path is the path of A.exe.And i think kind of _cdecl dll maybe has some problems when you dynamic load it.

Aoinatsu
  • 1
  • 1