From 83f59ca108362736fef559af77e0e7bd3a3b1f38 Mon Sep 17 00:00:00 2001 From: KiraCoding <38864051+KiraCoding@users.noreply.github.com> Date: Tue, 27 Aug 2024 22:00:55 +0200 Subject: [PATCH] wip --- src/hook.rs | 24 ++++++++++++++++++++++++ src/lib.rs | 8 +++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/hook.rs diff --git a/src/hook.rs b/src/hook.rs new file mode 100644 index 0000000..b836588 --- /dev/null +++ b/src/hook.rs @@ -0,0 +1,24 @@ +pub trait Hook: Copy { + fn as_ptr_u8(self) -> *mut u8; + fn trampoline(f: F) -> Closure; +} + +pub struct HookGuard { + bytes: [u8; 16], +} + +impl HookGuard { + pub fn unhook(&self) {} +} + + +pub struct Closure { + inner: Box> +} + +#[repr(C)] +struct ClosureInner { + ptr: *const (), + data: F, +} + diff --git a/src/lib.rs b/src/lib.rs index ea0b9d0..9d8c870 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,8 @@ mod base; mod program; mod section; -pub use base::*; -pub use program::*; -pub use section::*; +pub mod hook; + +pub use base::Base; +pub use program::Program; +pub use section::Section;