Detours DLL does not DLL_PROCESS_ATTACH if a statically linked DLL or delay loaded DLL is not found
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.4k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Consider a program MyProgram.exe with 2 dependencies: MyDetoured.dll and MyDelayLoaded.dll.
MyDetoured.dll is injected as first entry in the import libs of MyProgram.exe using setdll.
When MyProgram.exe runs, I can see MyDetoured.dll being loaded before MyDelayLoaded.dll and its DLL_PROCESS_ATTACH is called.
However when MyDelayLoaded.dll is not found, MyProgram.exe:
- loads MyDetoured.dll
- tries to load MyDelayLoaded.dll and fails with a dll not found pop up error
- DLL_PROCESS_ATTACH of MyDetoured.dll is not called <--- issue here
I see this by using "gflags -i Program.exe +sls" which traces dll calls.
I thought Detours are guaranteed to get called.
Is this a bug or is it a limitation that Detours doesn't work when a delay loaded DLL is not resolved at runtime ?
EDIT: this happens also with statically linked DLL
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the missing-dependency cases described for delay-loaded and statically linked DLLs, using setdll and gflags -i Program.exe +sls. Trace whether MyDetoured.dll reaches DLL_PROCESS_ATTACH and determine whether the behavior is caused by Detours or the Windows loader; done requires a confirmed explanation and documented resolution.
Written by the indexing model from the issue text.
Assessment
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100