Windows apps
Collapse the table of content
Expand the table of content
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.

WsGetCustomHeader function

Finds an application-defined header of the message and deserializes it.


HRESULT WINAPI  WsGetCustomHeader(
  _In_     WS_MESSAGE*                   message,
  _In_     const WS_ELEMENT_DESCRIPTION* customHeaderDescription,
  _In_     WS_REPEATING_HEADER_OPTION    repeatingOption,
  _In_     ULONG                         headerIndex,
  _In_     WS_READ_OPTION                readOption,
  _In_opt_ WS_HEAP*                      heap,
           void*                         value,
  _In_     ULONG                         valueSize,
           ULONG*                        headerAttributes,
  _In_opt_ WS_ERROR*                     error


message [in]

The message containing the header.

The message can be in any state but WS_MESSAGE_STATE_EMPTY.

customHeaderDescription [in]

A WS_ELEMENT_DESCRIPTION which describes the header element.

repeatingOption [in]

Whether the header may appear more than once in the message.

If WS_REPEATING_HEADER is used, then the header index indicates which of the headers with the specified headerName to return.

If WS_SINGLETON_HEADER is used, then the headerIndex must be zero.

headerIndex [in]

The zero-based index of the header within the set of headers with the specified headerName.

readOption [in]

Whether the value is required, and how to allocate the value. See WS_READ_OPTION for more information.

heap [in, optional]

The heap to store the deserialized header data in. If this is NULL, then the message heap will be used as required by the WS_READ_OPTION.


The interpretation of this parameter depends on the WS_READ_OPTION.

valueSize [in]

The interpretation of this parameter depends on the WS_READ_OPTION.


Returns the WS_HEADER_ATTRIBUTES for this header. The pointer may be NULL, in which case no attributes are returned.

error [in, optional]

Specifies where additional error information should be stored if the function fails.

Return value

This function can return one of these values.

Return codeDescription

The header does not exist, and is required.

WS_SINGLETON_HEADER was specified, and there are multiple instances of the type of header present in the message.

The input data was not in the expected format.


There size quota of the heap was exceeded.


There was not enough memory available to deserialize the header.


One or more of the parameters are incorrect.

Other Errors

This function may return other errors not listed above.



This API operates on headers targeted at the ultimate receiver. Headers targeted with a role/actor other than ultimate receiver are ignored by this API.


Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft