WsAlloc function (webservices.h)
Allocates a segment of memory from the specified heap.
Syntax
HRESULT WsAlloc(
[in] WS_HEAP *heap,
[in] SIZE_T size,
void **ptr,
[in, optional] WS_ERROR *error
);
Parameters
[in] heap
Pointer to a WS_HEAP structure representing the heap from which to allocate the memory.
[in] size
The number of bytes to allocate. This value can be zero.
ptr
On success, a pointer that receives the address of the allocated memory. This pointer is valid until WsFreeHeap or WsResetHeap is called on the heap.
The returned pointer is aligned on an 8-byte boundary.
Zero byte allocations will return a non-NULL pointer.
[in, optional] error
Pointer to a WS_ERROR structure that receives additional error information if the function fails.
Return value
If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.
Return code | Description |
---|---|
|
The requested bytes, in addition to already allocated bytes, exceed the size of the heap, as specified by the WS_HEAP_PROPERTY_MAX_SIZE property. |
|
Insufficient memory to complete the operation. |
Remarks
The memory returned by this function is not zero initialized and contains undefined values.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 R2 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | webservices.h |
Library | WebServices.lib |
DLL | WebServices.dll |