If somebody tries to hot-patch an already-hot-patched function
devblogs.microsoft.com
[2 comments hidden]
Interestingly, it had similar constraints and checked them at build time: it could not be a public ABI change and only one patch at a time.
[5 comments hidden]
[hidden]
[hidden]
[hidden]
In which case there is no race condition.
[hidden]
[8 comments hidden]
[7 comments hidden]
I've made my own hooking library that lets multiple plug-ins hook the same function, but it only works decently because it has this central library synchronizing access.
[4 comments hidden]
[2 comments hidden]
Naive implementation of this scheme doesn't allow stacking.
[hidden]
Meanwhile, the Microsoft Detours library supports detouring other kinds of instructions at the beginning of a function. It's not exclusively for the 'two byte nop and blank space' thing.
[hidden]
2) Thread A reads original instructions while thread B is replacing them, such that it reads part of an original instruction and part of a replaced instruction. Thread A’s trampoline would have nonsensical instructions.
[2 comments hidden]
There is a setting to make it pick up overlays, which works reasonably well, I'm not entirely sure how it's implemented.
[hidden]
Then you're faced with the problem of how deep your hook is, you either want it to run early (before other hooks), or late (after other hooks but before actual function). When you're trying to capture the overlay, you want your hook to run late.
The cop-out is to hook D3DKMTPresent instead and hope nobody else hooked it.
[3 comments hidden]
[hidden]
Ehh :) scenarios like this are the best
drdexebtjl[9 comments hidden]
Also, missing from this explanation: hooks are usually applied per process, from user space. The code pages in a dynamic library are CoW’d from the shared page when you write to them to apply a patch.
Does the Windows Update work similarly, or does it somehow modify the original, shared page, affecting all processes? Does a hook in a single process disable hot patching on the entire system?
saagarjha[3 comments hidden]
drdexebtjl[2 comments hidden]
saagarjha[hidden]
ack_complete[5 comments hidden]
pjmlp[4 comments hidden]
https://en.wikipedia.org/wiki/MinWin
https://techcommunity.microsoft.com/blog/windowsosplatform/o...
Detours like technology is used in API Sets, to redirect legacy DLLS into the new refactored ones.
https://learn.microsoft.com/en-us/windows/win32/apiindex/win...
drdexebtjl[2 comments hidden]
pjmlp[hidden]
https://learn.microsoft.com/en-us/windows/win32/apiindex/api...
ack_complete[hidden]