public RemoteMemoryProtection(RemoteProcess process, IntPtr pointer, int size, Natives.Enumerations.MemoryProtectionFlags newProtection) : base(process, pointer) { NewProtection = newProtection; Size = size; Natives.Enumerations.MemoryProtectionFlags oldProtection; Natives.Syscall.ProtectVirtualMemory(Process.ProcessHandle, Pointer, Size, NewProtection, out oldProtection); OldProtection = oldProtection; }
/// <summary> /// Change the memory protection and return a RemoteMemoryProtection object /// </summary> /// <param name="lpAddress"></param> /// <param name="size"></param> /// <param name="newProtection"></param> /// <returns></returns> public RemoteMemoryProtection ProtectMemory(IntPtr lpAddress, int size, Natives.Enumerations.MemoryProtectionFlags newProtection) { return(new RemoteMemoryProtection(this, lpAddress, size, newProtection)); }