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/value | Description |
---|---|
|
The device connection has already been opened by a prior call to IPortableDevice::Open. |
|
The device will no longer respond to input. |
|
The device connection has not yet been opened by a call to IPortableDevice::Open. |
|
The interface object has already been attached to the device interface. |
|
The interface object has already been attached to the IPortableDeviceService interface. |
|
The interface object has not been attached to the device. |
|
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. |
|
IStream::Commit was never called when creating an object with data on a device. |
|
The service connection has already been opened by a prior call to IPortableDevice::Open. |
|
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. |
|
The service connection has not yet been opened by a call to IPortableDeviceService::Open. |
|
The recipient specified for an SMS message is invalid. |
|
The body of a message specified for an SMS message is invalid. |
|
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 provided at Error Codes and Messages. However, the following Windows Media Rights Manager SDK errors were not included in this documentation.
Constant/value | Description |
---|---|
|
You cannot debug when accessing DRM-protected content. |
|
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/value | Description |
---|---|
|
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. |
|
May be used to indicate that the number of elements in a data array has exceeded its limits (ULONGLONG). |
|
May be used to indicate that the device is busy processing another operation. Applications should wait for that operation to complete before retrying. |
|
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. |
|
May be used to indicate that an invalid data packet was received from the device. |
|
For an MTP/IP device, indicates that the connection has failed to initialize because the device is in use. |
|
The device has been disconnected or unplugged. |
|
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. |
|
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. |
|
May be used to indicate that the device has been disconnected or unplugged. |
|
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. |
|
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. |
|
May be used to indicate that the specified VARTYPE is invalid for a given property. |
|
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. |
|
A non-recursive delete is called for an object with children. |
|
The parameter supplied by the application is not valid. |
|
May be used to indicate that a conversion of a datetime property has failed. |
|
May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset. |
|
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. |
|
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. |
|
May be used to indicate that a property or command is not supported by the device. |
|
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. |
|
May be used to indicate that the device is not sending the correct amount of data. |
|
May be used to indicate that a resource (such as a thumbnail or an icon) is not present on the device. |
|
May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset. |
|
May be used to indicate that the device has stopped responding (hung). The device may need to be manually reset. |
|
May be used to indicate that the specified format is not supported by the device. |
|
May be used to indicate that the application was unable to send the requested amount of data to the device. |
|
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 description | MTP response code | MTP response code description | Details |
---|---|---|---|
0x80042003 | 0x2003 | Session Not Open | Indicates that the session handle of the operation is not a currently open session. This indicates an internal error in the MTP stack. |
0x80042004 | 0x2004 | Invalid TransactionID | Indicates that the TransactionID is zero or does not refer to a valid transaction. This indicates an internal error in the MTP stack. |
0x80042005 | 0x2005 | Operation Not Supported | Indicates 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. |
0x80042006 | 0x2006 | Parameter Not Supported | Indicates 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. |
0x80042007 | 0x2007 | Incomplete Transfer | Indicates that the transfer did not complete, and any data transferred should be discarded. This response does not correspond to a cancelled transaction. |
0x80042008 | 0x2008 | Invalid StorageID | Indicates 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. |
0x80042009 | 0x2009 | Invalid ObjectHandle | Indicates that an object handle does not refer to an actual object that is present on the device. The application should enumerate the storages again. |
0x8004200A | 0x200A | DeviceProp Not Supported | Indicates 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. |
0x8004200B | 0x200B | Invalid ObjectFormatCode | Indicates that the device does not support the particular object format code supplied in the given context. |
0x80042012 | 0x2012 | Partial Deletion | Indicates 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. |
0x80042013 | 0x2013 | Store Not Available | Indicates 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. |
0x80042014 | 0x2014 | Specification By Format Unsupported | Indicates 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. |
0x80042015 | 0x2015 | No Valid ObjectInfo | Indicates that the host did not provide valid object info to device before transferring the object. This indicates an internal error in the MTP stack. |
0x80042016 | 0x2016 | Invalid Code Format | Indicates that the data code does not have the correct format, and is therefore not valid. This indicates an internal error in the MTP stack. |
0x80042017 | 0x2017 | Unknown Vendor Code | Device does not know how to handle the vendor extended code. |
0x8004201A | 0x201A | Invalid ParentObject | Indicates that the object is not a valid parent object. This indicates an internal error in the MTP stack. |
0x8004201B | 0x201B | Invalid DeviceProp Format | Indicates 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. |
0x8004201C | 0x201C | Invalid DeviceProp Value | Indicates 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 |
0x8004201E | 0x201E | Session Already Open | Indicates that the host tried to open session while a session is already open. This indicates an internal error in the MTP stack. |
0x8004201F | 0x201F | Transaction Cancelled | May be used to indicate that the operation was interrupted due to manual cancellation. |
0x80042020 | 0x2020 | Specification of Destination Unsupported | Indicates that device does not support the specification of destination by the host. This indicates an internal error in the MTP stack. |
0x8004A801 | 0xA801 | Invalid_ObjectPropCode | Indicates that the device does not support the sent Object Property Code in this context. This indicates an internal error in the MTP stack. |
0x8004A802 | 0xA802 | Invalid_ObjectProp_Format | Indicates that an object property sent to the device is in an unsupported size or type. This indicates an internal error in the MTP stack. |
0x8004A803 | 0xA803 | Invalid_ObjectProp_Value | Indicates 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. |
0x8004A804 | 0xA804 | Invalid_ObjectReference | Indicates 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. |
0x8004A806 | 0xA806 | Invalid_Dataset | Indicates that the dataset sent in the data phase of this operation is invalid. This indicates an internal error in the MTP stack. |
0x8004A807 | 0xA807 | Object_Too_Large | Indicates 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. |
0x8004A301 | 0xA301 | Invalid_ServiceID | Indicates 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. |
0x8004A302 | 0xA302 | Invalid_ServicePropCode | Indicates that the device does not support the sent Service Property Code in this context. This indicates an internal error in the MTP stack. |
Requirements
Requirement | Value |
---|---|
Header |
|