ISoftHIDProtocolXlator::WriteReportDescriptor Method
The WriteReportDescriptor method sets the report descriptor for the device.
Syntax
HRESULT WriteReportDescriptor(
[in] SAFEARRAY psaReportDescriptor
);
Parameters
- psaReportDescriptor [in]
A pointer to SAFEARRAY of unsigned char values that contain raw report descriptor data. The caller can free this array after WriteReportDescriptor returns.
Return Value
WriteReportDescriptor returns S_OK if the operation succeeds. This method can return other standard COM return values.
Remarks
The WriteReportDescriptor method stores the report descriptor and returns it to the host in response to other GET_DESCRIPTOR requests for the report descriptor that are sent to the control endpoint for the device.
The following C++ code example shows you how to call WriteReportDescriptor.
HRESULT WriteReportDescriptor
(
ISoftHIDProtocolXlator *piSoftHIDProtocolXlator,
BYTE *pbDescriptor,
unsigned int cbDescriptor
)
{
HRESULT hr = S_OK;
SAFEARRAY *psaDescriptor = NULL;
BYTE HUGEP *pbArrayData = NULL;
psaDescriptor = ::SafeArrayCreateVector(VT_UI1, 0, cbDescriptor);
if (SUCCEEDED(hr))
{
hr = ::SafeArrayAccessData(psaDescriptor, &pbArrayData);
if (SUCCEEDED(hr))
{
::memcpy(pbArrayData, pbDescriptor, cbDescriptor);
hr = ::SafeArrayUnaccessData(psaDescriptor);
if (SUCCEEDED(hr))
{
hr = piSoftHIDProtocolXlator->WriteReportDescriptor(psaDescriptor);
}
}
(void)::SafeArrayDestroy(psaDescriptor);
}
}
Requirements
Header |
SoftHIDUSBif.h |
See Also
Send comments about this topic to Microsoft
Build date: 9/21/2010