public bool AllocateMemory(uint size, out IntPtr address) { address = VirtualAllocEx(ProcessHandle, IntPtr.Zero, size, AllocationType.Commit, MemoryProtection.ExecuteReadWrite); if (address != IntPtr.Zero) { MemoryAllocations.Add(address, size); return(true); } address = IntPtr.Zero; return(false); }