Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detours DLL does not DLL_PROCESS_ATTACH if a statically linked DLL or delay loaded DLL is not found #336

Open
m-celikba opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@m-celikba
Copy link

m-celikba commented Feb 19, 2025

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

@m-celikba m-celikba added the bug Something isn't working label Feb 19, 2025
@m-celikba m-celikba changed the title Detours DLL does not DLL_PROCESS_ATTACH if a delay loaded dll is not found Detours DLL does not DLL_PROCESS_ATTACH if a statically linked DLL or delay loaded DLL is not found Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant