Kernel32HeapAlloc Method
Allocates a block of memory from a heap. The allocated memory is not movable.
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")]
public static IntPtr HeapAlloc(
IntPtr hHeap,
HeapFlags flags,
uint bytes
)
<DllImportAttribute("Kernel32.dll">]
Public Shared Function HeapAlloc (
hHeap As IntPtr,
flags As HeapFlags,
bytes As UInteger
) As IntPtr
Dim hHeap As IntPtr
Dim flags As HeapFlags
Dim bytes As UInteger
Dim returnValue As IntPtr
returnValue = Kernel32.HeapAlloc(hHeap,
flags, bytes)
public:
[DllImportAttribute(L"Kernel32.dll")]
static IntPtr HeapAlloc(
IntPtr hHeap,
HeapFlags flags,
unsigned int bytes
)
[<DllImportAttribute("Kernel32.dll")>]
static member HeapAlloc :
hHeap : IntPtr *
flags : HeapFlags *
bytes : uint32 -> IntPtr
No code example is currently available or this language may not be supported.
- hHeap IntPtr
-
A handle to the heap from which the memory will be allocated.
This handle is returned by either the
HeapCreate(HeapFlags, UInt32, UInt32) or GetProcessHeap function.
- flags HeapFlags
-
The heap allocation options.
Specifying any of the HeapFlags values will override the corresponding value specified
when the heap was created with HeapCreate(HeapFlags, UInt32, UInt32).
- bytes UInt32
-
The number of bytes to be allocated.
If the heap specified by the hHeap parameter is a "non-growable" heap,
bytes parameter must be less than 0x7FFF8.
You create a non-growable heap by calling the HeapCreate(HeapFlags, UInt32, UInt32) function
passing a nonzero value to its maximumSize parameter.
IntPtr
If the function succeeds, the return value is a pointer to the allocated memory block.
If the function fails and you have not specified
GenerateExceptions,
the return value is
Zero.
If the function fails and you have specified
GenerateExceptions,
the function may generate an exception.
The particular exception depends upon the nature of the heap corruption.
If the function fails, it does not call
SetLastError(Win32ErrorCode).
An application cannot call
GetLastWin32Error for extended error information.