ayosec/plthook-rust

Rust bindings for plthook

This crates provides Rust bindings for the API documentation and the description in the

This crates provides Rust bindings for the plthook library.

Please see the API documentation and the description in the plthook library for more details.

Examples

To print symbols in the current process:

use plthook::ObjectFile;

fn main() {
    let object = ObjectFile::open_main_program().unwrap();

    for symbol in object.symbols() {
        println!("{:?} {:?}", symbol.func_address, symbol.name);
    }
}

To replace a symbol:

use libc::{c_char, c_int};
use plthook::ObjectFile;
use std::mem::MaybeUninit;

static mut ATOI_FN: MaybeUninit<fn(*const c_char) -> c_int> = MaybeUninit::uninit();

fn neg_atoi(nptr: *const c_char) -> c_int {
    let i = unsafe { (ATOI_FN.assume_init())(nptr) };
    -i
}

fn main() {
    let object = ObjectFile::open_main_program().unwrap();

    unsafe {
        let atoi_fn = ATOI_FN.as_mut_ptr() as *mut _;
        *atoi_fn = object.replace("atoi", neg_atoi as *const _).unwrap();
    };

    let i = unsafe { libc::atoi(b"100\0".as_ptr().cast()) };
    assert_eq!(i, -100);
}
Versions

Find the latest versions by id

0.2.2 - Aug 12, 2021

  • Don't leak ObjectFile instances when a Replacement is discarded.

0.2.1 - Aug 12, 2021

  • Now, lifetime of Replacement values is not bound to ObjectFile. Instead, they use a Rc pointer to have access it.

    This avoid problems when Replacement values are stored in another type.

0.2.0 - Aug 12, 2021

ObjectFile::replace returns values of Replacement types. When a Replacement is dropped, the original address in the PLT entry is restored.

0.1.0 - Jul 29, 2021

First version of the crate. Provides bindings for all functionality available in plthook, except for the plthook_open_by_address function.

Information - Updated Oct 13, 2021

Stars: 0
Forks: 0
Issues: 0

Rust bindings for libinjection

Add libinjection to dependencies of Cargo

Rust bindings for libinjection

Rust bindings for the shaderc library

Rust bindings for the Compiler interface to compile GLSL/HLSL

Rust bindings for the shaderc library

Rust bindings for the C++ api of PyTorch

LIghtweight wrapper for pytorch eg libtorch in rust

Rust bindings for the C++ api of PyTorch

Rust bindings for Sciter

this page for other language bindings (Delphi / D / Go /

Rust bindings for Sciter

Rust bindings to *nix APIs

wrapping the libc functionality with types/abstractions that enforce legal/safe

Rust bindings to *nix APIs

Rust bindings for the FLTK Graphical User Interface library

The fltk crate is a crossplatform lightweight gui library which can be statically linked to produce small, self-contained and fast gui applications

Rust bindings for the FLTK Graphical User Interface library

Rust bindings to bgfx, a cross-platform, graphics API agnostic, &quot;Bring Your Own Engine/Framework&quot; style rendering...

Rust bindings to wrapper for Rust exists, the code here takes a different approach and generate high-level bindings from the BGFX API examples an how...

Rust bindings to bgfx, a cross-platform, graphics API agnostic, &quot;Bring Your Own Engine/Framework&quot; style rendering...
Cargo

1.5K

Rust bindings for the python interpreter

Copyright (c) 2015-2021 Daniel Grunwald

Rust bindings for the python interpreter

Rust bindings for the NumPy C-API

Basically, our MSRV follows the one of ndarray for rust-side matrix library

Rust bindings for the NumPy C-API

Rust Bindings to AVX2-optimized SIP-like hash functions

bindings to three hash functions implemented in C++

Rust Bindings to AVX2-optimized SIP-like hash functions

Rust bindings for Torch

rs (torturous) is a set of Rust bindings for torch intended

Rust bindings for Torch

Rust bindings to libdeflate, a high-performance

Rust bindings to libdeflate

Rust bindings to libdeflate, a high-performance
Facebook Instagram Twitter GitHub Dribbble
Privacy