/// <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);
        }
Exemplo n.º 5
0
 public static extern void *HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr dwBytes);
Exemplo n.º 6
0
 internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes)
 {
     return(HeapAlloc(hHeap, dwFlags, new IntPtr(dwBytes)));
 }
Exemplo n.º 7
0
 internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes)
 {
     return(CP_malloc(dwBytes));
 }
Exemplo n.º 8
0
 internal static bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem)
 {
     CP_free(lpMem);
     return(true);
 }
Exemplo n.º 9
0
 private static extern SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr dwBytes);
Exemplo n.º 10
0
 internal static extern bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem);
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 13
0
 private static extern SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr dwBytes);
 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);
 }
Exemplo n.º 18
0
 internal static extern bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem);
Exemplo n.º 19
0
 internal static SafeHeapAllocHandle HeapAlloc(IntPtr hHeap, HeapAllocFlags dwFlags, int dwBytes)
 {
     return HeapAlloc(hHeap, dwFlags, new IntPtr(dwBytes));
 }
Exemplo n.º 20
0
 internal static partial bool HeapFree(IntPtr hHeap, HeapAllocFlags dwFlags, IntPtr lpMem);
Exemplo n.º 21
0
 public static extern IntPtr HeapAlloc(
     IntPtr hHeap,
     HeapAllocFlags dwFlags,
     uint dwBytes
     );