public override unsafe bool ChangeProtection(ProtectionEnums.ProtectionTypes protection) { uint dummy; return(MemNativeMethods.VirtualProtect( handle, (IntPtr)PageSize, (uint)protection, &dummy)); }
protected override bool ReleaseHandle() { return(MemNativeMethods.VirtualFree( handle, (IntPtr)0, (uint)MemFreeEnums.MemFreeTypeFlags.MEM_RELEASE)); }
public MemoryPageImpl(bool commit = true) { var flags = MemAllocEnums.MemAllocTypeFlags.MEM_RESERVE; if (commit) { flags |= MemAllocEnums.MemAllocTypeFlags.MEM_COMMIT; } handle = MemNativeMethods.VirtualAlloc(IntPtr.Zero, (IntPtr)PageSize, (uint)flags, (uint)ProtectionEnums.ProtectionTypes.PAGE_EXECUTE_READWRITE ); }