WMValidateData function (wmsdkvalidate.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The WMValidateData function verifies that data from the beginning of a file is consistent with the header section of a file type that is supported by the Windows Media Format SDK.

If you are writing an application that can handle many different file types, you can use this function to try to quickly determine whether the file can be read using the Windows Media Format SDK.

Syntax

HRESULT WMValidateData(
  [in]      BYTE  *pbData,
  [in, out] DWORD *pdwDataSize
);

Parameters

[in] pbData

Pointer to a BYTE array containing the data buffer to validate. This data should be part of a file, starting at the beginning of the file, and continuing for the number of bytes specified in pdwDataSize.

You can set this parameter to NULL to retrieve the minimum number of bytes to pass.

[in, out] pdwDataSize

Pointer to a DWORD containing the data size. If pbData is set to NULL, this value will be set to the minimum buffer size on return. The minimum buffer size is 512 bytes.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The function succeeded.
NS_E_INVALID_DATA
The file cannot be handled by the objects of the Windows Media Format SDK.
E_INVALIDARG
pdwDataSize is NULL.
ASF_E_BUFFERTOOSMALL
The pdwDataSize parameter points to a value that is smaller than the minimum data buffer required to validate the data.

Remarks

This function is typically used after a call to WMCheckURLExtension. This is for efficiency, because WMValidateData requires that you read some of the data from the file, whereas WMCheckURLExtension only evaluates the file name extension.

It is possible for this function to identify a file as playable when it is not playable. However, if the function identifies a file as not playable, the file is certainly not playable.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkvalidate.h (include Wmsdkidl.h)
Library Wmvcore.lib
DLL Wmvcore.dll

See also

Functions