WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA command

Writes a block of data to a pending object created with WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA. The driver should write the specified data to the object and return the number of bytes written. It is acceptable for the driver to write data to the device as it comes in; it does not need to cache all of the data. However, the object should only be considered complete when WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT is called. If WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT is later received for this object, the driver is expected to delete the object.

Command category

WPD_CATEGORY_OBJECT_MANAGEMENT

Parameters

ParametersVarTypeDescription

The driver expects the following parameters.

WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT

VT_LPWSTR

Required. A unique ID identifying the object creation session, created by the driver when WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA was called.

WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_TO_WRITE

VT_UI4

Required. The number of bytes to write to the object.

WPD_PROPERTY_OBJECT_MANAGEMENT_DATA

VT_VECTOR|VT_UI1

Required. The byte array holding the data to write to the object.

Return value

ResultVarTypeDescription

The driver should return the following results.

WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_WRITTEN

VT_UI4

Required. The number of bytes actually written to the object. It is normally considered an error if this value does not match the number of bytes the client requested to write.

WPD_PROPERTY_COMMON_HRESULT

VT_ERROR

Required. An HRESULT that indicates success or failure to carry out the command. If the caller is making an invalid request, the driver should return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED). If the caller is attempting a write operation but the device has insufficient space, the driver should return HRESULT_FROM_WIN32(ERROR_DISK_FULL). Error codes include Windows Portable Devices error codes or any other appropriate error codes.

WPD_PROPERTY_COMMON_DRIVER_ERROR_CODE

VT_UI4

Optional. A driver-specific error code. This value is typically used by device vendors to improve diagnosis of device errors while using their applications. General purpose applications would ignore it and rely solely on WPD_PROPERTY_COMMON_HRESULT instead.

Calling methods

  • IStream::Write
  • IPortableDeviceDataStream::Write (inherited from IStream)

Requirements

Header

PortableDevice.h

See also

Commands

 

 

Send comments about this topic to Microsoft

Show: