diff --git a/Cargo.toml b/Cargo.toml index 23df3f64..a39935c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ ctor = "0.2.2" [features] default = [] +unwind-abis = [] nightly = [] thiscall-abi = ["nightly"] static-detour = ["nightly"] diff --git a/src/arch/x86/trampoline/mod.rs b/src/arch/x86/trampoline/mod.rs index ae286b9a..29576ded 100644 --- a/src/arch/x86/trampoline/mod.rs +++ b/src/arch/x86/trampoline/mod.rs @@ -3,7 +3,6 @@ use crate::arch::x86::thunk; use crate::error::{Error, Result}; use crate::pic; use iced_x86::{Decoder, DecoderOptions, Instruction, OpKind}; -use std::ptr::slice_from_raw_parts; use std::{mem, slice}; mod disasm; diff --git a/src/macros.rs b/src/macros.rs index 019d1ef7..340c931d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -186,10 +186,25 @@ macro_rules! impl_hookable { impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "win64" fn($($ty),*) -> Ret)); impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "C" fn($($ty),*) -> Ret)); impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "system" fn($($ty),*) -> Ret)); + #[cfg(feature = "unwind-abis")] + #[cfg_attr(docsrs, doc(cfg(feature = "unwind-abis")))] + impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "cdecl-unwind" fn($($ty),*) -> Ret)); + #[cfg(feature = "unwind-abis")] + #[cfg_attr(docsrs, doc(cfg(feature = "unwind-abis")))] + impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "stdcall-unwind" fn($($ty),*) -> Ret)); + #[cfg(feature = "unwind-abis")] + #[cfg_attr(docsrs, doc(cfg(feature = "unwind-abis")))] + impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "fastcall-unwind" fn($($ty),*) -> Ret)); + #[cfg(feature = "unwind-abis")] + #[cfg_attr(docsrs, doc(cfg(feature = "unwind-abis")))] + impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "C-unwind" fn($($ty),*) -> Ret)); #[cfg(feature = "thiscall-abi")] #[cfg_attr(docsrs, doc(cfg(feature = "thiscall-abi")))] impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "thiscall" fn($($ty),*) -> Ret)); + #[cfg(all(feature = "thiscall-abi", feature = "unwind-abis"))] + #[cfg_attr(docsrs, doc(cfg(all(feature = "thiscall-abi", feature = "unwind-abis"))))] + impl_hookable!(@impl_pair ($($nm : $ty),*) (extern "thiscall-unwind" fn($($ty),*) -> Ret)); }; (@impl_pair ($($nm:ident : $ty:ident),*) ($($fn_t:tt)*)) => {