From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Library:Microsoft Detours" |
|---|
| claim | "A Detours x64 trampoline is 96 bytes: 30 bytes of relocated code, its length, 30 bytes of the original code, its length, eight 1-byte alignment entries, the pbRemain and pbDetour pointers and an 8-byte rbCodeIn stub; the x86 one is 72 bytes with 22 restore bytes and no rbCodeIn." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Microsoft Detours" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "DETOUR_TRAMPOLINE" |
|---|
| size | 96 |
|---|
| variant | "x64 (non ARM64EC)" |
|---|
| abi | "x64" |
|---|
| fields | | offset | 0 |
|---|
| name | "rbCode" |
|---|
| type | "uint8[30]" |
|---|
| meaning | "moved target code plus jmp to pbRemain" |
|---|
|
| offset | 30 |
|---|
| name | "cbCode" |
|---|
| type | "uint8" |
|---|
|
| offset | 31 |
|---|
| name | "cbCodeBreak" |
|---|
| type | "uint8" |
|---|
|
| offset | 32 |
|---|
| name | "rbRestore" |
|---|
| type | "uint8[30]" |
|---|
| meaning | "original target bytes for detach" |
|---|
|
| offset | 62 |
|---|
| name | "cbRestore" |
|---|
| type | "uint8" |
|---|
|
| offset | 63 |
|---|
| name | "cbRestoreBreak" |
|---|
| type | "uint8" |
|---|
|
| offset | 64 |
|---|
| name | "rAlign" |
|---|
| type | "uint8[8]" |
|---|
| meaning | "_DETOUR_ALIGN entries: bitfields obTarget:3, obTrampoline:5 (2 bytes each on ARM64)" |
|---|
|
| offset | 72 |
|---|
| name | "pbRemain" |
|---|
| type | "uint8*" |
|---|
| meaning | "first instruction after the moved code" |
|---|
|
| offset | 80 |
|---|
| name | "pbDetour" |
|---|
| type | "uint8*" |
|---|
| meaning | "detour function" |
|---|
|
| offset | 88 |
|---|
| name | "rbCodeIn" |
|---|
| type | "uint8[8]" |
|---|
| meaning | "FF 25 jump through pbDetour; the target's E9 rel32 lands here" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "struct for x64 (C_ASSERT size 96) and x86 (size 72); jmp generators at lines 407-430" |
|---|
| repo | "https://github.com/microsoft/Detours" |
|---|
| commit | "1dbd4ea281d73d478aa8d09a8b83fbd265f715f7" |
|---|
| path | "src/detours.cpp" |
|---|
| lines | "44-59, 368-398, 139-152" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "DETOUR_TRAMPOLINE x86 x64" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T07:03:59.781Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:20:03.883Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read src/detours.cpp at 1dbd4ea281d7: x64 struct (non-ARM64EC) rbCode[30], cbCode, cbCodeBreak, rbRestore[30], cbRestore, cbRestoreBreak, rAlign[8], pbRemain, pbDetour, rbCodeIn[8] with C_ASSERT 96 (208 under _M_ARM64EC); x86 struct C_ASSERT 72 with rbRestore[22] and no rbCodeIn; _DETOUR_ALIGN is 1 byte (2 on ARM64/ARM64EC). Offsets 0/30/31/32/62/63/64/72/80/88 match. Not covered by the fact: ARM (104 bytes, rbCode[62]) and IA64 variants exist." |
|---|
|
|
|---|