HidP_SetData routine

The HidP_SetData routine sets a specified set of HID control button and value usages in a HID report.

Syntax


NTSTATUS __stdcall HidP_SetData(
  _In_     HIDP_REPORT_TYPE ReportType,
  _Inout_  PHIDP_DATA DataList,
  _Inout_  PULONG DataLength,
  _In_     PHIDP_PREPARSED_DATA PreparsedData,
  _In_     PCHAR Report,
  _In_     ULONG ReportLength
);

Parameters

ReportType [in]

Specifies a HIDP_REPORT_TYPE enumerator value that indicates the type of HID report located at Report.

DataList [in, out]

Pointer to a caller-allocated array of HIDP_DATA structures that specify which buttons and usage values to set.

DataLength [in, out]

Specifies, on input, the number of members in the DataList array. For information about the output value, see the Remarks section.

PreparsedData [in]

Pointer to a top-level's preparsed data.

Report [in]

Pointer to a HID report.

ReportLength [in]

Specifies the size, in bytes, of the HID report located at Report, which must be equal to the report length for the specified report type that HidP_GetCaps returns in a collection's HIDP_CAPS structure.

Return value

HidP_SetData returns HIDP_STATUS_SUCCESS if it successfully sets all the control data specified by DataList.

HidP_SetData returns one of the following status values if one of the input parameters is not valid:

Return codeDescription
HIDP_STATUS_INVALID_PREPARSED_DATA

The preparsed data specified by PreparsedData is not valid.

HIDP_STATUS_INVALID_REPORT_LENGTH

The size, in bytes, of the HID report is not equal to the length specified in the collection's HIDP_CAPS structure for the specified report type.

HIDP_STATUS_INVALID_REPORT_TYPE

ReportType is not valid.

HIDP_STATUS_REPORT_DOES_NOT_EXIST

The collection does not contain a report of the specified type.

 

HidP_SetData returns one of the following error values if one of the specified button or usage values could not be set:

Return codeDescription
HIDP_STATUS_BUFFER_TOO_SMALL

A button in an array was not set to ON (1) because all the array fields are already used to index other buttons.

HIDP_STATUS_BUTTON_NOT_PRESSED

A DataList member specifies to set a button OFF (zero), but the button is already set to OFF.

HIDP_STATUS_DATA_INDEX_NOT_FOUND

The data index of a DataList member is not valid.

HIDP_STATUS_INCOMPATIBLE_REPORT_ID

A button or usage value is contained in a report, but it is not in the specified report.

HIDP_STATUS_IS_VALUE_ARRAY

A data index specifies a usage value array.

 

Remarks

Except for usage value arrays, a user-mode application or kernel-mode driver can use HidP_SetData to set buttons and usage values in a report. To set a usage value array, an application or driver must use HidP_SetUsageValueArray.

HidP_SetData sets the output value of DataLength as follows:

ReportType, PreparsedData, Report, or ReportLength are not valid.

The input value is unchanged.

All control data was successfully set.

The input value is unchanged.

A control's data could not be set.

Set to the index of the DataList member that caused the error.

For more information, see HID Collections.

Requirements

Version

Available in Windows 2000 and later versions of Windows.

Header

Hidpi.h (include Hidpi.h)

Library

Hidparse.lib

IRQL

PASSIVE_LEVEL

See also

_HIDP_PREPARSED_DATA
HIDP_DATA
HidP_GetData
HidP_SetButtons
HidP_SetUsages
HidP_SetUsageValueArray
HidP_UnsetButtons
HidP_UnsetUsages

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft