Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
abbiecnt committed Aug 27, 2024
1 parent 7974085 commit 83f59ca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
24 changes: 24 additions & 0 deletions src/hook.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pub trait Hook<F>: Copy {
fn as_ptr_u8(self) -> *mut u8;
fn trampoline(f: F) -> Closure<F>;
}

pub struct HookGuard {
bytes: [u8; 16],
}

impl HookGuard {
pub fn unhook(&self) {}
}


pub struct Closure<F> {
inner: Box<ClosureInner<F>>
}

#[repr(C)]
struct ClosureInner<F> {
ptr: *const (),
data: F,
}

8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 83f59ca

Please sign in to comment.