I am trying to load multiple instances of the same DLL on the VS2010 C++ project (x32 Configuration).
so I have main dll - Parent.dll that composite with some others kids.dll (kid1.dll, kid2.dll, etc..., kid8.dll) static-linked - when I load the Parent.dll, the kids.dll's are automatically loaded (they located in the same path so they can be loaded successfully).
in my code, I use LoadLibraryEx(Path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) to load the Parent.dll instances. my problem occurs when I try to create multiple instances of Parent.dll: I make a copy of all the DLL's into another path, renamed the Parent name(Parnet_1.dll for example), about the others DLL's - they can't be renamed cause they are static-linked. (i can't access the Parnet.dll source code and change it to dynamic-load).
With 1 instance - The Parent.dll and all his kids are loading successfully. when I'm trying to load another instance, Parent_1.dll, the Parent_1.dll loaded successfully but the other kids DLLs are not loaded: they have the exact same names which are already loaded from the 1st instance - that's what causes my program to crash.
what I am trying to do to is to dynamically load multiple Instance of Parent.dll that each Parent will have his own kids.dll loaded. in other words - recursive redirection
I've been searching all over the internet and couldn't find a solution for my case. I saw there this article: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection and tried the MyCode.exe.local and it didn't work.
I also tried DLL redirection using manifest but couldn't understand how to do it correctly.
Thanks for any effort to help!
Parent.dll"? - Phil Brubaker