Hi,
 
I have observed a DLL loading prolem when injecting into another process.
 
For example,
 
In folder C:\DirA\, I have A.exe which is linked to B.dll, and B.dll is linked to C.dll.
B.dll and C.dll are in same folder as A.exe.
 
If I run A.exe, B.dll and C.dll will be loaded without problem since they are in same folder.
 
Support there is a process running C:\DirX\X.exe, and C:\DirX\ is not the current folder and
it's not on PATH.
 
Now I inject B.dll from A.exe into process X.exe, the System will map C:\DirA\B.dll into process X.exe.
 
Since B.dll is linked to C.dll, the system will try to load C.dll for process X.exe. But because C.dll is
not in same folder of process X.exe, wine failed to load C.dll for X.exe. This cause DLL injection to fail.
 
Windows does not have this problem. So I am trying to find a solution.
 
I think when processing the imports for C:\DirA\B.dll to load C.dll, it should try C:\DirA\C.dll first,
then form the standard load locations.
 
I think it should call load_library( "C:\DirA\C.dll ", LOAD_WITH_ALTERED_SEARCH_PATH)
so C.dll can be loaded into C:\DirX\X.exe process.
 
Alexandre, can you please comment ?
 
Regards
Hongbo Ni
 
 
 
 
 
 


Click here. Want to help Windows Live Messenger plant more Aussie trees?