public static void Free(SafeMemoryHandle processHandle, IntPtr address)
{
// Check if the handles are valid
HandleManipulator.ValidateAsArgument(processHandle, "processHandle");
HandleManipulator.ValidateAsArgument(address, "address");
// Free the memory
if (!NativeMethods.VirtualFreeEx(processHandle, address, 0, MemoryReleaseFlags.Release))
{
// If the memory wasn't correctly freed, throws an exception
throw new Win32Exception(string.Format("The memory page 0x{0} cannot be freed.", address.ToString("X")));
}
}