diff options
author | Zeex <zeex@rocketmail.com> | 2020-08-19 21:48:17 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 21:48:17 +0600 |
commit | 4d0c8c2499fa8ec9dd450f075a79211bcced5c35 (patch) | |
tree | c047d905d298f359a85fac356216dd96008e8652 | |
parent | ced30fe38dc7ff380c6117b8c2a821cd96a03f0b (diff) | |
download | subhook-4d0c8c2499fa8ec9dd450f075a79211bcced5c35.zip subhook-4d0c8c2499fa8ec9dd450f075a79211bcced5c35.tar.gz subhook-4d0c8c2499fa8ec9dd450f075a79211bcced5c35.tar.bz2 |
Add info about SUBHOOK_STATIC to README
-rw-r--r-- | README.md | 30 |
1 files changed, 23 insertions, 7 deletions
@@ -7,12 +7,28 @@ Linux and macOS. It supports x86 only (32-bit and 64-bit). Installation ------------ -Simply copy the files to your project and include subhook.c in your build. -The other source files wil be `#included` by the main C file automatically -depending on the OS and achitecture. +Easy method: + +1. Copy the source and header files to your project and include + [`subhook.c`](subhook.c) in your build. +2. On Windows only: Define `SUBHOOK_STATIC` before including `subhook.h`. + +With CMake: + +1. Copy the subhook repo to your project tree. +2. Call `add_subdirectory(path/to/subhook)` in your CMakeLists.txt. +3. Optional: configure how the library is built by setting these varaible prior + to `add_subdirectory(...)`: + + * `SUBHOOK_STATIC` - Build as static library (`OFF` by default) + * `SUBHOOK_INSTALL` - Enable installation and packaging of targets/files + with CPack (`OFF` by default) + * `SUBHOOK_TESTS` - Enable tests (`ON` by default) + * `SUBHOOK_FORCE_32BIT` - Configure for compiling 32-bit binaries on 64-bit + systems (default is `OFF`) Use of CMake is not mandatory, the library can be built wihtout it (no extra -build configuration required). +build configuration is required). Examples -------- @@ -118,7 +134,7 @@ Known issues ------------ * `subhook_get_trampoline()` may return NULL because only a small subset of - x86 instructions is supported by the disassembler in this library (just + x86 instructions is supported by the disassembler in this library (just common prologue instructions). As a workaround you can plug in a more advanced instruction length decoder using `subhook_set_disasm_handler()`. @@ -127,8 +143,8 @@ Known issues (sometimes compilers generate code like this), then you will not be able to hook it. - N is 5 by default: 1 byte for jmp opcode + 4 bytes for offset. But if you - enable the use of 64-bit offsets in 64-bit mode N becomes 14 (see the + N is 5 by default: 1 byte for jmp opcode + 4 bytes for offset. But if you + enable the use of 64-bit offsets in 64-bit mode N becomes 14 (see the definition of `subhook_jmp64`). * Some systems protect executable code form being modified at runtime, which |