Skip to content

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

@m-celikba

Description

@m-celikba

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions