Error Constants

Windows Portable Devices methods can return a variety of HRESULT error codes. Some are specific to Windows Portable Devices, while others are defined by other SDKs or porting kits used to build a device. This section describes the various error codes that can be returned, organized by origin.

WPD defines the following error constants.

Constant/valueDescription
E_WPD_DEVICE_ALREADY_OPENED
0x802A0001

The device connection has already been opened by a prior call to IPortableDevice::Open.

E_WPD_DEVICE_IS_HUNG
0x802A0006

The device will no longer respond to input.

E_WPD_DEVICE_NOT_OPEN
0x802A0002

The device connection has not yet been opened by a call to IPortableDevice::Open.

E_WPD_OBJECT_ALREADY_ATTACHED_TO_DEVICE
0x802A0003

The interface object has already been attached to the device interface.

E_WPD_OBJECT_ALREADY_ATTACHED_TO_SERVICE
0x802A00CA

The interface object has already been attached to the IPortableDeviceService interface.

E_WPD_OBJECT_NOT_ATTACHED_TO_DEVICE
0x802A0004

The interface object has not been attached to the device.

E_WPD_OBJECT_NOT_ATTACHED_TO_SERVICE
0x802A00CB

The interface object has not been attached to the IPortableDeviceService interface. Typically, this is returned if the application tries to access methods of an attached interface, such as IPortableDeviceServiceCapabilities, after IPortableDevice::Close is called.

E_WPD_OBJECT_NOT_COMMITED
0x802A0005

IStream::Commit was never called when creating an object with data on a device.

E_WPD_SERVICE_ALREADY_OPENED
0x802A00C8

The service connection has already been opened by a prior call to IPortableDevice::Open.

E_WPD_SERVICE_BAD_PARAMETER_ORDER
0x802A00CC

The method parameters for IPortableDeviceServiceMethods::Invoke or IPortableDeviceServiceMethods::InvokeAsync are not set in the correct order. The parameter must be set in the ordering specified by WPD_PARAMETER_ATTRIBUTE_ORDER.

E_WPD_SERVICE_NOT_OPEN
0x802A00C9

The service connection has not yet been opened by a call to IPortableDeviceService::Open.

E_WPD_SMS_INVALID_RECIPIENT
0x802A0064

The recipient specified for an SMS message is invalid.

E_WPD_SMS_INVALID_MESSAGE_BODY
0x802A0065

The body of a message specified for an SMS message is invalid.

E_WPD_SMS_SERVICE_UNAVAILABLE
0x802A0066

The SMS service is unavailable.

Occasionally, you might encounter an error defined in the Windows Media Rights Manager SDK. A list of errors defined by that SDK is given in the MSDN library. However, the following Windows Media Rights Manager SDK errors were not included in this documentation.

Constant/valueDescription
NS_E_DRM_DEBUGGING_NOT_ALLOWED
0xC00D2767

You cannot debug when accessing DRM-protected content.

NS_E_NOT_LICENSED
0xC00D00CD

The content is not licensed.

WPD may return standard Windows error codes to the application. The following table lists the most commonly-used standard Windows error codes and the common error conditions when using a WPD device.

Win32 error codes are converted to HRESULTs using the HRESULT_FROM_WIN32 macro.

Constant/valueDescription
ERROR_ACCESS_DENIED
0x80070005

May be used to indicate that a read-only object or property cannot be modified or deleted. May be used to indicate that the object is being accessed outside its scope, for example a child object that falls outside the hierarchy of a device service. May be used to indicate that the application does not have the access (for example, if access control to devices is restricted by Group Policy) to send WPD commands to the device.

ERROR_ARITHMETIC_OVERFLOW
0x80070216

May be used to indicate that the number of elements in a data array has exceeded its limits (ULONGLONG).

ERROR_BUSY
0x800700AA

May be used to indicate that the device is busy processing another operation. Applications should wait for that operation to complete before retrying.

ERROR_CANCELLED
0x800704C7

A command sent to the device has been aborted due to a cancellation, e.g. by calling one of the Cancel methods in the WPD API.

ERROR_DATATYPE_MISMATCH
0x8007070C

May be used to indicate that an invalid data packet was received from the device.

ERROR_DEVICE_IN_USE
0x80070964

For an MTP/IP device, indicates that the connection has failed to initialize because the device is in use.

ERROR_DEVICE_NOT_CONNECTE
0x8007048F

The device has been disconnected or unplugged.

ERROR_DIR_NOT_EMPTY
0x80070091

May be used to indicate that a non-recursive delete was called for an object with children. The application should use the recursive delete flag in IPortableDeviceContent::Delete.

ERROR_EMPTY
0x800710D2

May be used to indicate that the device failed to send any resource data when resource data was expected (e.g. a thumbnail or device icon). This usually indicates an error on the device.

ERROR_FILE_NOT_FOUND
0x80070002

May be used to indicate that the device has been disconnected or unplugged.

ERROR_GEN_FAILURE
0x8007001F

May be used to indicate that the device has stopped responding (hung) or a general failure has occurred on the device. The device may need to be manually reset.

ERROR_INVALID_DATA
0x8007000D

May be used to indicate that data sent to or received from the device cannot be parsed correctly. This may indicate a device-side or a transport error. If MTP vendor operations are sent to the device, this error may indicate that the specified operation parameters are not of the valid VARTYPE.

ERROR_INVALID_DATATYPE
0x8007070C

May be used to indicate that the specified VARTYPE is invalid for a given property.

ERROR_INVALID_FUNCTION
0x80070001

A write request was made to a resource on the device that was opened in Read mode using IPortableDeviceResources::GetStream, or a read request was made to a resource opened for Write or Create.

ERROR_INVALID_OPERATION
0x800710DD

A non-recursive delete is called for an object with children.

ERROR_INVALID_PARAMETER
0x80070057

The parameter supplied by the application is not valid.

ERROR_INVALID_TIME
0x8007076D

May be used to indicate that a conversion of a datetime property has failed.

ERROR_IO_DEVICE
0x8007045D

May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset.

ERROR_NOT_FOUND
0x80070490

May be used to indicate that the device supports a property, but that property value is currently empty or uninitialized. May be used to indicate that the internal context for a long-running operation no longer exists, as the operation has completed or has been cancelled. Examples of such operations include bulk properties, object enumeration, transfer, and invoking device service methods. Applications should retry the operation from the beginning. May be used to indicate that the specified object does not exist. The child object may be outside of the device service hierarchy.

ERROR_NOT_READY
0x80070015

May be used to indicate that an operation is not initialized correctly. This usually indicates an internal error, or that the application is using a stale device handle. The application should retry the operation from the beginning, or reopen the device.

ERROR_NOT_SUPPORTED
0x80070032

May be used to indicate that a property or command is not supported by the device.

ERROR_OPERATION_ABORTED
0x800703E3

A command sent to the device has been aborted due to a manual cancellation, e.g. by calling one of the Cancel methods in the WPD API.

ERROR_READ_FAULT
0x8007001E

May be used to indicate that the device is not sending the correct amount of data.

ERROR_RESOURCE_NOT_AVAILABLE
0x8007138E

May be used to indicate that a resource (such as a thumbnail or an icon) is not present on the device.

ERROR_SEM_TIMEOUT
0x80070079

May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset.

ERROR_TIMEOUT
0x800705B4

May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset.

ERROR_UNSUPPORTED_TYPE
0x8007065E

May be used to indicate that the specified format is not supported by the device.

ERROR_WRITE_FAULT
0x8007001D

May be used to indicate that the application was unable to send the requested amount of data to the device.

WSAETIMEDOUT
0x8007274c

For an MTP/IP device, indicates that the connection to the device has timed out. The device may need to be manually reconnected.

Media Transfer Protocol Error Codes

Devices that support Media Transfer Protocol (MTP) can return the following error codes. Most of these error codes imply an error in the MTP stack (communication between the MTP class driver and the device), but are helpful in diagnosing the error situation.

