IMDSPObject::Write

banner art

The Write method writes data to the object at the current position within the object. This operation is valid only if the storage object represents a file.

Syntax

HRESULT Write(BYTE*pData,DWORD*pdwSize,BYTEabMac[WMDM_MAC_LENGTH]);

Parameters

pData

[in]  Pointer to the buffer containing the data to write to the object. This parameter is encrypted and must be decrypted using CSecureChannelServer::DecryptParam with the MAC in abMac. See Remarks.

pdwSize

[in, out]  DWORD containing the number of bytes of data to write. Upon return, this parameter contains the actual number of bytes written. This parameter must be included in both the input and output message authentication codes.

abMac[WMDM_MAC_LENGTH]

[in, out]  Array of eight bytes containing the message authentication code for the parameter data of this method. (WMDM_MAC_LENGTH is defined as 8.)

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For an extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
WMDM_E_BUSY The media device is busy.
WMDM_E_INTERFACEDEAD The file or folder was previously deleted.
WMDM_E_CALL_OUT_OF_SEQUENCE Open was not called before calling Write.
E_INVALIDARG One or more parameters is invalid or is a NULL pointer.
E_FAIL An unspecified error occurred.
HRESULT_FROM_WIN32 (ERROR_DISK_FULL) Write failed because there is not enough space on the disk. Note: Use the macro HRESULT_FROM_WIN32 to convert the Windows error ERROR_DISK_FULL (defined in Winerror.h) to an HRESULT.

Remarks

The MAC used for encryption should include both pData and pdwSize in calls to CSecureChannelServer::MACUpdate.

This method must be implemented. It must not return WMDM_E_NOTSUPPORTED or E_NOTIMPL. For more information, see Mandatory and Optional Interfaces.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also