NtProtectVirtualMemory - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTMMAPI_H
// Virtual memory
#if (PHNT_MODE != PHNT_MODE_KERNEL)

NTSYSCALLAPI
NTSTATUS
NTAPI
NtProtectVirtualMemory(
    _In_ HANDLE ProcessHandle,
    _Inout_ PVOID *BaseAddress,
    _Inout_ PSIZE_T RegionSize,
    _In_ ULONG NewProtect,
    _Out_ PULONG OldProtect
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwProtectVirtualMemory(
    _In_ HANDLE ProcessHandle,
    _Inout_ PVOID *BaseAddress,
    _Inout_ PSIZE_T RegionSize,
    _In_ ULONG NewProtect,
    _Out_ PULONG OldProtect
    );

#endif

View code on GitHub

ProcessHandle

Handle to Process Object opened with PROCESS_VM_OPERATION access.

*BaseAddress

Pointer to base address to protect. Protection will change on all page containing specified address. On output, BaseAddress will point to page start address.

NumberOfBytesToProtect

Pointer to size of region to protect. On output will be round to page size (4KB).

NewAccessProtection

One or some of PAGE_... attributes.

OldAccessProtection

Receive previous protection.

Documented by

See also