aboutsummaryrefslogtreecommitdiff
path: root/subhook_x86.c
AgeCommit message (Collapse)AuthorFilesLines
2023-02-10Add flag to support allocation of trampolines within 32-bit offset range of ↵Zeex1-12/+16
target code on 64-bit Windows Plus minor formatting fixes and more documentation for flags. Fixes #9
2022-03-09add cmp eax variant.Luke Usher1-0/+1
2020-11-11Make subhook_new() not fail on any trampoline-related errorZeex1-17/+12
2020-11-02Fix segfault in subhook_new()Zeex1-8/+9
This fixes #51.
2020-11-02Fix address overflow in trampolineZeex1-5/+5
Allocate memory for storing the trampoline code via mmap() with MAP_32BIT flag to make sure that it stays withing 2GB range. Also, add missing calls to subhook_free() in the C test program (C++ calls it implicitly already via destructor).
2020-11-01Improve documentation commentsZeex1-2/+8
2020-11-01Fix possible NULL dereferenceZeex1-3/+1
2020-11-01Fix RIP-relative address decodingZeex1-4/+5
Some instructions were detected as using RIP-relative addressing, but in fact they did not. Example: 48 89 E5 mov rbp,rsp
2020-11-01Detect overflows when relocating 32-bit jumps inside trampoline on x64Zeex1-9/+22
2020-11-01Simplify error handling in subhook_new() + clean up in instruction listZeex1-19/+26
2020-10-31Implement additional CMP, DEC and FLD instructionsSilent1-0/+5
Fixes broken trampolines encountered in Cxbx-Reloaded
2020-05-30Export subhook_disasm()Zeex1-1/+1
2019-06-28Merge branch 'master' into masterPatrickvL1-17/+61
2018-11-22Cleanup and code style fixseZeex1-1/+2
2018-11-22Add subhook_set_disasm_handler()Zeex1-6/+10
2018-11-04Add support for for XOR, ADD, AND, OR, ENTER, LEAVE, INT 3Zeex1-8/+48
2018-10-02Add xor (0x33): Fixes SetRenderState_ZBias trampolineLuke Usher1-0/+1
2018-10-02Merge remote-tracking branch 'upstream/master'Luke Usher1-48/+52
2018-09-07Improve ABS() macroZeex1-1/+1
2018-09-06Rename "options" to "flags"Zeex1-13/+13
2018-09-06Rename 64-bit jump code constantsZeex1-9/+9
2018-09-06Don't check for jmp offset overflow in 32-bit build (#33)Zeex1-6/+6
2018-09-06Fix missing return statement in 64-bit buildZeex1-2/+2
2018-09-03Clean up and improve commentsZeex1-23/+26
* Replace SUBHOOK_BITS equality comparisons with SUBHOOK_X86_64 macro definition checks (less error-prone) * Improve comments in subhook_disasm() and remove unused variable (address_size) * Update copyright year across all files
2018-03-23Add support for NOP (one-byte version) (#28)Zeex1-1/+2
2018-02-03Add DEC opcode, fixes Turok's DeletePixelShader trampolineLuke Usher1-1/+2
2018-01-30Add CMP r/m16/32m, imm8 to subhook.Luke Usher1-0/+1
Fixes an issue where some Xbox functions were not getting functioning trampolines.
2017-10-31Replace 0 with NULLZeex1-10/+3
2017-07-28Made all subhook calls NULL safe, not just one destructor.Y_Less1-0/+9
2017-02-07SUB r/m32, imm32 instruction typoAnton1-1/+1
IMM8 -> IMM32
2016-08-29Properly decode SIB lengthZeex1-2/+14
2016-08-29CleanupZeex1-6/+16
2016-08-28Fix relocation bugZeex1-5/+10
It was introduced during latest refactoring (along with like 10 other bugs).
2016-08-28Add support for REX prefixesZeex1-0/+11
2016-08-28Return error on overflowZeex1-21/+41
2016-08-28Remove stupid assertZeex1-5/+1
2016-08-28Fix trampoline size calculationZeex1-1/+1
Fixes #18.
2016-08-27Make sure offset fits in 32 bitsZeex1-1/+8
2016-08-25Fix trampoline generationZeex1-1/+3
Fixes #17.
2016-08-25Fix 64-bit jump being overwritten by regular jumpZeex1-0/+1
Fixes #16.
2016-07-24Minor cleanupZeex1-3/+3
2016-07-24Convert tabs to spacesZeex1-313/+326
2016-07-24Return support for 32-bit jumps on x86-64Zeex1-71/+106
Add an option to allow the caller to decide whether to use 32-bit or 64-bit jumps (the latter requires almost 3 times more space (5 vs 14 bytes)). Also see: #13
2016-04-24Fix pointer cast to smaller type warningZeex1-1/+1
2016-04-23CleanupZeex1-86/+116
2016-04-23Fix MSVC compile errorsZeex1-1/+4
2016-04-02Modify x64 support to use RET rather than JMPOzymandias1-6/+55
Unforunately, 64-bit direct jumps don't work in AMD64. In order to avoid this issue, I am pushing the address we wish to jump to on the stack and calling RET. Due to the same issues as JMP, using the trampoline is unlikely to be safe in many situations. Therefore, I would recommend only using ScopedRemove, or manually removing the hook prior to calling the original function, instead of using a the trampoline.
2015-11-10Add link to Intel manualsZeex1-2/+4
2015-11-10Add support for TEST and more variants of SUB in trampolinesZeex1-30/+44
2015-09-13Fix x64 compile warningsZeex1-7/+8