Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsAlloc function

Allocates a segment of memory from the specified heap.

Syntax


HRESULT WINAPI  WsAlloc(
  _In_     WS_HEAP*  heap,
  _In_     SIZE_T    size,
           void**    ptr,
  _In_opt_ WS_ERROR* error
);

Parameters

heap [in]

Pointer to a WS_HEAP structure representing the heap from which to allocate the memory.

size [in]

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.

error [in, optional]

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 codeDescription
WS_E_QUOTA_EXCEEDED

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.

E_OUTOFMEMORY

Insufficent memory to complete the operation.

 

Remarks

The memory returned by this function is not zero initialized and contains undefined values.

Requirements

Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]

Header

WebServices.h

Library

WebServices.lib

DLL

WebServices.dll

 

 

Show:
© 2018 Microsoft