/// <summary> /// Releases, decommits, or releases and decommits a region of memory within the virtual address space of a specified /// process. /// </summary> /// <param name="_hProcess">Handle to the process in which memory will be freed.</param> /// <param name="_memAddress">A pointer to the starting address of the region of memory to be freed. </param> /// <param name="_bytesCount"> /// The size of the region of memory to free, in bytes. /// If the dwFreeType parameter is MEM_RELEASE, dwSize must be 0 (zero). The function frees the entire region that is /// reserved in the initial allocation call to VirtualAllocEx. /// </param> /// <param name="_freeType">The type of free operation. See <see cref="OnyxNative.MemoryFreeType" />.</param> /// <returns>Returns true on success, false on failure.</returns> public static bool FreeMemory(IntPtr _hProcess, IntPtr _memAddress, uint _bytesCount, uint _freeType) { if (_freeType == OnyxNative.MemoryFreeType.MEM_RELEASE) { _bytesCount = 0; } return(OnyxNative.VirtualFreeEx(_hProcess, _memAddress, _bytesCount, _freeType)); }