HRESULT descriptionMTP response codeMTP response code descriptionDetails
0x800420030x2003Session Not OpenIndicates that the session handle of the operation is not a currently open session. This indicates an internal error in the MTP stack.
0x800420040x2004Invalid TransactionIDIndicates that the TransactionID is zero or does not refer to a valid transaction. This indicates an internal error in the MTP stack.
0x800420050x2005Operation Not SupportedIndicates that the operation code appears to be a valid code, but the device does not support the operation. This indicates an internal error in the MTP stack.
0x800420060x2006Parameter Not SupportedIndicates that a non-zero parameter was specified in conjunction with the operation, and the parameter is not used for that operation. This indicates an internal error in the MTP stack.
0x800420070x2007Incomplete TransferIndicates that the transfer did not complete, and any data transferred should be discarded. This response does not correspond to a cancelled transaction.
0x800420080x2008Invalid StorageIDIndicates that a storage ID sent with an operation does not refer to an actual valid store that is present on the device. This indicates an internal error in the MTP stack.
0x800420090x2009Invalid ObjectHandleIndicates that an object handle does not refer to an actual object that is present on the device. The application should enumerate the storages again.
0x8004200A0x200ADeviceProp Not SupportedIndicates that the device property code appears to be a valid code, but that property is not supported by the device. This indicates an internal error in the MTP stack.
0x8004200B0x200BInvalid ObjectFormatCodeIndicates that the device does not support the particular object format code supplied in the given context.
0x800420120x2012Partial DeletionIndicates that only a subset of the storages indicated for deletion were actually deleted, because some were write-protected or were on stores that are read-only.
0x800420130x2013Store Not AvailableIndicates that the store (or the store that contains the indicated object) is not physically available. This can be caused by media ejection. This response shall not be used to indicate that the store is busy.
0x800420140x2014Specification By Format UnsupportedIndicates that the operation attempted to specify action only on objects of a particular format, and that capability is not supported. The operation should be attempted again without specifying by format. Any response of this nature infers that any future attempt to specify by format with the indicated operation will result in the same response. This indicates an internal error in the MTP stack.
0x800420150x2015No Valid ObjectInfoIndicates that the host did not provide valid object info to device before transferring the object. This indicates an internal error in the MTP stack.
0x800420160x2016Invalid Code FormatIndicates that the data code does not have the correct format, and is therefore not valid. This indicates an internal error in the MTP stack.
0x800420170x2017Unknown Vendor CodeDevice does not know how to handle the vendor extended code.
0x8004201A0x201AInvalid ParentObjectIndicates that the object is not a valid parent object. This indicates an internal error in the MTP stack.
0x8004201B0x201BInvalid DeviceProp FormatIndicates that an attempt was made to set a device property, but the data is not of the correct size or format. This indicates an internal error in the MTP stack.
0x8004201C0x201CInvalid DeviceProp ValueIndicates that an attempt was made to set a device property to a value that is not allowed by the device. This indicates an internal error in the MTP stack
0x8004201E0x201ESession Already OpenIndicates that the host tried to open session while a session is already open. This indicates an internal error in the MTP stack.
0x8004201F0x201FTransaction CancelledMay be used to indicate that the operation was interrupted due to manual cancellation.
0x800420200x2020Specification of Destination UnsupportedIndicates that device does not support the specification of destination by the host. This indicates an internal error in the MTP stack.
0x8004A8010xA801Invalid_ObjectPropCodeIndicates that the device does not support the sent Object Property Code in this context. This indicates an internal error in the MTP stack.
0x8004A8020xA802Invalid_ObjectProp_FormatIndicates that an object property sent to the device is in an unsupported size or type. This indicates an internal error in the MTP stack.
0x8004A8030xA803Invalid_ObjectProp_ValueIndicates that an object property sent to the device is the correct type, but contains a value that is not supported. This indicates an internal error in the MTP stack.
0x8004A8040xA804Invalid_ObjectReferenceIndicates that a sent Object Reference is not valid. Either the reference contains an object handle not present on the device, or the reference attempting to be set is unsupported in context. This can be due to an error in the MTP stack or due to application using a stale storage object.
0x8004A8060xA806Invalid_DatasetIndicates that the dataset sent in the data phase of this operation is invalid. This indicates an internal error in the MTP stack.
0x8004A8070xA807Object_Too_LargeIndicates that the object desired to be sent cannot be stored in the file system of the device. This shall not be returned when there is insufficient space on the storage.
0x8004A3010xA301Invalid_ServiceIDIndicates that a service ID sent with an operation does not refer to an actual valid service that is present on the device. This indicates an internal error in the MTP stack.
0x8004A3020xA302Invalid_ServicePropCodeIndicates that the device does not support the sent Service Property Code in this context. This indicates an internal error in the MTP stack.

 

Requirements

Header

PortableDevice.h

See also

Constants

 

 

Community Additions

ADD
Show: