Expand Minimize

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 | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

WebServices.h

Library

WebServices.lib

DLL

WebServices.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft