19 releases
0.2.2 | Jun 25, 2025 |
---|---|
0.2.1 | Jun 5, 2025 |
0.1.19 | Jun 1, 2025 |
0.1.18 | May 31, 2025 |
#43 in Windows APIs
175 downloads per month
225KB
1K
SLoC
memory_utils
A simple and safe(ish) Rust library for reading and writing memory of external Windows processes. Useful for building tools like trainers, debuggers, and analyzers.
Please note that this is project is in its early stages so bugs may occur.
To get the cargo crate check out this link
A simple project I made using this library is a walk speed modifier. You can find it here
Features
- Read and write memory of external processes.
- Get process ID (PID) by process name.
- Suspend, resume, and terminate threads or processes.
- Read null-terminated strings from memory.
- Query memory pages using
VirtualQueryEx
. - Built on top of WinAPI.
Changelogs
-
0.1.2
:- Fixed Process::pid() error "STATUS_HEAP_CORRUPTION" which was caused by a bad conversion from cstring into rust string
-
0.1.4
:- Fixed general pattern scanning ( added more protection checks, and fixed stuck in a loop or not finding it)
-
0.1.6
:- Added
process.get_module
andprocess.get_base_address
, - Removed duplicated
mbi.Protect == PAGE_READWRITE
check frompattern_scan
which should speed it up a bit.
- Added
-
0.1.8
:- Added every protection option to
ProtectOptions
, Addedprocess.get_protection
- Added every protection option to
-
0.1.9 & 0.1.10
:- Fixed accidental mistake of doing
addr as LPVOID
instead ofaddr as LCPVOID
- Fixed accidental mistake of doing
-
0.1.11
:- Fixed
process.get_threads()
since it hadTH32CS_SNAPPROCESS
instead ofTH32CS_SNAPTHREAD
- Fixed
-
0.1.12
:- Fixed
process.get_thread_context()
error due to invalid handling of the returned error (?
->is_err()
)
- Fixed
-
0.1.13
:- Optimized
process.find_pattern_str
andprocess.pattern_scan
by using the Boyer-Moore-Horspool algorithm infind_pattern
- Optimized
-
0.1.14
:- Fixed
process.read_stack
, - Added
process.pe_headers
- Fixed
-
0.1.15
:- Made
process.sanitize_bytes
public, - Added
process.get_modules
, - Added
process.is_valid_address
, - Added
process.allocate
, - Added
process.trampoline_hook
- Added
process.place_absolute_jmp
- Made
-
0.1.17
:- Added
process.write_bytes
- Added
-
0.1.18
:- Made
pid
inProcess
public - Added
handle
to theProcess
struct (so that it doesn't open a new handle everytime. This is due to performance)
- Made
-
0.1.19
:- The
Process
struct can now be safely shared between threads - Implemented
clone
forProcess
- The
-
0.2.2
:- Added
process.read_bytes
- Improved
process.read_string
by usingprocess.read_bytes
instead of going character-by-character
- Added
0.2.0
- Added
DllLib
(memory_utils::dll), seperate from the main process
- Added
Example
use memory_utils::process::Process;
fn main() {
// Get the PID of the target process
let pid = Process::pid("RobloxPlayerBeta.exe").expect("Failed to find process");
// Create a new process handle
let process = Process::new(pid);
// Read an integer from an address
let value: i32 = process.read_memory(0x00ABCDEF).expect("Failed to read memory");
// Write a new value
process.write_memory(0x00ABCDEF, &1337).expect("Failed to write memory");
// Read a string (null-terminated)
let name = process.read_string(0x00FFEEDD).expect("Failed to read string");
println!("Read value: {}, Read string: {}", value, name);
}