Added a test for dumping modules

This commit is contained in:
Ryan McCrystal
2022-02-08 20:20:10 -08:00
parent 22b9aec17c
commit a4f2c06501
+13
View File
@@ -95,6 +95,19 @@ fn test_read_memory() {
dbg!(buf);
}
#[test]
fn test_dump_module() {
let handle = get_handle();
let notepad = Process::notepad();
let proc = handle.attach_pid(notepad.pid()).unwrap();
let main_mod = proc.get_main_module();
let mut buf = vec![0u8; main_mod.size as _];
proc.try_read_bytes_into(main_mod.base, &mut buf).unwrap();
assert_eq!(buf[0..2], [0x4Du8, 0x5A]);
}
#[test]
fn test_write_memory() {
let handle = get_handle();