Detours icon indicating copy to clipboard operation
Detours copied to clipboard

Is it safe to detach/attach multiple times?

Open R3uan3 opened this issue 3 years ago • 2 comments

Upon consecutive calls to 'DetourDetach' and 'DetourAttach' there is any chance to cause any kind of crash or error, into the hooked process? or is it considerable safe?

I'm asking in a scenario where you detach with the intention to pause the hooks, and then reenable them when needed. or should i create any kind of if else in each API hooked?

if (!hooksEnabled) 
    return 'the original function'

R3uan3 avatar Aug 22 '22 04:08 R3uan3

Consecutive attach and detach works for me

sylveon avatar Aug 22 '22 04:08 sylveon

https://github.com/microsoft/Detours/pull/144 is a workload for this issue.

sonyps5201314 avatar Aug 22 '22 08:08 sonyps5201314