REPENTOGON icon indicating copy to clipboard operation
REPENTOGON copied to clipboard

[ZHL] Detours generates invalid trampolines on functions that start with jumps

Open Sylmir opened this issue 2 years ago • 2 comments

If a to-be detoured function contains a jump anywhere within its first five bytes, Detours generates an invalid trampoline when detouring. It naively copies all bytes of all broken instructions within the first five bytes, which includes the relative offset of the jump. This offset needs to be fixed to redirect towards the original code properly.

Sylmir avatar Sep 21 '23 18:09 Sylmir

Duplicate of #122 ?

Nasa62 avatar Dec 03 '24 22:12 Nasa62

Not exactly, this issue is about the offset of the jump not being changed when the bytes are copied, the other issue is about jump backs to the beginning of the function not being adjusted, but both issues relate to the same meta issue

Sylmir avatar Dec 03 '24 22:12 Sylmir