Expand Minimize

WsFillReader function

Ensures that the reader has buffered the minimum byte count of XML data for use by subsequent reader functions. It will invoke the callback specified by WS_XML_READER_STREAM_INPUT as many times as necessary to obtain the number of bytes specified by the value of the minSize parameter. On completion the buffered data is available to other reader functions. If a subsequent reader function requires more data than what has been obtained the function will return a WS_E_QUOTA_EXCEEDED exception. (See Windows Web Services Return Values.)

Syntax


HRESULT WINAPI  WsFillReader(
  _In_      WS_XML_READER* reader,
  _In_      ULONG minSize,
  _In_opt_  const WS_ASYNC_CONTEXT* asyncContext,
  _In_opt_  WS_ERROR* error
);

Parameters

reader [in]

A pointer to a WS_XML_READER structure used for obtaining the data.

minSize [in]

Specifies the minimum number of bytes that the reader should have obtained. If the current byte count buffered is equal to or greater than the value of minSize the function will do nothing and will return immediately.

asyncContext [in, optional]

A pointer to a WS_ASYNC_CONTEXT data structure with information about invoking the function asynchronously. A NULL value indicates a request for synchronous operation.

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
WS_S_ASYNC

The asynchronous operation is still pending.

 

Security

When using WS_XML_READER_STREAM_INPUT the user of the reader is faced with a potentially unbounded input source, from a data source with unknown characteristics. Many of the reader properties will continue to help guard against malicious or malformed documents, but there are additional threats that they cannot mitigate. Users should exercise additional care when consuming untrusted data from an unknown provider, and consider the following potential situations.

  • The document contains arbitrarily large textual content.
  • The document contains arbitrarily long whitespace.
  • The provider of the data does not fail but does not produce data either.
  • The provider of the data does so, but slowly. Mitigations to this situations include:
  • When calling WsReadChars or other incremental read functions, ensure there are limits on how much will be read.
  • When reading elements in a loop, ensure there are limits on how many will be read.
  • When implementing WS_READ_CALLBACK in WS_XML_READER_STREAM_INPUT ensure that data arrives in a timely fashion, consider placing upper limits on the total amount of data read.

Remarks

The number of bytes required to read a particular segment of XML data depends upon the encoding and its formatting.

This function is a "no-op" when used with a reader using WS_XML_READER_BUFFER_INPUT.

By specifying a WS_ASYNC_CONTEXT the data is read asynchronously.

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