/// <summary> /// Free a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="address">Address of the allocation.</param> public void Free(HeapAllocFlags flags, long address) { if (!NtRtl.RtlFreeHeap(_heap_handle, flags, new IntPtr(address))) { throw new NtException(NtObjectUtils.MapDosErrorToStatus()); } }
/// <summary> /// Free a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="address">Address of the allocation.</param> /// <param name="throw_on_error">True to throw on error.</param> public NtStatus Free(HeapAllocFlags flags, long address, bool throw_on_error) { if (!NtRtl.RtlFreeHeap(_heap_handle, flags, new IntPtr(address))) { return(NtObjectUtils.MapDosErrorToStatus().ToNtException(throw_on_error)); } return(NtStatus.STATUS_SUCCESS); }
/// <summary> /// Allocate a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="size">Size of the allocation.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The allocated memory address.</returns> public NtResult <long> Allocate(HeapAllocFlags flags, long size, bool throw_on_error) { long address = NtRtl.RtlAllocateHeap(_heap_handle, flags, new IntPtr(size)).ToInt64(); if (address == 0) { return(NtObjectUtils.MapDosErrorToStatus().CreateResultFromError <long>(throw_on_error)); } return(address.CreateResult()); }
/// <summary> /// Allocate a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="size">Size of the allocation.</param> /// <returns>The allocated memory address.</returns> public long Allocate(HeapAllocFlags flags, long size) { long address = NtRtl.RtlAllocateHeap(_heap_handle, flags, new IntPtr(size)).ToInt64(); if (address == 0) { throw new NtException(NtObjectUtils.MapDosErrorToStatus()); } return(address); }
public static extern void *HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr dwBytes);
internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes) { return(HeapAlloc(hHeap, dwFlags, new IntPtr(dwBytes))); }
internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes) { return(CP_malloc(dwBytes)); }
internal static bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem) { CP_free(lpMem); return(true); }
private static extern SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr dwBytes);
internal static extern bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem);
internal static partial SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, nint dwBytes);
/// <summary> /// Free a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="address">Address of the allocation.</param> public void Free(HeapAllocFlags flags, long address) { Free(flags, address, true); }
public static extern bool RtlFreeHeap(IntPtr HeapHandle, HeapAllocFlags Flags, IntPtr BaseAddress);
public static extern IntPtr RtlAllocateHeap(IntPtr HeapHandle, HeapAllocFlags Flags, IntPtr Size);
public static extern void* HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, UIntPtr dwBytes);
/// <summary> /// Allocate a buffer from the heap. /// </summary> /// <param name="flags">Heap flags.</param> /// <param name="size">Size of the allocation.</param> /// <returns>The allocated memory address.</returns> public long Allocate(HeapAllocFlags flags, long size) { return(Allocate(flags, size, true).Result); }
internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes) { return HeapAlloc(hHeap, dwFlags, new IntPtr(dwBytes)); }
internal static partial bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem);
public static extern IntPtr HeapAlloc( IntPtr hHeap, HeapAllocFlags dwFlags, uint dwBytes );