Commit 30480a23 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

hid: Implement HidP_InitializeReportForID.

parent ecc61965
......@@ -31,7 +31,7 @@
@ stdcall HidP_GetUsages(long long long ptr ptr ptr ptr long)
@ stub HidP_GetUsagesEx
@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
@ stub HidP_InitializeReportForID
@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
@ stub HidP_MaxDataListLength
@ stub HidP_MaxUsageListLength
@ stub HidP_SetData
......
......@@ -358,3 +358,66 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS
*ValueCapsLength = v_count;
return HIDP_STATUS_SUCCESS;
}
NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID,
PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report,
ULONG ReportLength)
{
int size;
PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData;
WINE_HID_REPORT *report = NULL;
BOOL found=FALSE;
int r_count;
int i;
TRACE("(%i, %i, %p, %p, %i)\n",ReportType, ReportID, PreparsedData, Report, ReportLength);
if (data->magic != HID_MAGIC)
return HIDP_STATUS_INVALID_PREPARSED_DATA;
switch(ReportType)
{
case HidP_Input:
size = data->caps.InputReportByteLength;
report = HID_INPUT_REPORTS(data);
r_count = data->dwInputReportCount;
break;
case HidP_Output:
size = data->caps.OutputReportByteLength;
report = HID_OUTPUT_REPORTS(data);
r_count = data->dwOutputReportCount;
break;
case HidP_Feature:
size = data->caps.FeatureReportByteLength;
report = HID_FEATURE_REPORTS(data);
r_count = data->dwFeatureReportCount;
break;
default:
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (!r_count || !size || !report)
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
if (size != ReportLength)
return HIDP_STATUS_INVALID_REPORT_LENGTH;
ZeroMemory(Report, size);
for (i = 0; i < r_count; i++)
{
if (report->reportID == ReportID)
{
found = TRUE;
if (report->reportID)
Report[0] = ReportID;
/* TODO: Handle null and default values */
}
report = HID_NEXT_REPORT(data, report);
}
if (!found)
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
return HIDP_STATUS_SUCCESS;
}
......@@ -141,6 +141,7 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capa
NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
#ifndef FACILITY_HID_ERROR_CODE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment