public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, SizeT dwSize, uint flAllocationType, MemPageProtect flProtect);
public static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress, SizeT dwSize, MemPageProtect flNewProtect, [Out] out MemPageProtect lpflOldProtect);
public static bool VirtualProtect(this Process process, IntPtr addr, int size, MemPageProtect protect) { MemPageProtect oldProtect; return(WinAPI.VirtualProtectEx(process.Handle, addr, (SizeT)size, protect, out oldProtect)); }