https://github.com/azamaulanaaa/winmem
windows memory patching
https://github.com/azamaulanaaa/winmem
memory patch rust windows
Last synced: 5 months ago
JSON representation
windows memory patching
- Host: GitHub
- URL: https://github.com/azamaulanaaa/winmem
- Owner: azamaulanaaa
- Created: 2024-07-07T14:33:24.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T11:13:20.000Z (over 1 year ago)
- Last Synced: 2025-04-04T06:24:18.444Z (over 1 year ago)
- Topics: memory, patch, rust, windows
- Language: Rust
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Examples
## Plant Vs Zombie (GOTY)
example as dll injection payload patching Plant Vs Zombie (GOTY) 32bit to never lost suns.
```rust
use winmem::{handle::Handle, patch::{BaseAddress, MemorySection, PatchHandle}, pattern::Pattern};
use windows::Win32::Foundation::{BOOL, HANDLE};
#[no_mangle]
#[allow(non_snake_case, unused_variables)]
extern "system" fn DllMain(dll_module: HANDLE, call_reason: u32, lpv_reserved: &u32) -> BOOL {
return match call_reason {
1 => on_process_attach(),
_ => BOOL(0),
};
}
fn on_process_attach() -> BOOL {
let handle = Handle::default();
let patch_handle = PatchHandle::new(&handle);
let _ = patch_handle.apply(
BaseAddress::Search(
Pattern::from([Some(0x2B), Some(0xF3), Some(0x89), Some(0xB7)]),
MemorySection::Module("PlantsVsZombies.exe"),
),
None::<&[usize; 0]>,
&[0x90, 0x90],
);
return BOOL(0);
}
```