http://bugs.winehq.org/show_bug.cgi?id=14699
Summary: DLL loading prolem when injecting into another process Product: Wine Version: 1.1.2 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: kernel32 AssignedTo: wine-bugs@winehq.org ReportedBy: hongbo@njstar.com
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.
Wine rror message:
err:module:import_dll Libary C.dll (which is needed by L"C:\DirA\B.dll) not found.
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.
I may also look into import_dll where the error occured.