MCPcopy Create free account
hub / github.com/changeofpace/Self-Remapping-Code / NtProtectVirtualMemory

Method NtProtectVirtualMemory

Self-Remapping Code/ntapi.cpp:66–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64// Virtual Memory
65
66ntapi::NTSTATUS
67NTAPI
68ntapi::NtProtectVirtualMemory(
69 IN HANDLE ProcessHandle,
70 IN OUT PVOID *BaseAddress,
71 IN OUT PSIZE_T NumberOfBytesToProtect,
72 IN ULONG NewAccessProtection,
73 OUT PULONG OldAccessProtection)
74{
75 typedef NTSTATUS(NTAPI* NtProtectVirtualMemory_t)(HANDLE, PVOID, PSIZE_T, ULONG, PULONG);
76 static NtProtectVirtualMemory_t Fn = NtProtectVirtualMemory_t(GetProcAddress(hmNtdll, "NtProtectVirtualMemory"));
77 if (Fn)
78 return Fn(ProcessHandle, BaseAddress, NumberOfBytesToProtect, NewAccessProtection, OldAccessProtection);
79 SetLastError(ERROR_PROC_NOT_FOUND);
80 return STATUS_PROCEDURE_NOT_FOUND;
81}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected