Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/detours.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,26 @@ then unsigned size-unscaled (8) 12-bit offset, then opcode bits 0xF94.
}
}
}

// Skip over a branch to the import jump if there is one.
if ((Opcode & 0xfc000000) == 0x14000000) {
// B <imm26>
INT64 branchOffset = (Opcode & 0x03ffffff) << 2;
if ((Opcode & 0x02000000) != 0) {
branchOffset |= (INT64)0xfffffffff0000000ULL;
}
PBYTE const pbBranchTarget = pbCode + branchOffset;
ULONG const BranchOpcode = fetch_opcode(pbBranchTarget);

if ((BranchOpcode & 0x9f00001f) == 0x90000010) {
PBYTE const pbNew = detour_skip_jmp(pbBranchTarget, ppGlobals);

if (pbNew != pbBranchTarget) {
DETOUR_TRACE(("%p->%p: skipped over branch to import table.\n", pbCode, pbNew));
return pbNew;
}
}
}
return pbCode;
}

Expand Down