#windows #executable #memory

no-std executable_memory

executable memory for windows and unix

2 releases

Uses old Rust 2015

0.1.2 Jan 17, 2018
0.1.0 Dec 17, 2017

#555 in Memory management

MIT license

7KB
134 lines

rs-executable_memory

executable memory for windows and unix

extern crate executable_memory;


use executable_memory::ExecutableMemory;


fn main() {
    let mut memory = ExecutableMemory::default(); // Page size 1

    // x86_64
    memory[0] = 0xb8;
    memory[1] = 0xff;
    memory[2] = 0xff;
    memory[3] = 0xff;
    memory[4] = 0xff;
    memory[5] = 0xc3;

    let f: fn() -> u32 = unsafe {
        mem::transmute((&memory[0..6]).as_ptr())
    };

    assert_eq!(f(), 4294967295);
}

Dependencies

~1–270KB