11 Commits

Author SHA1 Message Date
Zeex
23bf37f44e Fix compile error and clean up in *nix-specific code 2023-02-10 15:54:07 +06:00
Campbell Suter
9d1ba393ae unix: Fix unprotecting memory across a page boundary
Previously, we'd round the address to unprotect to the nearest page but
keep the length the same. This meant that if we were hooking a function
that started just before the end of a page, it would need both pages to
be unprotected but we'd only unprotect the first one.
2021-12-05 12:25:32 +13:00
Dudi
ba0872c0b2 Removing subhook_macos.c 2021-11-20 22:12:51 +02:00
Zeex
a292bd33e1 Don't use MAP_32BIT on macOS
This flag requires use of entitlements i.e. code signing...
2020-11-11 01:54:05 +06:00
Zeex
6fae00efdf Fix segfault in subhook_new()
This fixes #51.
2020-11-02 20:15:12 +06:00
Zeex
a596f2b117 Add null check in subhok_free_code() 2020-11-02 03:46:00 +06:00
Zeex
846deef5a8 Fix undefined symbol error 2020-11-02 03:33:20 +06:00
Zeex
314603bc42 Fix address overflow in trampoline
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-02 03:19:54 +06:00
Zeex
12732c1d1d Cleanup and code style fixse 2018-11-22 05:29:35 +06:00
Zeex
12b527d642 Clean up and improve comments
* 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-09-03 20:10:28 +06:00
Zeex
af522f7245 Add support for Mac OS 2016-08-28 15:10:11 +06:00