It's only going to be used for internal HID preparsed data, to save a custom struct.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Fix test failures caused by wine_report->bitSize which was updated before setting the StartBit in the previous version.
dlls/hid/hidp.c | 20 ++++++++++---------- dlls/hidclass.sys/descriptor.c | 17 ++++++++--------- include/ddk/hidpi.h | 5 +++++ include/wine/hid.h | 1 - 4 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 2933c2ff7ef..4532f656008 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -277,7 +277,7 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT if (value->IsRange && value->Range.UsageMin <= Usage && Usage <= value->Range.UsageMax) { *element = elems[report->elementIdx + i]; - element->valueStartBit += value->BitSize * (Usage - value->Range.UsageMin); + element->caps.StartBit += value->BitSize * (Usage - value->Range.UsageMin); element->bitCount = elems[report->elementIdx + i].caps.BitSize; return HIDP_STATUS_SUCCESS; } @@ -332,7 +332,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag { ULONG rawValue; rc = get_report_data((BYTE*)Report, ReportLength, - element.valueStartBit, element.bitCount, &rawValue); + element.caps.StartBit, element.bitCount, &rawValue); if (rc != HIDP_STATUS_SUCCESS) return rc; *UsageValue = logical_to_physical(sign_extend(rawValue, &element), &element); @@ -357,7 +357,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return get_report_data((BYTE*)Report, ReportLength, - element.valueStartBit, element.bitCount, UsageValue); + element.caps.StartBit, element.bitCount, UsageValue); }
return rc; @@ -381,7 +381,7 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.bitCount) return HIDP_STATUS_NOT_VALUE_ARRAY;
- return get_report_data_array((BYTE*)Report, ReportLength, element.valueStartBit, element.bitCount, + return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.bitCount, element.caps.ReportCount, UsageValue, UsageValueByteLength); }
@@ -444,7 +444,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->valueStartBit + k, 1, &v); + element->caps.StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; found = TRUE; @@ -636,7 +636,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return set_report_data((BYTE*)Report, ReportLength, - element.valueStartBit, element.bitCount, UsageValue); + element.caps.StartBit, element.bitCount, UsageValue); }
return rc; @@ -661,7 +661,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH if (rc == HIDP_STATUS_SUCCESS) { rc = set_report_data((BYTE*)Report, ReportLength, - element.valueStartBit, element.bitCount, -1); + element.caps.StartBit, element.bitCount, -1); }
if (rc != HIDP_STATUS_SUCCESS) @@ -869,7 +869,7 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->valueStartBit + k, 1, &v); + element->caps.StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) @@ -952,7 +952,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->valueStartBit + k, 1, &v); + element->caps.StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) @@ -972,7 +972,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U { UINT v; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->valueStartBit, element->bitCount, &v); + element->caps.StartBit, element->bitCount, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; DataList[uCount].DataIndex = element->caps.NotRange.DataIndex; diff --git a/dlls/hidclass.sys/descriptor.c b/dlls/hidclass.sys/descriptor.c index 65c2f9aadae..9cf6f311fca 100644 --- a/dlls/hidclass.sys/descriptor.c +++ b/dlls/hidclass.sys/descriptor.c @@ -137,12 +137,12 @@ static inline const char *debugstr_hidp_value_caps( HIDP_VALUE_CAPS *caps ) { if (!caps) return "(null)"; return wine_dbg_sprintf( "RId %d, Usg %02x:%02x-%02x Dat %02x-%02x (%d), Str %d-%d (%d), Des %d-%d (%d), " - "Bits %02x, Als %d, Abs %d, Nul %d, LCol %d LUsg %02x:%02x, BitSz %d, RCnt %d, " + "Bits %02x, Als %d, Abs %d, Nul %d, LCol %d LUsg %02x:%02x, BitStrt %d, BitSz %d, RCnt %d, " "Unit %x E%+d, Log %+d-%+d, Phy %+d-%+d", caps->ReportID, caps->UsagePage, caps->Range.UsageMin, caps->Range.UsageMax, caps->Range.DataIndexMin, caps->Range.DataIndexMax, caps->IsRange, caps->Range.StringMin, caps->Range.StringMax, caps->IsStringRange, caps->Range.DesignatorMin, caps->Range.DesignatorMax, caps->IsDesignatorRange, - caps->BitField, caps->IsAlias, caps->IsAbsolute, caps->HasNull, caps->LinkCollection, caps->LinkUsagePage, caps->LinkUsage, caps->BitSize, caps->ReportCount, - caps->Units, caps->UnitsExp, caps->LogicalMin, caps->LogicalMax, caps->PhysicalMin, caps->PhysicalMax ); + caps->BitField, caps->IsAlias, caps->IsAbsolute, caps->HasNull, caps->LinkCollection, caps->LinkUsagePage, caps->LinkUsage, caps->StartBit, + caps->BitSize, caps->ReportCount, caps->Units, caps->UnitsExp, caps->LogicalMin, caps->LogicalMax, caps->PhysicalMin, caps->PhysicalMax ); }
static void debug_feature(struct feature *feature) @@ -196,7 +196,7 @@ static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, for (i = 0; i < report->elementCount; i++) { WINE_HID_ELEMENT *elem = elems + report->elementIdx + i; - TRACE("%s: %s, StartBit %d, BitCount %d\n", type, debugstr_hidp_value_caps(&elem->caps), elem->valueStartBit, elem->bitCount); + TRACE("%s: %s, BitCount %d\n", type, debugstr_hidp_value_caps(&elem->caps), elem->bitCount); } TRACE(">>> END Report %i\n",report->reportID); } @@ -589,11 +589,6 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems return; }
- wine_element->valueStartBit = wine_report->bitSize; - - wine_element->bitCount = (feature->caps.BitSize * feature->caps.ReportCount); - wine_report->bitSize += wine_element->bitCount; - wine_element->caps = feature->caps; wine_element->caps.BitField = feature->BitField; wine_element->caps.LinkCollection = feature->collection->index; @@ -601,6 +596,10 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems wine_element->caps.LinkUsagePage = feature->collection->caps.UsagePage; wine_element->caps.IsAbsolute = feature->IsAbsolute; wine_element->caps.HasNull = feature->HasNull; + wine_element->caps.StartBit = wine_report->bitSize; + + wine_element->bitCount = (wine_element->caps.BitSize * wine_element->caps.ReportCount); + wine_report->bitSize += wine_element->bitCount;
if (wine_element->caps.IsRange) { diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h index fb497f3282f..9da84f38531 100644 --- a/include/ddk/hidpi.h +++ b/include/ddk/hidpi.h @@ -83,7 +83,12 @@ typedef struct _HIDP_VALUE_CAPS UCHAR Reserved; USHORT BitSize; USHORT ReportCount; +#ifdef __WINESRC__ + USHORT Reserved2[3]; + ULONG StartBit; +#else USHORT Reserved2[5]; +#endif ULONG UnitsExp; ULONG Units; LONG LogicalMin; diff --git a/include/wine/hid.h b/include/wine/hid.h index cfb4f389eb9..0c0d3fdca99 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -33,7 +33,6 @@
typedef struct __WINE_ELEMENT { - UINT valueStartBit; UINT bitCount; HIDP_VALUE_CAPS caps; } WINE_HID_ELEMENT;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hid/hidp.c | 24 +++++++++++------------- dlls/hidclass.sys/descriptor.c | 10 +++++----- include/wine/hid.h | 1 - 3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 4532f656008..3cd524d4af0 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -278,13 +278,11 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT { *element = elems[report->elementIdx + i]; element->caps.StartBit += value->BitSize * (Usage - value->Range.UsageMin); - element->bitCount = elems[report->elementIdx + i].caps.BitSize; return HIDP_STATUS_SUCCESS; } else if (value->NotRange.Usage == Usage) { *element = elems[report->elementIdx + i]; - element->bitCount = elems[report->elementIdx + i].caps.BitSize; return HIDP_STATUS_SUCCESS; } } @@ -294,7 +292,7 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
static LONG sign_extend(ULONG value, const WINE_HID_ELEMENT *element) { - UINT bit_count = element->bitCount; + UINT bit_count = (element->caps.BitSize * element->caps.ReportCount);
if ((value & (1 << (bit_count - 1))) && element->caps.BitSize != 1 @@ -332,7 +330,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag { ULONG rawValue; rc = get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.bitCount, &rawValue); + element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, &rawValue); if (rc != HIDP_STATUS_SUCCESS) return rc; *UsageValue = logical_to_physical(sign_extend(rawValue, &element), &element); @@ -357,7 +355,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.bitCount, UsageValue); + element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); }
return rc; @@ -378,10 +376,10 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage
if (rc == HIDP_STATUS_SUCCESS) { - if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.bitCount) + if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.caps.BitSize || !element.caps.ReportCount) return HIDP_STATUS_NOT_VALUE_ARRAY;
- return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.bitCount, + return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, element.caps.ReportCount, UsageValue, UsageValueByteLength); }
@@ -440,7 +438,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH { int k; WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->bitCount; k++) + for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, @@ -636,7 +634,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.bitCount, UsageValue); + element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); }
return rc; @@ -661,7 +659,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH if (rc == HIDP_STATUS_SUCCESS) { rc = set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.bitCount, -1); + element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, -1); }
if (rc != HIDP_STATUS_SUCCESS) @@ -865,7 +863,7 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect { int k; WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->bitCount; k++) + for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, @@ -948,7 +946,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U if (element->caps.BitSize == 1) { int k; - for (k=0; k < element->bitCount; k++) + for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, @@ -972,7 +970,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U { UINT v; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit, element->bitCount, &v); + element->caps.StartBit, element->caps.BitSize * element->caps.ReportCount, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; DataList[uCount].DataIndex = element->caps.NotRange.DataIndex; diff --git a/dlls/hidclass.sys/descriptor.c b/dlls/hidclass.sys/descriptor.c index 9cf6f311fca..f39552c6228 100644 --- a/dlls/hidclass.sys/descriptor.c +++ b/dlls/hidclass.sys/descriptor.c @@ -196,7 +196,7 @@ static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, for (i = 0; i < report->elementCount; i++) { WINE_HID_ELEMENT *elem = elems + report->elementIdx + i; - TRACE("%s: %s, BitCount %d\n", type, debugstr_hidp_value_caps(&elem->caps), elem->bitCount); + TRACE("%s: %s\n", type, debugstr_hidp_value_caps(&elem->caps)); } TRACE(">>> END Report %i\n",report->reportID); } @@ -581,7 +581,7 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems struct feature* feature, USHORT *data_index) { WINE_HID_ELEMENT *wine_element = elems + wine_report->elementIdx + wine_report->elementCount; - ULONG index_count; + ULONG index_count, bit_count;
if (!feature->isData) { @@ -598,12 +598,12 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems wine_element->caps.HasNull = feature->HasNull; wine_element->caps.StartBit = wine_report->bitSize;
- wine_element->bitCount = (wine_element->caps.BitSize * wine_element->caps.ReportCount); - wine_report->bitSize += wine_element->bitCount; + bit_count = (wine_element->caps.BitSize * wine_element->caps.ReportCount); + wine_report->bitSize += bit_count;
if (wine_element->caps.IsRange) { - if (wine_element->caps.BitSize == 1) index_count = wine_element->bitCount - 1; + if (wine_element->caps.BitSize == 1) index_count = bit_count - 1; else index_count = wine_element->caps.Range.UsageMax - wine_element->caps.Range.UsageMin; wine_element->caps.Range.DataIndexMin = *data_index; wine_element->caps.Range.DataIndexMax = *data_index + index_count; diff --git a/include/wine/hid.h b/include/wine/hid.h index 0c0d3fdca99..9528e598022 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -33,7 +33,6 @@
typedef struct __WINE_ELEMENT { - UINT bitCount; HIDP_VALUE_CAPS caps; } WINE_HID_ELEMENT;
Please ignore the last two patches, additional tests show that they aren't no-op.
Although the code is already broken, I'll try to find a way to fix it without breaking it more first.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hid/hidp.c | 154 ++++++++++++++++----------------- dlls/hidclass.sys/descriptor.c | 46 +++++----- include/wine/hid.h | 7 +- 3 files changed, 101 insertions(+), 106 deletions(-)
diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 3cd524d4af0..456a9d98767 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -161,7 +161,7 @@ NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAP PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,j,u; @@ -203,8 +203,8 @@ NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAP { for (i = 0; i < report[j].elementCount && u < b_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize == 1) - ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i].caps; + if (elems[report[j].elementIdx + i].BitSize == 1) + ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i]; } }
@@ -230,10 +230,10 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData,
static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, - USHORT bit_size, WINE_HID_ELEMENT *element) + USHORT bit_size, HIDP_VALUE_CAPS *element) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i; @@ -268,16 +268,16 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT
for (i = 0; i < report->elementCount; i++) { - HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i].caps; + HIDP_VALUE_CAPS *value = &elems[report->elementIdx + i];
- if ((elems[report->elementIdx + i].caps.BitSize == 1) != (bit_size == 1) || + if ((elems[report->elementIdx + i].BitSize == 1) != (bit_size == 1) || value->UsagePage != UsagePage) continue;
if (value->IsRange && value->Range.UsageMin <= Usage && Usage <= value->Range.UsageMax) { *element = elems[report->elementIdx + i]; - element->caps.StartBit += value->BitSize * (Usage - value->Range.UsageMin); + element->StartBit += value->BitSize * (Usage - value->Range.UsageMin); return HIDP_STATUS_SUCCESS; } else if (value->NotRange.Usage == Usage) @@ -290,27 +290,27 @@ static NTSTATUS find_usage(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT return HIDP_STATUS_USAGE_NOT_FOUND; }
-static LONG sign_extend(ULONG value, const WINE_HID_ELEMENT *element) +static LONG sign_extend(ULONG value, const HIDP_VALUE_CAPS *element) { - UINT bit_count = (element->caps.BitSize * element->caps.ReportCount); + UINT bit_count = (element->BitSize * element->ReportCount);
if ((value & (1 << (bit_count - 1))) - && element->caps.BitSize != 1 - && element->caps.LogicalMin < 0) + && element->BitSize != 1 + && element->LogicalMin < 0) { value -= (1 << bit_count); } return value; }
-static LONG logical_to_physical(LONG value, const WINE_HID_ELEMENT *element) +static LONG logical_to_physical(LONG value, const HIDP_VALUE_CAPS *element) { - if (element->caps.PhysicalMin || element->caps.PhysicalMax) + if (element->PhysicalMin || element->PhysicalMax) { - value = (((ULONGLONG)(value - element->caps.LogicalMin) - * (element->caps.PhysicalMax - element->caps.PhysicalMin)) - / (element->caps.LogicalMax - element->caps.LogicalMin)) - + element->caps.PhysicalMin; + value = (((ULONGLONG)(value - element->LogicalMin) + * (element->PhysicalMax - element->PhysicalMin)) + / (element->LogicalMax - element->LogicalMin)) + + element->PhysicalMin; } return value; } @@ -320,7 +320,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { NTSTATUS rc; - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, PreparsedData, Report, ReportLength);
@@ -330,7 +330,7 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag { ULONG rawValue; rc = get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, &rawValue); + element.StartBit, element.BitSize * element.ReportCount, &rawValue); if (rc != HIDP_STATUS_SUCCESS) return rc; *UsageValue = logical_to_physical(sign_extend(rawValue, &element), &element); @@ -344,7 +344,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -355,7 +355,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return get_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); + element.StartBit, element.BitSize * element.ReportCount, UsageValue); }
return rc; @@ -366,7 +366,7 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %p, %u, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -376,11 +376,11 @@ NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE Usage
if (rc == HIDP_STATUS_SUCCESS) { - if (element.caps.IsRange || element.caps.ReportCount <= 1 || !element.caps.BitSize || !element.caps.ReportCount) + if (element.IsRange || element.ReportCount <= 1 || !element.BitSize || !element.ReportCount) return HIDP_STATUS_NOT_VALUE_ARRAY;
- return get_report_data_array((BYTE*)Report, ReportLength, element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, - element.caps.ReportCount, UsageValue, UsageValueByteLength); + return get_report_data_array((BYTE*)Report, ReportLength, element.StartBit, element.BitSize * element.ReportCount, + element.ReportCount, UsageValue, UsageValueByteLength); }
return rc; @@ -392,7 +392,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH PCHAR Report, ULONG ReportLength) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; BOOL found = FALSE; USHORT b_count = 0, r_count = 0; @@ -433,16 +433,16 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH uCount = 0; for (i = 0; i < report->elementCount && uCount < *UsageLength; i++) { - if (elems[report->elementIdx + i].caps.BitSize == 1 && - elems[report->elementIdx + i].caps.UsagePage == UsagePage) + if (elems[report->elementIdx + i].BitSize == 1 && + elems[report->elementIdx + i].UsagePage == UsagePage) { int k; - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; found = TRUE; @@ -450,7 +450,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH { if (uCount == *UsageLength) return HIDP_STATUS_BUFFER_TOO_SMALL; - UsageList[uCount] = element->caps.Range.UsageMin + k; + UsageList[uCount] = element->Range.UsageMin + k; uCount++; } } @@ -470,7 +470,7 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i,j,u; @@ -512,8 +512,8 @@ NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS { for (i = 0; i < report[j].elementCount && u < v_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize != 1) - ValueCaps[u++] = elems[report[j].elementIdx + i].caps; + if (elems[report[j].elementIdx + i].BitSize != 1) + ValueCaps[u++] = elems[report[j].elementIdx + i]; } }
@@ -569,7 +569,7 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; int r_count; int i; @@ -605,12 +605,12 @@ ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePag int j; for (j = 0; j < report[i].elementCount; j++) { - if (elems[report[i].elementIdx + j].caps.BitSize == 1 && - (UsagePage == 0 || elems[report[i].elementIdx + j].caps.UsagePage == UsagePage)) + if (elems[report[i].elementIdx + j].BitSize == 1 && + (UsagePage == 0 || elems[report[i].elementIdx + j].UsagePage == UsagePage)) { - if (elems[report[i].elementIdx + j].caps.IsRange) - count += (elems[report[i].elementIdx + j].caps.Range.UsageMax - - elems[report[i].elementIdx + j].caps.Range.UsageMin) + 1; + if (elems[report[i].elementIdx + j].IsRange) + count += (elems[report[i].elementIdx + j].Range.UsageMax - + elems[report[i].elementIdx + j].Range.UsageMin) + 1; else count++; } @@ -623,7 +623,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc;
TRACE("(%i, %x, %i, %i, %i, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, @@ -634,7 +634,7 @@ NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, if (rc == HIDP_STATUS_SUCCESS) { return set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, UsageValue); + element.StartBit, element.BitSize * element.ReportCount, UsageValue); }
return rc; @@ -645,7 +645,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) { - WINE_HID_ELEMENT element; + HIDP_VALUE_CAPS element; NTSTATUS rc; ULONG i;
@@ -659,7 +659,7 @@ NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH if (rc == HIDP_STATUS_SUCCESS) { rc = set_report_data((BYTE*)Report, ReportLength, - element.caps.StartBit, element.caps.BitSize * element.caps.ReportCount, -1); + element.StartBit, element.BitSize * element.ReportCount, -1); }
if (rc != HIDP_STATUS_SUCCESS) @@ -689,7 +689,7 @@ NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,j,u; @@ -732,17 +732,17 @@ NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, { for (i = 0; i < report[j].elementCount && u < b_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize == 1 && - (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].caps.UsagePage) && - (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].caps.LinkCollection) && + if (elems[report[j].elementIdx + i].BitSize == 1 && + (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].UsagePage) && + (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].LinkCollection) && (Usage == 0 || ( - (!elems[report[j].elementIdx + i].caps.IsRange && - Usage == elems[report[j].elementIdx + i].caps.NotRange.Usage)) || - (elems[report[j].elementIdx + i].caps.IsRange && - Usage >= elems[report[j].elementIdx + i].caps.Range.UsageMin && - Usage <= elems[report[j].elementIdx + i].caps.Range.UsageMax))) + (!elems[report[j].elementIdx + i].IsRange && + Usage == elems[report[j].elementIdx + i].NotRange.Usage)) || + (elems[report[j].elementIdx + i].IsRange && + Usage >= elems[report[j].elementIdx + i].Range.UsageMin && + Usage <= elems[report[j].elementIdx + i].Range.UsageMax))) { - ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i].caps; + ButtonCaps[u++] = *(HIDP_BUTTON_CAPS *)&elems[report[j].elementIdx + i]; } } } @@ -759,7 +759,7 @@ NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData) { WINE_HIDP_PREPARSED_DATA *data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i,j,u; @@ -802,12 +802,12 @@ NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, { for (i = 0; i < report[j].elementCount && u < v_count; i++) { - if (elems[report[j].elementIdx + i].caps.BitSize != 1 && - (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].caps.UsagePage) && - (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].caps.LinkCollection) && - (Usage == 0 || Usage == elems[report[j].elementIdx + i].caps.NotRange.Usage)) + if (elems[report[j].elementIdx + i].BitSize != 1 && + (UsagePage == 0 || UsagePage == elems[report[j].elementIdx + i].UsagePage) && + (LinkCollection == 0 || LinkCollection == elems[report[j].elementIdx + i].LinkCollection) && + (Usage == 0 || Usage == elems[report[j].elementIdx + i].NotRange.Usage)) { - ValueCaps[u++] = elems[report[j].elementIdx + i].caps; + ValueCaps[u++] = elems[report[j].elementIdx + i]; } } } @@ -822,7 +822,7 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect ULONG *UsageLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT b_count = 0, r_count = 0; int i,uCount = 0; @@ -859,23 +859,23 @@ NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollect
for (i = 0; i < report->elementCount; i++) { - if (elems[report->elementIdx + i].caps.BitSize == 1) + if (elems[report->elementIdx + i].BitSize == 1) { int k; - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) { if (uCount < *UsageLength) { - ButtonList[uCount].Usage = element->caps.Range.UsageMin + k; - ButtonList[uCount].UsagePage = element->caps.UsagePage; + ButtonList[uCount].Usage = element->Range.UsageMin + k; + ButtonList[uCount].UsagePage = element->UsagePage; } uCount++; } @@ -919,7 +919,7 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U PHIDP_PREPARSED_DATA PreparsedData,CHAR *Report, ULONG ReportLength) { WINE_HIDP_PREPARSED_DATA *data = (WINE_HIDP_PREPARSED_DATA*)PreparsedData; - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); WINE_HID_REPORT *report = NULL; USHORT r_count = 0; int i,uCount = 0; @@ -942,22 +942,22 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U
for (i = 0; i < report->elementCount; i++) { - WINE_HID_ELEMENT *element = &elems[report->elementIdx + i]; - if (element->caps.BitSize == 1) + HIDP_VALUE_CAPS *element = &elems[report->elementIdx + i]; + if (element->BitSize == 1) { int k; - for (k=0; k < element->caps.BitSize * element->caps.ReportCount; k++) + for (k=0; k < element->BitSize * element->ReportCount; k++) { UINT v = 0; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit + k, 1, &v); + element->StartBit + k, 1, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; if (v) { if (uCount < *DataLength) { - DataList[uCount].DataIndex = element->caps.Range.DataIndexMin + k; + DataList[uCount].DataIndex = element->Range.DataIndexMin + k; DataList[uCount].On = v; } uCount++; @@ -970,10 +970,10 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U { UINT v; NTSTATUS rc = get_report_data((BYTE*)Report, ReportLength, - element->caps.StartBit, element->caps.BitSize * element->caps.ReportCount, &v); + element->StartBit, element->BitSize * element->ReportCount, &v); if (rc != HIDP_STATUS_SUCCESS) return rc; - DataList[uCount].DataIndex = element->caps.NotRange.DataIndex; + DataList[uCount].DataIndex = element->NotRange.DataIndex; DataList[uCount].RawValue = v; } uCount++; diff --git a/dlls/hidclass.sys/descriptor.c b/dlls/hidclass.sys/descriptor.c index f39552c6228..f0188c4b519 100644 --- a/dlls/hidclass.sys/descriptor.c +++ b/dlls/hidclass.sys/descriptor.c @@ -186,7 +186,7 @@ static void debug_collection(struct collection *collection) static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, WINE_HID_REPORT *report) { - WINE_HID_ELEMENT *elems = HID_ELEMS(data); + HIDP_VALUE_CAPS *elems = HID_ELEMS(data); unsigned int i; TRACE("START Report %i <<< %s report : bitSize: %i elementCount: %i\n", report->reportID, @@ -195,8 +195,8 @@ static void debug_print_report(const char* type, WINE_HIDP_PREPARSED_DATA *data, report->elementCount); for (i = 0; i < report->elementCount; i++) { - WINE_HID_ELEMENT *elem = elems + report->elementIdx + i; - TRACE("%s: %s\n", type, debugstr_hidp_value_caps(&elem->caps)); + HIDP_VALUE_CAPS *elem = elems + report->elementIdx + i; + TRACE("%s: %s\n", type, debugstr_hidp_value_caps(elem)); } TRACE(">>> END Report %i\n",report->reportID); } @@ -577,10 +577,10 @@ static int parse_descriptor(BYTE *descriptor, unsigned int index, unsigned int l return i; }
-static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems, +static void build_elements(WINE_HID_REPORT *wine_report, HIDP_VALUE_CAPS *elems, struct feature* feature, USHORT *data_index) { - WINE_HID_ELEMENT *wine_element = elems + wine_report->elementIdx + wine_report->elementCount; + HIDP_VALUE_CAPS *wine_element = elems + wine_report->elementIdx + wine_report->elementCount; ULONG index_count, bit_count;
if (!feature->isData) @@ -589,30 +589,30 @@ static void build_elements(WINE_HID_REPORT *wine_report, WINE_HID_ELEMENT *elems return; }
- wine_element->caps = feature->caps; - wine_element->caps.BitField = feature->BitField; - wine_element->caps.LinkCollection = feature->collection->index; - wine_element->caps.LinkUsage = feature->collection->caps.NotRange.Usage; - wine_element->caps.LinkUsagePage = feature->collection->caps.UsagePage; - wine_element->caps.IsAbsolute = feature->IsAbsolute; - wine_element->caps.HasNull = feature->HasNull; - wine_element->caps.StartBit = wine_report->bitSize; + *wine_element = feature->caps; + wine_element->BitField = feature->BitField; + wine_element->LinkCollection = feature->collection->index; + wine_element->LinkUsage = feature->collection->caps.NotRange.Usage; + wine_element->LinkUsagePage = feature->collection->caps.UsagePage; + wine_element->IsAbsolute = feature->IsAbsolute; + wine_element->HasNull = feature->HasNull; + wine_element->StartBit = wine_report->bitSize;
- bit_count = (wine_element->caps.BitSize * wine_element->caps.ReportCount); + bit_count = (wine_element->BitSize * wine_element->ReportCount); wine_report->bitSize += bit_count;
- if (wine_element->caps.IsRange) + if (wine_element->IsRange) { - if (wine_element->caps.BitSize == 1) index_count = bit_count - 1; - else index_count = wine_element->caps.Range.UsageMax - wine_element->caps.Range.UsageMin; - wine_element->caps.Range.DataIndexMin = *data_index; - wine_element->caps.Range.DataIndexMax = *data_index + index_count; + if (wine_element->BitSize == 1) index_count = bit_count - 1; + else index_count = wine_element->Range.UsageMax - wine_element->Range.UsageMin; + wine_element->Range.DataIndexMin = *data_index; + wine_element->Range.DataIndexMax = *data_index + index_count; *data_index = *data_index + index_count + 1; } else { - wine_element->caps.NotRange.DataIndex = *data_index; - wine_element->caps.NotRange.Reserved4 = *data_index; + wine_element->NotRange.DataIndex = *data_index; + wine_element->NotRange.Reserved4 = *data_index; *data_index = *data_index + 1; }
@@ -661,7 +661,7 @@ static void create_preparse_ctx(const struct collection *base, struct preparse_c static void preparse_collection(const struct collection *root, const struct collection *base, WINE_HIDP_PREPARSED_DATA *data, struct preparse_ctx *ctx) { - WINE_HID_ELEMENT *elem = HID_ELEMS(data); + HIDP_VALUE_CAPS *elem = HID_ELEMS(data); WINE_HID_LINK_COLLECTION_NODE *nodes = HID_NODES(data); struct feature *f; struct collection *c; @@ -748,7 +748,7 @@ static WINE_HIDP_PREPARSED_DATA* build_PreparseData(struct collection *base_coll report_count = ctx.report_count[HidP_Input] + ctx.report_count[HidP_Output] + ctx.report_count[HidP_Feature]; element_off = FIELD_OFFSET(WINE_HIDP_PREPARSED_DATA, reports[report_count]); - size = element_off + (ctx.elem_count * sizeof(WINE_HID_ELEMENT)); + size = element_off + (ctx.elem_count * sizeof(HIDP_VALUE_CAPS));
nodes_offset = size; size += node_count * sizeof(WINE_HID_LINK_COLLECTION_NODE); diff --git a/include/wine/hid.h b/include/wine/hid.h index 9528e598022..15dd2cf2c0d 100644 --- a/include/wine/hid.h +++ b/include/wine/hid.h @@ -31,11 +31,6 @@
#define HID_MAGIC 0x8491759
-typedef struct __WINE_ELEMENT -{ - HIDP_VALUE_CAPS caps; -} WINE_HID_ELEMENT; - /* make sure HIDP_BUTTON_CAPS is a subset of HIDP_VALUE_CAPS */ C_ASSERT( sizeof(HIDP_BUTTON_CAPS) == sizeof(HIDP_VALUE_CAPS) );
@@ -102,7 +97,7 @@ typedef struct __WINE_HIDP_PREPARSED_DATA #define HID_INPUT_REPORTS(d) ((d)->reports) #define HID_OUTPUT_REPORTS(d) ((d)->reports + (d)->reportCount[0]) #define HID_FEATURE_REPORTS(d) ((d)->reports + (d)->reportCount[0] + (d)->reportCount[1]) -#define HID_ELEMS(d) ((WINE_HID_ELEMENT*)((BYTE*)(d) + (d)->elementOffset)) +#define HID_ELEMS(d) ((HIDP_VALUE_CAPS*)((BYTE*)(d) + (d)->elementOffset)) #define HID_NODES(d) ((WINE_HID_LINK_COLLECTION_NODE*)((BYTE*)(d) + (d)->nodesOffset))
#endif /* __WINE_PARSE_H */