Creates a private heap object that can be used by the calling process. The function reserves space in the virtual
address space of the process and allocates physical storage for a specified initial portion of this block.
/// <summary>
/// HeapCreate - Creates a private heap object that can be used by the calling process.
/// The function reserves space in the virtual address space of the process and allocates
/// physical storage for a specified initial portion of this block.
/// Ref: https://learn.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heapcreate
/// </summary>
/// <param name="flOptions"></param>
/// <param name="dwInitialSize"></param>
/// <param name="dwMaximumSize"></param>
/// <returns></returns>
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr HeapCreate(UInt32 flOptions, UIntPtr dwInitialSize, UIntPtr dwMaximumSize);
flOptions - https://pinvoke.net/default.aspx/Enums/flOptions.html
Conversion of Int/Unit32/long/UIntPtr/IntPtr - much debate, this code could be checked properly.
Please add some!
/// <summary>
/// HeapCreateMemory - Creates a private heap object that can be used by the
/// calling process. The function reserves space in the virtual address space
/// of the process and allocates physical storage for a specified initial portion of this block.
/// </summary>
/// <param name="optionType"></param>
/// <param name="initialbyteSize"></param>
/// <param name="MaxByteSize"></param>
/// <returns></returns>
public static IntPtr HeapCreateMemory(FLOptionType optionType, int initialbyteSize, int MaxByteSize)
{
try
{
return HeapCreate((UInt32)optionType, (UIntPtr)initialbyteSize, (UIntPtr)MaxByteSize);
}
catch (Exception e)
{
throw e;
}
}
Do you know one? Please contribute it!