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.

WsInitializeMessage function

This function initializes the headers for the message in preparation for processing. After a message has been initialized an application can add additional headers. On success the message is in WS_MESSAGE_STATE_INITIALIZED state. If the function fails, then no state transitions occurs.


HRESULT WINAPI  WsInitializeMessage(
  _In_     WS_MESSAGE*               message,
  _In_     WS_MESSAGE_INITIALIZATION initialization,
  _In_opt_ WS_MESSAGE*               sourceMessage,
  _In_opt_ WS_ERROR*                 error


message [in]

A pointer to the Message object to initialize. The Message must be a valid WS_MESSAGE object instance returned by WsCreateMessage or WsCreateMessageForChannel and may not be NULL.

initialization [in]

Defines the Message initialization.

Note  If the initialization value is set to WS_REPLY_MESSAGE or WS_FAULT_MESSAGE the message is automatically addressed.
sourceMessage [in, optional]

A pointer to a message object that is used to initialize the message parameter. This value should be NULL unless the initialization parameter has the value of WS_DUPLICATE_MESSAGE, WS_REPLY_MESSAGE, or WS_FAULT_MESSAGE.

error [in, optional]

A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.

Return value

This function can return one of these values.

Return codeDescription

Ran out of memory.


One or more arguments are invalid.

Other Errors

This function may return other errors not listed above.



The initial sender of a message should add an action header to the message using WsSetHeader.

This API must be called before WsWriteEnvelopeStart or WsWriteMessageStart is called for the message.


Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

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









Community Additions

© 2017 Microsoft