MCPcopy Create free account
hub / github.com/Kudaes/Split / nt_protect_virtual_memory

Function nt_protect_virtual_memory

dinvoke/src/lib.rs:713–727  ·  view source on GitHub ↗

Dynamically calls NtProtectVirtualMemory. It will return the NTSTATUS value returned by the call.

(handle: HANDLE, base_address: *mut PVOID, size: *mut usize, new_protection: u32, old_protection: *mut u32)

Source from the content-addressed store, hash-verified

711///
712/// It will return the NTSTATUS value returned by the call.
713pub fn nt_protect_virtual_memory (handle: HANDLE, base_address: *mut PVOID, size: *mut usize, new_protection: u32, old_protection: *mut u32) -> i32 {
714
715 unsafe
716 {
717 let ret;
718 let func_ptr: data::NtProtectVirtualMemory;
719 let ntdll = get_module_base_address(&lc!("ntdll.dll"));
720 dynamic_invoke!(ntdll,&lc!("NtProtectVirtualMemory"),func_ptr,ret,handle,base_address,size,new_protection,old_protection);
721
722 match ret {
723 Some(x) => return x,
724 None => return -1,
725 }
726 }
727}
728
729/// Dynamically calls NtQueryInformationProcess.
730///

Callers 1

mainFunction · 0.85

Calls 1

get_module_base_addressFunction · 0.85

Tested by

no test coverage detected