Kernel32VirtualFreeEx(IntPtr, UIntPtr, UIntPtr, MemoryFreeType) Method
Releases, decommits, or releases and decommits a region of memory
within the virtual address space of a specified process.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", SetLastError = true)]
public static bool VirtualFreeEx(
IntPtr process,
UIntPtr address,
UIntPtr size,
MemoryFreeType freeType
)
<DllImportAttribute("Kernel32.dll", SetLastError := true>]
Public Shared Function VirtualFreeEx (
process As IntPtr,
address As UIntPtr,
size As UIntPtr,
freeType As MemoryFreeType
) As Boolean
Dim process As IntPtr
Dim address As UIntPtr
Dim size As UIntPtr
Dim freeType As MemoryFreeType
Dim returnValue As Boolean
returnValue = Kernel32.VirtualFreeEx(process,
address, size, freeType)
public:
[DllImportAttribute(L"Kernel32.dll", SetLastError = true)]
static bool VirtualFreeEx(
[InAttribute] IntPtr process,
[InAttribute] UIntPtr address,
UIntPtr size,
MemoryFreeType freeType
)
[<DllImportAttribute("Kernel32.dll", SetLastError = true)>]
static member VirtualFreeEx :
process : IntPtr *
address : UIntPtr *
size : UIntPtr *
freeType : MemoryFreeType -> bool
No code example is currently available or this language may not be supported.
- process IntPtr
-
A handle to a process. The function frees memory within the virtual address space of the process.
The handle must have the VirtualMemoryOperation access right.
- address UIntPtr
-
A pointer to the starting address of the region of memory to be freed.
If the freeType parameter is Release,
this parameter must be the base address returned by the VirtualAllocEx(IntPtr, IntPtr, IntPtr, MemoryAllocationType, MemoryProtectionOptions) function
when the region of pages is reserved.
- size UIntPtr
-
The size of the region of memory to be freed, in bytes.
If the freeType parameter is Release,
this parameter must be 0 (zero).
The function frees the entire region that is reserved in the initial allocation call to
VirtualAlloc(IntPtr, IntPtr, MemoryAllocationType, MemoryProtectionOptions) function.
If freeType parameter is Decommit,
the function decommits all memory pages that contain one or more bytes
in the range from the address parameter to (address+size).
This means, for example, that a 2-byte region of memory that straddles a page boundary
causes both pages to be decommitted.
If address parameter is the base address returned by
VirtualAllocEx(IntPtr, IntPtr, IntPtr, MemoryAllocationType, MemoryProtectionOptions) and size parameter is 0 (zero),
the function decommits the entire region that is allocated by VirtualAllocEx(IntPtr, IntPtr, IntPtr, MemoryAllocationType, MemoryProtectionOptions).
After that, the entire region is in the reserved state.
- freeType MemoryFreeType
-
The type of free operation.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.