[HIDPARSER] Remove HID_PARSER class, and directly use functions

This commit is contained in:
Hervé Poussineau 2019-05-03 13:24:05 +02:00
parent 9df05ba4b6
commit c151f8a1c7
7 changed files with 118 additions and 338 deletions

View file

@ -206,23 +206,6 @@ HidParser_GetReportItemTypeCountFromReportType(
return ItemCount; return ItemCount;
} }
VOID
HidParser_InitParser(
IN PHIDPARSER_ALLOC_FUNCTION AllocFunction,
IN PHIDPARSER_FREE_FUNCTION FreeFunction,
IN PHIDPARSER_ZERO_FUNCTION ZeroFunction,
IN PHIDPARSER_COPY_FUNCTION CopyFunction,
IN PHIDPARSER_DEBUG_FUNCTION DebugFunction,
OUT PHID_PARSER Parser)
{
Parser->Alloc = AllocFunction;
Parser->Free = FreeFunction;
Parser->Zero = ZeroFunction;
Parser->Copy = CopyFunction;
Parser->Debug = DebugFunction;
}
ULONG ULONG
HidParser_GetMaxUsageListLengthWithReportAndPage( HidParser_GetMaxUsageListLengthWithReportAndPage(
IN PVOID CollectionContext, IN PVOID CollectionContext,
@ -269,7 +252,6 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetSpecificValueCapsWithReport( HidParser_GetSpecificValueCapsWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USHORT UsagePage, IN USHORT UsagePage,
@ -313,7 +295,7 @@ HidParser_GetSpecificValueCapsWithReport(
// //
// zero caps // zero caps
// //
Parser->Zero(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS)); ZeroFunction(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS));
// //
// init caps // init caps
@ -359,7 +341,6 @@ HidParser_GetSpecificValueCapsWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetUsagesWithReport( HidParser_GetUsagesWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -517,14 +498,14 @@ HidParser_GetUsagesWithReport(
// //
// success, clear rest of array // success, clear rest of array
// //
Parser->Zero(&UsageAndPage[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE_AND_PAGE)); ZeroFunction(&UsageAndPage[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE_AND_PAGE));
} }
else else
{ {
// //
// success, clear rest of array // success, clear rest of array
// //
Parser->Zero(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE)); ZeroFunction(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE));
} }
@ -567,7 +548,6 @@ HidParser_UsesReportId(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetUsageValueWithReport( HidParser_GetUsageValueWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -635,7 +615,7 @@ HidParser_GetUsageValueWithReport(
// one extra shift for skipping the prepended report id // one extra shift for skipping the prepended report id
// //
Data = 0; Data = 0;
Parser->Copy(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1))); CopyFunction(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
// //
// shift data // shift data
@ -664,7 +644,6 @@ HidParser_GetUsageValueWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetScaledUsageValueWithReport( HidParser_GetScaledUsageValueWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -732,7 +711,7 @@ HidParser_GetScaledUsageValueWithReport(
// one extra shift for skipping the prepended report id // one extra shift for skipping the prepended report id
// //
Data = 0; Data = 0;
Parser->Copy(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1))); CopyFunction(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
// //
// shift data // shift data
@ -870,7 +849,6 @@ HidParser_DispatchKey(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_TranslateKbdUsage( HidParser_TranslateKbdUsage(
IN PHID_PARSER Parser,
IN USAGE Usage, IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
@ -933,7 +911,6 @@ HidParser_TranslateKbdUsage(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_TranslateCustUsage( HidParser_TranslateCustUsage(
IN PHID_PARSER Parser,
IN USAGE Usage, IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,

View file

@ -81,7 +81,6 @@ HidParser_CalculateContextSize(
ULONG ULONG
HidParser_StoreCollection( HidParser_StoreCollection(
IN PHID_PARSER Parser,
IN PHID_COLLECTION Collection, IN PHID_COLLECTION Collection,
IN PHID_COLLECTION_CONTEXT CollectionContext, IN PHID_COLLECTION_CONTEXT CollectionContext,
IN ULONG CurrentOffset) IN ULONG CurrentOffset)
@ -105,7 +104,7 @@ HidParser_StoreCollection(
// //
// first copy the collection details // first copy the collection details
// //
Parser->Copy(TargetCollection, Collection, sizeof(HID_COLLECTION)); CopyFunction(TargetCollection, Collection, sizeof(HID_COLLECTION));
// //
// calulcate collection size // calulcate collection size
@ -140,7 +139,7 @@ HidParser_StoreCollection(
// //
// copy report item // copy report item
// //
Parser->Copy(&CollectionContext->RawData[CurrentOffset], Collection->Reports[Index], ReportSize); CopyFunction(&CollectionContext->RawData[CurrentOffset], Collection->Reports[Index], ReportSize);
// //
// store offset to report item // store offset to report item
@ -168,7 +167,7 @@ HidParser_StoreCollection(
// //
// store sub collections // store sub collections
// //
CurrentOffset += HidParser_StoreCollection(Parser, Collection->Nodes[Index], CollectionContext, CurrentOffset); CurrentOffset += HidParser_StoreCollection(Collection->Nodes[Index], CollectionContext, CurrentOffset);
// //
// sanity check // sanity check
@ -184,7 +183,6 @@ HidParser_StoreCollection(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_BuildCollectionContext( HidParser_BuildCollectionContext(
IN PHID_PARSER Parser,
IN PHID_COLLECTION RootCollection, IN PHID_COLLECTION RootCollection,
IN PVOID Context, IN PVOID Context,
IN ULONG ContextSize) IN ULONG ContextSize)
@ -201,7 +199,7 @@ HidParser_BuildCollectionContext(
// //
// store collections // store collections
// //
CollectionSize = HidParser_StoreCollection(Parser, RootCollection, CollectionContext, 0); CollectionSize = HidParser_StoreCollection(RootCollection, CollectionContext, 0);
// //
// sanity check // sanity check

View file

@ -13,17 +13,10 @@ NTAPI
HidP_FreeCollectionDescription( HidP_FreeCollectionDescription(
IN PHIDP_DEVICE_DESC DeviceDescription) IN PHIDP_DEVICE_DESC DeviceDescription)
{ {
HID_PARSER Parser;
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// free collection // free collection
// //
HidParser_FreeCollectionDescription(&Parser, DeviceDescription); HidParser_FreeCollectionDescription(DeviceDescription);
} }
@ -34,17 +27,10 @@ HidP_GetCaps(
IN PHIDP_PREPARSED_DATA PreparsedData, IN PHIDP_PREPARSED_DATA PreparsedData,
OUT PHIDP_CAPS Capabilities) OUT PHIDP_CAPS Capabilities)
{ {
HID_PARSER Parser;
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get caps // get caps
// //
return HidParser_GetCaps(&Parser, PreparsedData, Capabilities); return HidParser_GetCaps(PreparsedData, Capabilities);
} }
NTSTATUS NTSTATUS
@ -78,18 +64,12 @@ HidP_GetCollectionDescription(
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
OUT PHIDP_DEVICE_DESC DeviceDescription) OUT PHIDP_DEVICE_DESC DeviceDescription)
{ {
HID_PARSER Parser;
NTSTATUS Status; NTSTATUS Status;
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get description; // get description;
// //
Status = HidParser_GetCollectionDescription(&Parser, ReportDesc, DescLength, PoolType, DeviceDescription); Status = HidParser_GetCollectionDescription(ReportDesc, DescLength, PoolType, DeviceDescription);
return TranslateStatusForUpperLayer(Status); return TranslateStatusForUpperLayer(Status);
} }
@ -101,23 +81,15 @@ HidP_MaxUsageListLength(
IN USAGE UsagePage OPTIONAL, IN USAGE UsagePage OPTIONAL,
IN PHIDP_PREPARSED_DATA PreparsedData) IN PHIDP_PREPARSED_DATA PreparsedData)
{ {
HID_PARSER Parser;
// //
// sanity check // sanity check
// //
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature); ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get usage length // get usage length
// //
return HidParser_MaxUsageListLength(&Parser, PreparsedData, ReportType, UsagePage); return HidParser_MaxUsageListLength(PreparsedData, ReportType, UsagePage);
} }
HIDAPI HIDAPI
@ -132,22 +104,15 @@ HidP_GetSpecificValueCaps(
IN OUT PUSHORT ValueCapsLength, IN OUT PUSHORT ValueCapsLength,
IN PHIDP_PREPARSED_DATA PreparsedData) IN PHIDP_PREPARSED_DATA PreparsedData)
{ {
HID_PARSER Parser;
// //
// sanity check // sanity check
// //
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature); ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get value caps // get value caps
// //
return HidParser_GetSpecificValueCaps(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength); return HidParser_GetSpecificValueCaps(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength);
} }
HIDAPI HIDAPI
@ -163,22 +128,15 @@ HidP_GetUsages(
IN PCHAR Report, IN PCHAR Report,
IN ULONG ReportLength) IN ULONG ReportLength)
{ {
HID_PARSER Parser;
// //
// sanity check // sanity check
// //
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature); ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get usages // get usages
// //
return HidParser_GetUsages(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, UsageList, UsageLength, Report, ReportLength); return HidParser_GetUsages(PreparsedData, ReportType, UsagePage, LinkCollection, UsageList, UsageLength, Report, ReportLength);
} }
@ -238,22 +196,15 @@ HidP_GetScaledUsageValue(
IN PCHAR Report, IN PCHAR Report,
IN ULONG ReportLength) IN ULONG ReportLength)
{ {
HID_PARSER Parser;
// //
// sanity check // sanity check
// //
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature); ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get scaled usage value // get scaled usage value
// //
return HidParser_GetScaledUsageValue(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength); return HidParser_GetScaledUsageValue(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
} }
HIDAPI HIDAPI
@ -269,22 +220,15 @@ HidP_GetUsageValue(
IN PCHAR Report, IN PCHAR Report,
IN ULONG ReportLength) IN ULONG ReportLength)
{ {
HID_PARSER Parser;
// //
// sanity check // sanity check
// //
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature); ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// get scaled usage value // get scaled usage value
// //
return HidParser_GetUsageValue(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength); return HidParser_GetUsageValue(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
} }
@ -299,17 +243,10 @@ HidP_TranslateUsageAndPagesToI8042ScanCodes(
IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
IN PVOID InsertCodesContext) IN PVOID InsertCodesContext)
{ {
HID_PARSER Parser;
//
// init parser
//
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
// //
// translate usage pages // translate usage pages
// //
return HidParser_TranslateUsageAndPagesToI8042ScanCodes(&Parser, ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext); return HidParser_TranslateUsageAndPagesToI8042ScanCodes(ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
} }
HIDAPI HIDAPI

View file

@ -47,7 +47,6 @@ TranslateHidParserStatus(
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetCollectionDescription( HidParser_GetCollectionDescription(
IN PHID_PARSER Parser,
IN PHIDP_REPORT_DESCRIPTOR ReportDesc, IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength, IN ULONG DescLength,
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
@ -61,13 +60,13 @@ HidParser_GetCollectionDescription(
// //
// first parse the report descriptor // first parse the report descriptor
// //
ParserStatus = HidParser_ParseReportDescriptor(Parser, ReportDesc, DescLength, &ParserContext); ParserStatus = HidParser_ParseReportDescriptor(ReportDesc, DescLength, &ParserContext);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS) if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{ {
// //
// failed to parse report descriptor // failed to parse report descriptor
// //
Parser->Debug("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus); DebugFunction("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus);
return ParserStatus; return ParserStatus;
} }
@ -87,12 +86,12 @@ HidParser_GetCollectionDescription(
// //
// zero description // zero description
// //
Parser->Zero(DeviceDescription, sizeof(HIDP_DEVICE_DESC)); ZeroFunction(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
// //
// allocate collection // allocate collection
// //
DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)Parser->Alloc(sizeof(HIDP_COLLECTION_DESC) * CollectionCount); DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)AllocFunction(sizeof(HIDP_COLLECTION_DESC) * CollectionCount);
if (!DeviceDescription->CollectionDesc) if (!DeviceDescription->CollectionDesc)
{ {
// //
@ -104,13 +103,13 @@ HidParser_GetCollectionDescription(
// //
// allocate report description // allocate report description
// //
DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)Parser->Alloc(sizeof(HIDP_REPORT_IDS) * CollectionCount); DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)AllocFunction(sizeof(HIDP_REPORT_IDS) * CollectionCount);
if (!DeviceDescription->ReportIDs) if (!DeviceDescription->ReportIDs)
{ {
// //
// no memory // no memory
// //
Parser->Free(DeviceDescription->CollectionDesc); FreeFunction(DeviceDescription->CollectionDesc);
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
@ -119,15 +118,15 @@ HidParser_GetCollectionDescription(
// //
// set preparsed data length // set preparsed data length
// //
DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser, ParserContext, Index); DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(ParserContext, Index);
ParserStatus = HidParser_BuildContext(Parser, ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData); ParserStatus = HidParser_BuildContext(ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS) if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{ {
// //
// no memory // no memory
// //
Parser->Free(DeviceDescription->CollectionDesc); FreeFunction(DeviceDescription->CollectionDesc);
Parser->Free(DeviceDescription->ReportIDs); FreeFunction(DeviceDescription->ReportIDs);
return ParserStatus; return ParserStatus;
} }
@ -158,8 +157,8 @@ HidParser_GetCollectionDescription(
if (ParserStatus != HIDPARSER_STATUS_SUCCESS) if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{ {
// collection not found // collection not found
Parser->Free(DeviceDescription->CollectionDesc); FreeFunction(DeviceDescription->CollectionDesc);
Parser->Free(DeviceDescription->ReportIDs); FreeFunction(DeviceDescription->ReportIDs);
return ParserStatus; return ParserStatus;
} }
@ -193,7 +192,6 @@ HidParser_GetCollectionDescription(
VOID VOID
NTAPI NTAPI
HidParser_FreeCollectionDescription( HidParser_FreeCollectionDescription(
IN PHID_PARSER Parser,
IN PHIDP_DEVICE_DESC DeviceDescription) IN PHIDP_DEVICE_DESC DeviceDescription)
{ {
ULONG Index; ULONG Index;
@ -206,32 +204,31 @@ HidParser_FreeCollectionDescription(
// //
// free collection context // free collection context
// //
Parser->Free(DeviceDescription->CollectionDesc[Index].PreparsedData); FreeFunction(DeviceDescription->CollectionDesc[Index].PreparsedData);
} }
// //
// now free collection description // now free collection description
// //
Parser->Free(DeviceDescription->CollectionDesc); FreeFunction(DeviceDescription->CollectionDesc);
// //
// free report description // free report description
// //
Parser->Free(DeviceDescription->ReportIDs); FreeFunction(DeviceDescription->ReportIDs);
} }
HIDAPI HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetCaps( HidParser_GetCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PHIDP_CAPS Capabilities) OUT PHIDP_CAPS Capabilities)
{ {
// //
// zero capabilities // zero capabilities
// //
Parser->Zero(Capabilities, sizeof(HIDP_CAPS)); ZeroFunction(Capabilities, sizeof(HIDP_CAPS));
// //
// init capabilities // init capabilities
@ -285,7 +282,6 @@ HIDAPI
ULONG ULONG
NTAPI NTAPI
HidParser_MaxUsageListLength( HidParser_MaxUsageListLength(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage OPTIONAL) IN USAGE UsagePage OPTIONAL)
@ -342,20 +338,18 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetButtonCaps( HidParser_GetButtonCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_BUTTON_CAPS ButtonCaps, IN PHIDP_BUTTON_CAPS ButtonCaps,
IN PUSHORT ButtonCapsLength) IN PUSHORT ButtonCapsLength)
{ {
return HidParser_GetSpecificButtonCaps(Parser, CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_PAGE_UNDEFINED, ButtonCaps, (PULONG)ButtonCapsLength); return HidParser_GetSpecificButtonCaps(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_PAGE_UNDEFINED, ButtonCaps, (PULONG)ButtonCapsLength);
} }
HIDAPI HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetSpecificValueCaps( HidParser_GetSpecificValueCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -376,21 +370,21 @@ HidParser_GetSpecificValueCaps(
// //
// input report // input report
// //
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength); ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
} }
else if (ReportType == HidP_Output) else if (ReportType == HidP_Output)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength); ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
} }
else if (ReportType == HidP_Feature) else if (ReportType == HidP_Feature)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength); ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
} }
else else
{ {
@ -548,7 +542,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsages( HidParser_GetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -570,21 +563,21 @@ HidParser_GetUsages(
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength); ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
} }
else if (ReportType == HidP_Output) else if (ReportType == HidP_Output)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength); ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
} }
else if (ReportType == HidP_Feature) else if (ReportType == HidP_Feature)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength); ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
} }
else else
{ {
@ -612,7 +605,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetScaledUsageValue( HidParser_GetScaledUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -634,21 +626,21 @@ HidParser_GetScaledUsageValue(
// //
// input report // input report
// //
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else if (ReportType == HidP_Output) else if (ReportType == HidP_Output)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else if (ReportType == HidP_Feature) else if (ReportType == HidP_Feature)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else else
{ {
@ -676,7 +668,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_TranslateUsageAndPagesToI8042ScanCodes( HidParser_TranslateUsageAndPagesToI8042ScanCodes(
IN PHID_PARSER Parser,
IN PUSAGE_AND_PAGE ChangedUsageList, IN PUSAGE_AND_PAGE ChangedUsageList,
IN ULONG UsageListLength, IN ULONG UsageListLength,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
@ -697,14 +688,14 @@ HidParser_TranslateUsageAndPagesToI8042ScanCodes(
// //
// process keyboard usage // process keyboard usage
// //
Status = HidParser_TranslateKbdUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext); Status = HidParser_TranslateKbdUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
} }
else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER) else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER)
{ {
// //
// process consumer usage // process consumer usage
// //
Status = HidParser_TranslateCustUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext); Status = HidParser_TranslateCustUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
} }
else else
{ {
@ -745,7 +736,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsagesEx( HidParser_GetUsagesEx(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USHORT LinkCollection, IN USHORT LinkCollection,
@ -754,7 +744,7 @@ HidParser_GetUsagesEx(
IN PCHAR Report, IN PCHAR Report,
IN ULONG ReportLength) IN ULONG ReportLength)
{ {
return HidParser_GetUsages(Parser, CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength); return HidParser_GetUsages(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength);
} }
HIDAPI HIDAPI
@ -890,7 +880,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetSpecificButtonCaps( HidParser_GetSpecificButtonCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -909,7 +898,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetData( HidParser_GetData(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
OUT PHIDP_DATA DataList, OUT PHIDP_DATA DataList,
@ -926,7 +914,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetExtendedAttributes( HidParser_GetExtendedAttributes(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USHORT DataIndex, IN USHORT DataIndex,
@ -942,7 +929,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetLinkCollectionNodes( HidParser_GetLinkCollectionNodes(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
IN OUT PULONG LinkCollectionNodesLength) IN OUT PULONG LinkCollectionNodesLength)
@ -956,7 +942,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsageValue( HidParser_GetUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -978,21 +963,21 @@ HidParser_GetUsageValue(
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else if (ReportType == HidP_Output) else if (ReportType == HidP_Output)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else if (ReportType == HidP_Feature) else if (ReportType == HidP_Feature)
{ {
// //
// input report // input report
// //
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength); ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
} }
else else
{ {
@ -1019,7 +1004,6 @@ HidParser_GetUsageValue(
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SysPowerEvent( HidParser_SysPowerEvent(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN PCHAR HidPacket, IN PCHAR HidPacket,
IN USHORT HidPacketLength, IN USHORT HidPacketLength,
@ -1033,7 +1017,6 @@ HidParser_SysPowerEvent(
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SysPowerCaps ( HidParser_SysPowerCaps (
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PULONG OutputBuffer) OUT PULONG OutputBuffer)
{ {
@ -1046,7 +1029,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsageValueArray( HidParser_GetUsageValueArray(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1066,7 +1048,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_UnsetUsages( HidParser_UnsetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1101,7 +1082,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsages( HidParser_SetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1120,7 +1100,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsageValueArray( HidParser_SetUsageValueArray(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1140,7 +1119,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsageValue( HidParser_SetUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1159,7 +1137,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetScaledUsageValue( HidParser_SetScaledUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -1178,7 +1155,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetData( HidParser_SetData(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_DATA DataList, IN PHIDP_DATA DataList,
@ -1195,7 +1171,6 @@ HIDAPI
ULONG ULONG
NTAPI NTAPI
HidParser_MaxDataListLength( HidParser_MaxDataListLength(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType) IN HIDP_REPORT_TYPE ReportType)
{ {
@ -1208,7 +1183,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_InitializeReportForID( HidParser_InitializeReportForID(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN UCHAR ReportID, IN UCHAR ReportID,
@ -1226,7 +1200,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetValueCaps( HidParser_GetValueCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType, HIDP_REPORT_TYPE ReportType,
PHIDP_VALUE_CAPS ValueCaps, PHIDP_VALUE_CAPS ValueCaps,

View file

@ -10,15 +10,6 @@
#pragma once #pragma once
//
// function prototypes
//
typedef PVOID (NTAPI *PHIDPARSER_ALLOC_FUNCTION)(ULONG Size);
typedef VOID (NTAPI *PHIDPARSER_FREE_FUNCTION)(PVOID Item);
typedef VOID (NTAPI *PHIDPARSER_ZERO_FUNCTION)(PVOID Item, ULONG Size);
typedef VOID (NTAPI *PHIDPARSER_COPY_FUNCTION)(PVOID Target, PVOID Source, ULONG Size);
typedef VOID (__cdecl *PHIDPARSER_DEBUG_FUNCTION)(LPCSTR Src, ...);
// //
// status code // status code
// //
@ -42,52 +33,9 @@ typedef enum
HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10 HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10
}HIDPARSER_STATUS_CODES; }HIDPARSER_STATUS_CODES;
typedef struct
{
//
// size of struct
//
unsigned long Size;
//
// allocation function
//
PHIDPARSER_ALLOC_FUNCTION Alloc;
//
// free function
//
PHIDPARSER_FREE_FUNCTION Free;
//
// zero function
//
PHIDPARSER_ZERO_FUNCTION Zero;
//
// copy function
//
PHIDPARSER_COPY_FUNCTION Copy;
//
// debug function
//
PHIDPARSER_DEBUG_FUNCTION Debug;
}HID_PARSER, *PHID_PARSER;
VOID
HidParser_InitParser(
IN PHIDPARSER_ALLOC_FUNCTION AllocFunction,
IN PHIDPARSER_FREE_FUNCTION FreeFunction,
IN PHIDPARSER_ZERO_FUNCTION ZeroFunction,
IN PHIDPARSER_COPY_FUNCTION CopyFunction,
IN PHIDPARSER_DEBUG_FUNCTION DebugFunction,
OUT PHID_PARSER Parser);
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetCollectionDescription( HidParser_GetCollectionDescription(
IN PHID_PARSER Parser,
IN PHIDP_REPORT_DESCRIPTOR ReportDesc, IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength, IN ULONG DescLength,
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
@ -96,14 +44,12 @@ HidParser_GetCollectionDescription(
VOID VOID
NTAPI NTAPI
HidParser_FreeCollectionDescription( HidParser_FreeCollectionDescription(
IN PHID_PARSER Parser,
IN PHIDP_DEVICE_DESC DeviceDescription); IN PHIDP_DEVICE_DESC DeviceDescription);
HIDAPI HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetCaps( HidParser_GetCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PHIDP_CAPS Capabilities); OUT PHIDP_CAPS Capabilities);
@ -111,7 +57,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetSpecificValueCaps( HidParser_GetSpecificValueCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -125,7 +70,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetButtonCaps( HidParser_GetButtonCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType, HIDP_REPORT_TYPE ReportType,
PHIDP_BUTTON_CAPS ButtonCaps, PHIDP_BUTTON_CAPS ButtonCaps,
@ -135,7 +79,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetSpecificButtonCaps( HidParser_GetSpecificButtonCaps(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -148,7 +91,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetScaledUsageValue( HidParser_GetScaledUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -163,7 +105,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetData( HidParser_GetData(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
OUT PHIDP_DATA DataList, OUT PHIDP_DATA DataList,
@ -175,7 +116,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetExtendedAttributes( HidParser_GetExtendedAttributes(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USHORT DataIndex, IN USHORT DataIndex,
@ -186,7 +126,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetLinkCollectionNodes( HidParser_GetLinkCollectionNodes(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
IN OUT PULONG LinkCollectionNodesLength); IN OUT PULONG LinkCollectionNodesLength);
@ -196,7 +135,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsageValue( HidParser_GetUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -221,7 +159,6 @@ HIDAPI
ULONG ULONG
NTAPI NTAPI
HidParser_MaxUsageListLength( HidParser_MaxUsageListLength(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage OPTIONAL); IN USAGE UsagePage OPTIONAL);
@ -230,7 +167,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsages( HidParser_GetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -244,7 +180,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsagesEx( HidParser_GetUsagesEx(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USHORT LinkCollection, IN USHORT LinkCollection,
@ -257,7 +192,6 @@ HidParser_GetUsagesEx(
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SysPowerEvent ( HidParser_SysPowerEvent (
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN PCHAR HidPacket, IN PCHAR HidPacket,
IN USHORT HidPacketLength, IN USHORT HidPacketLength,
@ -266,7 +200,6 @@ HidParser_SysPowerEvent (
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SysPowerCaps ( HidParser_SysPowerCaps (
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
OUT PULONG OutputBuffer); OUT PULONG OutputBuffer);
@ -274,7 +207,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetUsageValueArray( HidParser_GetUsageValueArray(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -300,7 +232,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_UnsetUsages( HidParser_UnsetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -325,7 +256,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_TranslateUsageAndPagesToI8042ScanCodes( HidParser_TranslateUsageAndPagesToI8042ScanCodes(
IN PHID_PARSER Parser,
IN PUSAGE_AND_PAGE ChangedUsageList, IN PUSAGE_AND_PAGE ChangedUsageList,
IN ULONG UsageListLength, IN ULONG UsageListLength,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
@ -337,7 +267,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsages( HidParser_SetUsages(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -351,7 +280,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsageValueArray( HidParser_SetUsageValueArray(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -366,7 +294,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetUsageValue( HidParser_SetUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -380,7 +307,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetScaledUsageValue( HidParser_SetScaledUsageValue(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -394,7 +320,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_SetData( HidParser_SetData(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_DATA DataList, IN PHIDP_DATA DataList,
@ -406,7 +331,6 @@ HIDAPI
ULONG ULONG
NTAPI NTAPI
HidParser_MaxDataListLength( HidParser_MaxDataListLength(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType); IN HIDP_REPORT_TYPE ReportType);
@ -414,7 +338,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_InitializeReportForID( HidParser_InitializeReportForID(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType, IN HIDP_REPORT_TYPE ReportType,
IN UCHAR ReportID, IN UCHAR ReportID,
@ -423,7 +346,6 @@ HidParser_InitializeReportForID(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_TranslateKbdUsage( HidParser_TranslateKbdUsage(
IN PHID_PARSER Parser,
IN USAGE Usage, IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
@ -432,7 +354,6 @@ HidParser_TranslateKbdUsage(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_TranslateCustUsage( HidParser_TranslateCustUsage(
IN PHID_PARSER Parser,
IN USAGE Usage, IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction, IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
@ -443,7 +364,6 @@ HIDAPI
NTSTATUS NTSTATUS
NTAPI NTAPI
HidParser_GetValueCaps( HidParser_GetValueCaps(
PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType, HIDP_REPORT_TYPE ReportType,
PHIDP_VALUE_CAPS ValueCaps, PHIDP_VALUE_CAPS ValueCaps,

View file

@ -17,7 +17,6 @@ static UCHAR ItemSize[4] = { 0, 1, 2, 4 };
VOID VOID
HidParser_DeleteReport( HidParser_DeleteReport(
IN PHID_PARSER Parser,
IN PHID_REPORT Report) IN PHID_REPORT Report)
{ {
// //
@ -27,7 +26,6 @@ HidParser_DeleteReport(
VOID VOID
HidParser_FreeCollection( HidParser_FreeCollection(
IN PHID_PARSER Parser,
IN PHID_COLLECTION Collection) IN PHID_COLLECTION Collection)
{ {
// //
@ -37,7 +35,6 @@ HidParser_FreeCollection(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_AllocateCollection( HidParser_AllocateCollection(
IN PHID_PARSER Parser,
IN PHID_COLLECTION ParentCollection, IN PHID_COLLECTION ParentCollection,
IN UCHAR Type, IN UCHAR Type,
IN PLOCAL_ITEM_STATE LocalItemState, IN PLOCAL_ITEM_STATE LocalItemState,
@ -49,7 +46,7 @@ HidParser_AllocateCollection(
// //
// first allocate the collection // first allocate the collection
// //
Collection = (PHID_COLLECTION)Parser->Alloc(sizeof(HID_COLLECTION)); Collection = (PHID_COLLECTION)AllocFunction(sizeof(HID_COLLECTION));
if (!Collection) if (!Collection)
{ {
// //
@ -105,7 +102,7 @@ HidParser_AllocateCollection(
// //
// no usage set // no usage set
// //
Parser->Debug("HIDPARSE] No usage set\n"); DebugFunction("HIDPARSE] No usage set\n");
UsageValue.u.Extended = 0; UsageValue.u.Extended = 0;
} }
@ -127,7 +124,6 @@ HidParser_AllocateCollection(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_AddCollection( HidParser_AddCollection(
IN PHID_PARSER Parser,
IN PHID_COLLECTION CurrentCollection, IN PHID_COLLECTION CurrentCollection,
IN PHID_COLLECTION NewCollection) IN PHID_COLLECTION NewCollection)
{ {
@ -142,7 +138,7 @@ HidParser_AddCollection(
// //
// allocate new collection // allocate new collection
// //
NewAllocCollection = (PHID_COLLECTION*)Parser->Alloc(sizeof(PHID_COLLECTION) * CollectionCount); NewAllocCollection = (PHID_COLLECTION*)AllocFunction(sizeof(PHID_COLLECTION) * CollectionCount);
if (!NewAllocCollection) if (!NewAllocCollection)
{ {
// //
@ -156,12 +152,12 @@ HidParser_AddCollection(
// //
// copy old array // copy old array
// //
Parser->Copy(NewAllocCollection, CurrentCollection->Nodes, CurrentCollection->NodeCount * sizeof(PHID_COLLECTION)); CopyFunction(NewAllocCollection, CurrentCollection->Nodes, CurrentCollection->NodeCount * sizeof(PHID_COLLECTION));
// //
// delete old array // delete old array
// //
Parser->Free(CurrentCollection->Nodes); FreeFunction(CurrentCollection->Nodes);
} }
// //
@ -227,7 +223,6 @@ HidParser_FindReportInCollection(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_FindReport( HidParser_FindReport(
IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext, IN PHID_PARSER_CONTEXT ParserContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN UCHAR ReportID, IN UCHAR ReportID,
@ -241,7 +236,6 @@ HidParser_FindReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_AllocateReport( HidParser_AllocateReport(
IN PHID_PARSER Parser,
IN UCHAR ReportType, IN UCHAR ReportType,
IN UCHAR ReportID, IN UCHAR ReportID,
OUT PHID_REPORT *OutReport) OUT PHID_REPORT *OutReport)
@ -251,7 +245,7 @@ HidParser_AllocateReport(
// //
// allocate report // allocate report
// //
Report = (PHID_REPORT)Parser->Alloc(sizeof(HID_REPORT)); Report = (PHID_REPORT)AllocFunction(sizeof(HID_REPORT));
if (!Report) if (!Report)
{ {
// //
@ -275,7 +269,6 @@ HidParser_AllocateReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_AddReportToCollection( HidParser_AddReportToCollection(
IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext, IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION CurrentCollection, IN PHID_COLLECTION CurrentCollection,
IN PHID_REPORT NewReport) IN PHID_REPORT NewReport)
@ -285,7 +278,7 @@ HidParser_AddReportToCollection(
// //
// allocate new report array // allocate new report array
// //
NewReportArray = (PHID_REPORT*)Parser->Alloc(sizeof(PHID_REPORT) * (CurrentCollection->ReportCount + 1)); NewReportArray = (PHID_REPORT*)AllocFunction(sizeof(PHID_REPORT) * (CurrentCollection->ReportCount + 1));
if (!NewReportArray) if (!NewReportArray)
{ {
// //
@ -299,12 +292,12 @@ HidParser_AddReportToCollection(
// //
// copy old array contents // copy old array contents
// //
Parser->Copy(NewReportArray, CurrentCollection->Reports, sizeof(PHID_REPORT) * CurrentCollection->ReportCount); CopyFunction(NewReportArray, CurrentCollection->Reports, sizeof(PHID_REPORT) * CurrentCollection->ReportCount);
// //
// free old array // free old array
// //
Parser->Free(CurrentCollection->Reports); FreeFunction(CurrentCollection->Reports);
} }
// //
@ -322,7 +315,6 @@ HidParser_AddReportToCollection(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetReport( HidParser_GetReport(
IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext, IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION Collection, IN PHID_COLLECTION Collection,
IN UCHAR ReportType, IN UCHAR ReportType,
@ -335,7 +327,7 @@ HidParser_GetReport(
// //
// try finding existing report // try finding existing report
// //
Status = HidParser_FindReport(Parser, ParserContext, ReportType, ReportID, OutReport); Status = HidParser_FindReport(ParserContext, ReportType, ReportID, OutReport);
if (Status == HIDPARSER_STATUS_SUCCESS || CreateIfNotExists == FALSE) if (Status == HIDPARSER_STATUS_SUCCESS || CreateIfNotExists == FALSE)
{ {
// //
@ -347,7 +339,7 @@ HidParser_GetReport(
// //
// allocate new report // allocate new report
// //
Status = HidParser_AllocateReport(Parser, ReportType, ReportID, OutReport); Status = HidParser_AllocateReport(ReportType, ReportID, OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS) if (Status != HIDPARSER_STATUS_SUCCESS)
{ {
// //
@ -359,13 +351,13 @@ HidParser_GetReport(
// //
// add report // add report
// //
Status = HidParser_AddReportToCollection(Parser, ParserContext, Collection, *OutReport); Status = HidParser_AddReportToCollection(ParserContext, Collection, *OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS) if (Status != HIDPARSER_STATUS_SUCCESS)
{ {
// //
// failed to allocate report // failed to allocate report
// //
Parser->Free(*OutReport); FreeFunction(*OutReport);
} }
// //
@ -376,7 +368,6 @@ HidParser_GetReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_ReserveReportItems( HidParser_ReserveReportItems(
IN PHID_PARSER Parser,
IN PHID_REPORT Report, IN PHID_REPORT Report,
IN ULONG ReportCount, IN ULONG ReportCount,
OUT PHID_REPORT *OutReport) OUT PHID_REPORT *OutReport)
@ -402,7 +393,7 @@ HidParser_ReserveReportItems(
// //
// allocate memory // allocate memory
// //
NewReport = (PHID_REPORT)Parser->Alloc(Size + OldSize); NewReport = (PHID_REPORT)AllocFunction(Size + OldSize);
if (!NewReport) if (!NewReport)
{ {
// //
@ -415,7 +406,7 @@ HidParser_ReserveReportItems(
// //
// copy old report // copy old report
// //
Parser->Copy(NewReport, Report, OldSize); CopyFunction(NewReport, Report, OldSize);
// //
// increase array size // increase array size
@ -651,7 +642,6 @@ HidParser_UpdateCollectionReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_AddMainItem( HidParser_AddMainItem(
IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext, IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_REPORT Report, IN PHID_REPORT Report,
IN PGLOBAL_ITEM_STATE GlobalItemState, IN PGLOBAL_ITEM_STATE GlobalItemState,
@ -667,7 +657,7 @@ HidParser_AddMainItem(
// //
// first grow report item array // first grow report item array
// //
Status = HidParser_ReserveReportItems(Parser, Report, GlobalItemState->ReportCount, &NewReport); Status = HidParser_ReserveReportItems(Report, GlobalItemState->ReportCount, &NewReport);
if (Status != HIDPARSER_STATUS_SUCCESS) if (Status != HIDPARSER_STATUS_SUCCESS)
{ {
// //
@ -715,7 +705,6 @@ HidParser_AddMainItem(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_ParseReportDescriptor( HidParser_ParseReportDescriptor(
IN PHID_PARSER Parser,
IN PUCHAR ReportDescriptor, IN PUCHAR ReportDescriptor,
IN ULONG ReportLength, IN ULONG ReportLength,
OUT PVOID *OutParser) OUT PVOID *OutParser)
@ -745,7 +734,7 @@ HidParser_ParseReportDescriptor(
// //
// allocate parser // allocate parser
// //
ParserContext = Parser->Alloc(sizeof(HID_PARSER_CONTEXT));; ParserContext = AllocFunction(sizeof(HID_PARSER_CONTEXT));
if (!ParserContext) if (!ParserContext)
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES; return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
@ -754,28 +743,28 @@ HidParser_ParseReportDescriptor(
// allocate usage stack // allocate usage stack
// //
ParserContext->LocalItemState.UsageStackAllocated = 10; ParserContext->LocalItemState.UsageStackAllocated = 10;
ParserContext->LocalItemState.UsageStack = (PUSAGE_VALUE)Parser->Alloc(ParserContext->LocalItemState.UsageStackAllocated * sizeof(USAGE_VALUE)); ParserContext->LocalItemState.UsageStack = (PUSAGE_VALUE)AllocFunction(ParserContext->LocalItemState.UsageStackAllocated * sizeof(USAGE_VALUE));
if (!ParserContext->LocalItemState.UsageStack) if (!ParserContext->LocalItemState.UsageStack)
{ {
// //
// no memory // no memory
// //
Parser->Free(ParserContext); FreeFunction(ParserContext);
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES; return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
} }
// //
// now allocate root collection // now allocate root collection
// //
Status = HidParser_AllocateCollection(Parser, NULL, COLLECTION_LOGICAL, &ParserContext->LocalItemState, &ParserContext->RootCollection); Status = HidParser_AllocateCollection(NULL, COLLECTION_LOGICAL, &ParserContext->LocalItemState, &ParserContext->RootCollection);
if (Status != HIDPARSER_STATUS_SUCCESS) if (Status != HIDPARSER_STATUS_SUCCESS)
{ {
// //
// no memory // no memory
// //
Parser->Free(ParserContext->LocalItemState.UsageStack); FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL; ParserContext->LocalItemState.UsageStack = NULL;
Parser->Free(ParserContext); FreeFunction(ParserContext);
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES; return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
} }
@ -827,11 +816,11 @@ HidParser_ParseReportDescriptor(
// //
// invalid item size // invalid item size
// //
//Parser->Debug("CurrentItem invalid item size %lu\n", CurrentItemSize); //DebugFunction("CurrentItem invalid item size %lu\n", CurrentItemSize);
} }
} }
Parser->Debug("Tag %x Type %x Size %x Offset %lu Length %lu\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, ((ULONG_PTR)CurrentItem - (ULONG_PTR)ReportDescriptor), ReportLength); DebugFunction("Tag %x Type %x Size %x Offset %lu Length %lu\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, ((ULONG_PTR)CurrentItem - (ULONG_PTR)ReportDescriptor), ReportLength);
// //
// handle items // handle items
// //
@ -880,13 +869,13 @@ HidParser_ParseReportDescriptor(
// //
// allocate new collection // allocate new collection
// //
Status = HidParser_AllocateCollection(Parser, CurrentCollection, (UCHAR)Data, &ParserContext->LocalItemState, &NewCollection); Status = HidParser_AllocateCollection(CurrentCollection, (UCHAR)Data, &ParserContext->LocalItemState, &NewCollection);
ASSERT(Status == HIDPARSER_STATUS_SUCCESS); ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
// //
// add new collection to current collection // add new collection to current collection
// //
Status = HidParser_AddCollection(Parser, CurrentCollection, NewCollection); Status = HidParser_AddCollection(CurrentCollection, NewCollection);
ASSERT(Status == HIDPARSER_STATUS_SUCCESS); ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
// //
@ -925,7 +914,7 @@ HidParser_ParseReportDescriptor(
break; break;
default: default:
Parser->Debug("[HIDPARSE] Unknown ReportType Tag %x Type %x Size %x CurrentItemSize %x\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, CurrentItemSize); DebugFunction("[HIDPARSE] Unknown ReportType Tag %x Type %x Size %x CurrentItemSize %x\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, CurrentItemSize);
ASSERT(FALSE); ASSERT(FALSE);
break; break;
} }
@ -936,7 +925,7 @@ HidParser_ParseReportDescriptor(
// //
// get report // get report
// //
Status = HidParser_GetReport(Parser, ParserContext, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report); Status = HidParser_GetReport(ParserContext, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
ASSERT(Status == HIDPARSER_STATUS_SUCCESS); ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
// fill in a sensible default if the index isn't set // fill in a sensible default if the index isn't set
@ -956,7 +945,7 @@ HidParser_ParseReportDescriptor(
// //
// add states & data to the report // add states & data to the report
// //
Status = HidParser_AddMainItem(Parser, ParserContext, Report, &ParserContext->GlobalItemState, &ParserContext->LocalItemState, MainItemData, CurrentCollection); Status = HidParser_AddMainItem(ParserContext, Report, &ParserContext->GlobalItemState, &ParserContext->LocalItemState, MainItemData, CurrentCollection);
ASSERT(Status == HIDPARSER_STATUS_SUCCESS); ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
} }
@ -969,7 +958,7 @@ HidParser_ParseReportDescriptor(
// //
// reset the local item state and clear the usage stack // reset the local item state and clear the usage stack
// //
Parser->Zero(&ParserContext->LocalItemState, sizeof(LOCAL_ITEM_STATE)); ZeroFunction(&ParserContext->LocalItemState, sizeof(LOCAL_ITEM_STATE));
// //
// restore stack // restore stack
@ -982,68 +971,68 @@ HidParser_ParseReportDescriptor(
{ {
switch (CurrentItem->Tag) { switch (CurrentItem->Tag) {
case ITEM_TAG_GLOBAL_USAGE_PAGE: case ITEM_TAG_GLOBAL_USAGE_PAGE:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_USAGE_PAGE %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_USAGE_PAGE %x\n", Data);
ParserContext->GlobalItemState.UsagePage = Data; ParserContext->GlobalItemState.UsagePage = Data;
break; break;
case ITEM_TAG_GLOBAL_LOGICAL_MINIMUM: case ITEM_TAG_GLOBAL_LOGICAL_MINIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_LOGICAL_MINIMUM %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_LOGICAL_MINIMUM %x\n", Data);
ParserContext->GlobalItemState.LogicalMinimum = Data; ParserContext->GlobalItemState.LogicalMinimum = Data;
break; break;
case ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM: case ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_LOCAL_MAXIMUM %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_LOCAL_MAXIMUM %x\n", Data);
ParserContext->GlobalItemState.LogicialMaximum = Data; ParserContext->GlobalItemState.LogicialMaximum = Data;
break; break;
case ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM: case ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM %x\n", Data);
ParserContext->GlobalItemState.PhysicalMinimum = Data; ParserContext->GlobalItemState.PhysicalMinimum = Data;
break; break;
case ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM: case ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM %x\n", Data);
ParserContext->GlobalItemState.PhysicalMaximum = Data; ParserContext->GlobalItemState.PhysicalMaximum = Data;
break; break;
case ITEM_TAG_GLOBAL_UNIT_EXPONENT: case ITEM_TAG_GLOBAL_UNIT_EXPONENT:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT_EXPONENT %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT_EXPONENT %x\n", Data);
ParserContext->GlobalItemState.UnitExponent = Data; ParserContext->GlobalItemState.UnitExponent = Data;
break; break;
case ITEM_TAG_GLOBAL_UNIT: case ITEM_TAG_GLOBAL_UNIT:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT %x\n", Data);
ParserContext->GlobalItemState.Unit = Data; ParserContext->GlobalItemState.Unit = Data;
break; break;
case ITEM_TAG_GLOBAL_REPORT_SIZE: case ITEM_TAG_GLOBAL_REPORT_SIZE:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_SIZE %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_SIZE %x\n", Data);
ParserContext->GlobalItemState.ReportSize = Data; ParserContext->GlobalItemState.ReportSize = Data;
break; break;
case ITEM_TAG_GLOBAL_REPORT_ID: case ITEM_TAG_GLOBAL_REPORT_ID:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_ID %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_ID %x\n", Data);
ParserContext->GlobalItemState.ReportId = Data; ParserContext->GlobalItemState.ReportId = Data;
ParserContext->UseReportIDs = TRUE; ParserContext->UseReportIDs = TRUE;
break; break;
case ITEM_TAG_GLOBAL_REPORT_COUNT: case ITEM_TAG_GLOBAL_REPORT_COUNT:
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_COUNT %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_COUNT %x\n", Data);
ParserContext->GlobalItemState.ReportCount = Data; ParserContext->GlobalItemState.ReportCount = Data;
break; break;
case ITEM_TAG_GLOBAL_PUSH: case ITEM_TAG_GLOBAL_PUSH:
{ {
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n"); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n");
// //
// allocate global item state // allocate global item state
// //
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)Parser->Alloc(sizeof(GLOBAL_ITEM_STATE)); LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)AllocFunction(sizeof(GLOBAL_ITEM_STATE));
ASSERT(LinkedGlobalItemState); ASSERT(LinkedGlobalItemState);
// //
// copy global item state // copy global item state
// //
Parser->Copy(LinkedGlobalItemState, &ParserContext->GlobalItemState, sizeof(GLOBAL_ITEM_STATE)); CopyFunction(LinkedGlobalItemState, &ParserContext->GlobalItemState, sizeof(GLOBAL_ITEM_STATE));
// //
// store pushed item in link member // store pushed item in link member
@ -1053,7 +1042,7 @@ HidParser_ParseReportDescriptor(
} }
case ITEM_TAG_GLOBAL_POP: case ITEM_TAG_GLOBAL_POP:
{ {
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_POP\n"); DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_POP\n");
if (ParserContext->GlobalItemState.Next == NULL) if (ParserContext->GlobalItemState.Next == NULL)
{ {
// //
@ -1071,12 +1060,12 @@ HidParser_ParseReportDescriptor(
// //
// replace current item with linked one // replace current item with linked one
// //
Parser->Copy(&ParserContext->GlobalItemState, LinkedGlobalItemState, sizeof(GLOBAL_ITEM_STATE)); CopyFunction(&ParserContext->GlobalItemState, LinkedGlobalItemState, sizeof(GLOBAL_ITEM_STATE));
// //
// free item // free item
// //
Parser->Free(LinkedGlobalItemState); FreeFunction(LinkedGlobalItemState);
break; break;
} }
@ -1106,18 +1095,18 @@ HidParser_ParseReportDescriptor(
// //
// build new usage stack // build new usage stack
// //
NewUsageStack = (PUSAGE_VALUE)Parser->Alloc(sizeof(USAGE_VALUE) * ParserContext->LocalItemState.UsageStackAllocated); NewUsageStack = (PUSAGE_VALUE)AllocFunction(sizeof(USAGE_VALUE) * ParserContext->LocalItemState.UsageStackAllocated);
ASSERT(NewUsageStack); ASSERT(NewUsageStack);
// //
// copy old usage stack // copy old usage stack
// //
Parser->Copy(NewUsageStack, ParserContext->LocalItemState.UsageStack, sizeof(USAGE_VALUE) * (ParserContext->LocalItemState.UsageStackAllocated - 10)); CopyFunction(NewUsageStack, ParserContext->LocalItemState.UsageStack, sizeof(USAGE_VALUE) * (ParserContext->LocalItemState.UsageStackAllocated - 10));
// //
// free old usage stack // free old usage stack
// //
Parser->Free(ParserContext->LocalItemState.UsageStack); FreeFunction(ParserContext->LocalItemState.UsageStack);
// //
// replace with new usage stack // replace with new usage stack
@ -1144,7 +1133,7 @@ HidParser_ParseReportDescriptor(
} }
case ITEM_TAG_LOCAL_USAGE_MINIMUM: case ITEM_TAG_LOCAL_USAGE_MINIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MINIMUM Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MINIMUM Data %x\n", Data);
ParserContext->LocalItemState.UsageMinimum.u.Extended = Data; ParserContext->LocalItemState.UsageMinimum.u.Extended = Data;
ParserContext->LocalItemState.UsageMinimum.IsExtended ParserContext->LocalItemState.UsageMinimum.IsExtended
= CurrentItemSize == sizeof(ULONG); = CurrentItemSize == sizeof(ULONG);
@ -1152,7 +1141,7 @@ HidParser_ParseReportDescriptor(
break; break;
case ITEM_TAG_LOCAL_USAGE_MAXIMUM: case ITEM_TAG_LOCAL_USAGE_MAXIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MAXIMUM Data %x ItemSize %x %x\n", Data, CurrentItemSize, CurrentItem->Size); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MAXIMUM Data %x ItemSize %x %x\n", Data, CurrentItemSize, CurrentItem->Size);
ParserContext->LocalItemState.UsageMaximum.u.Extended = Data; ParserContext->LocalItemState.UsageMaximum.u.Extended = Data;
ParserContext->LocalItemState.UsageMaximum.IsExtended ParserContext->LocalItemState.UsageMaximum.IsExtended
= CurrentItemSize == sizeof(ULONG); = CurrentItemSize == sizeof(ULONG);
@ -1160,39 +1149,39 @@ HidParser_ParseReportDescriptor(
break; break;
case ITEM_TAG_LOCAL_DESIGNATOR_INDEX: case ITEM_TAG_LOCAL_DESIGNATOR_INDEX:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_INDEX Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_INDEX Data %x\n", Data);
ParserContext->LocalItemState.DesignatorIndex = Data; ParserContext->LocalItemState.DesignatorIndex = Data;
ParserContext->LocalItemState.DesignatorIndexSet = TRUE; ParserContext->LocalItemState.DesignatorIndexSet = TRUE;
break; break;
case ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM: case ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM Data %x\n", Data);
ParserContext->LocalItemState.DesignatorMinimum = Data; ParserContext->LocalItemState.DesignatorMinimum = Data;
break; break;
case ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM: case ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM Data %x\n", Data);
ParserContext->LocalItemState.DesignatorMaximum = Data; ParserContext->LocalItemState.DesignatorMaximum = Data;
break; break;
case ITEM_TAG_LOCAL_STRING_INDEX: case ITEM_TAG_LOCAL_STRING_INDEX:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_INDEX Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_INDEX Data %x\n", Data);
ParserContext->LocalItemState.StringIndex = Data; ParserContext->LocalItemState.StringIndex = Data;
ParserContext->LocalItemState.StringIndexSet = TRUE; ParserContext->LocalItemState.StringIndexSet = TRUE;
break; break;
case ITEM_TAG_LOCAL_STRING_MINIMUM: case ITEM_TAG_LOCAL_STRING_MINIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MINIMUM Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MINIMUM Data %x\n", Data);
ParserContext->LocalItemState.StringMinimum = Data; ParserContext->LocalItemState.StringMinimum = Data;
break; break;
case ITEM_TAG_LOCAL_STRING_MAXIMUM: case ITEM_TAG_LOCAL_STRING_MAXIMUM:
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MAXIMUM Data %x\n", Data); DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MAXIMUM Data %x\n", Data);
ParserContext->LocalItemState.StringMaximum = Data; ParserContext->LocalItemState.StringMaximum = Data;
break; break;
default: default:
Parser->Debug("Unknown Local Item Tag %x\n", CurrentItem->Tag); DebugFunction("Unknown Local Item Tag %x\n", CurrentItem->Tag);
ASSERT(FALSE); ASSERT(FALSE);
break; break;
} }
@ -1202,7 +1191,7 @@ HidParser_ParseReportDescriptor(
case ITEM_TYPE_LONG: case ITEM_TYPE_LONG:
{ {
CurrentLongItem = (PLONG_ITEM)CurrentItem; CurrentLongItem = (PLONG_ITEM)CurrentItem;
Parser->Debug("Unsupported ITEM_TYPE_LONG Tag %x\n", CurrentLongItem->LongItemTag); DebugFunction("Unsupported ITEM_TYPE_LONG Tag %x\n", CurrentLongItem->LongItemTag);
break; break;
} }
} }
@ -1221,7 +1210,7 @@ HidParser_ParseReportDescriptor(
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)ParserContext->GlobalItemState.Next; LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)ParserContext->GlobalItemState.Next;
while(LinkedGlobalItemState != NULL) while(LinkedGlobalItemState != NULL)
{ {
Parser->Debug("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState); DebugFunction("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState);
// //
// free global item state // free global item state
// //
@ -1230,7 +1219,7 @@ HidParser_ParseReportDescriptor(
// //
// free state // free state
// //
Parser->Free(LinkedGlobalItemState); FreeFunction(LinkedGlobalItemState);
// //
// move to next global state // move to next global state
@ -1241,7 +1230,7 @@ HidParser_ParseReportDescriptor(
// //
// free usage stack // free usage stack
// //
Parser->Free(ParserContext->LocalItemState.UsageStack); FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL; ParserContext->LocalItemState.UsageStack = NULL;
// //
@ -1257,7 +1246,6 @@ HidParser_ParseReportDescriptor(
PHID_COLLECTION PHID_COLLECTION
HidParser_GetCollection( HidParser_GetCollection(
IN PHID_PARSER Parser,
PHID_PARSER_CONTEXT ParserContext, PHID_PARSER_CONTEXT ParserContext,
IN ULONG CollectionNumber) IN ULONG CollectionNumber)
{ {
@ -1282,7 +1270,7 @@ HidParser_GetCollection(
// //
// no such collection // no such collection
// //
Parser->Debug("HIDPARSE] No such collection %lu\n", CollectionNumber); DebugFunction("HIDPARSE] No such collection %lu\n", CollectionNumber);
return NULL; return NULL;
} }
@ -1313,7 +1301,6 @@ HidParser_NumberOfTopCollections(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_BuildContext( HidParser_BuildContext(
IN PHID_PARSER Parser,
IN PVOID ParserContext, IN PVOID ParserContext,
IN ULONG CollectionIndex, IN ULONG CollectionIndex,
IN ULONG ContextSize, IN ULONG ContextSize,
@ -1326,13 +1313,13 @@ HidParser_BuildContext(
// //
// lets get the collection // lets get the collection
// //
Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex); Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
ASSERT(Collection); ASSERT(Collection);
// //
// lets allocate the context // lets allocate the context
// //
Context = Parser->Alloc(ContextSize); Context = AllocFunction(ContextSize);
if (Context == NULL) if (Context == NULL)
{ {
// //
@ -1344,7 +1331,7 @@ HidParser_BuildContext(
// //
// lets build the context // lets build the context
// //
Status = HidParser_BuildCollectionContext(Parser, Collection, Context, ContextSize); Status = HidParser_BuildCollectionContext(Collection, Context, ContextSize);
if (Status == HIDPARSER_STATUS_SUCCESS) if (Status == HIDPARSER_STATUS_SUCCESS)
{ {
// //
@ -1362,7 +1349,6 @@ HidParser_BuildContext(
ULONG ULONG
HidParser_GetContextSize( HidParser_GetContextSize(
IN PHID_PARSER Parser,
IN PVOID ParserContext, IN PVOID ParserContext,
IN ULONG CollectionIndex) IN ULONG CollectionIndex)
{ {
@ -1372,7 +1358,7 @@ HidParser_GetContextSize(
// //
// lets get the collection // lets get the collection
// //
Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex); Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
// //
// calculate size // calculate size

View file

@ -8,6 +8,7 @@
#include <hidpddi.h> #include <hidpddi.h>
#include "hidparser.h" #include "hidparser.h"
#include "hidp.h"
/* /*
* Copyright 2007, Haiku, Inc. All Rights Reserved. * Copyright 2007, Haiku, Inc. All Rights Reserved.
@ -276,10 +277,6 @@ HidParser_GetReportLength(
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType); IN UCHAR ReportType);
UCHAR
HidParser_IsReportIDUsed(
IN PHID_PARSER Parser);
ULONG ULONG
HidParser_GetReportItemCountFromReportType( HidParser_GetReportItemCountFromReportType(
IN PVOID CollectionContext, IN PVOID CollectionContext,
@ -299,7 +296,6 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetSpecificValueCapsWithReport( HidParser_GetSpecificValueCapsWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USHORT UsagePage, IN USHORT UsagePage,
@ -310,7 +306,6 @@ HidParser_GetSpecificValueCapsWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetUsagesWithReport( HidParser_GetUsagesWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -321,7 +316,6 @@ HidParser_GetUsagesWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetScaledUsageValueWithReport( HidParser_GetScaledUsageValueWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -332,7 +326,6 @@ HidParser_GetScaledUsageValueWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_GetUsageValueWithReport( HidParser_GetUsageValueWithReport(
IN PHID_PARSER Parser,
IN PVOID CollectionContext, IN PVOID CollectionContext,
IN UCHAR ReportType, IN UCHAR ReportType,
IN USAGE UsagePage, IN USAGE UsagePage,
@ -345,7 +338,6 @@ HidParser_GetUsageValueWithReport(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_BuildContext( HidParser_BuildContext(
IN PHID_PARSER Parser,
IN PVOID ParserContext, IN PVOID ParserContext,
IN ULONG CollectionIndex, IN ULONG CollectionIndex,
IN ULONG ContextSize, IN ULONG ContextSize,
@ -357,7 +349,6 @@ HidParser_CalculateContextSize(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_ParseReportDescriptor( HidParser_ParseReportDescriptor(
PHID_PARSER Parser,
PUCHAR Report, PUCHAR Report,
ULONG ReportSize, ULONG ReportSize,
OUT PVOID *ParserContext); OUT PVOID *ParserContext);
@ -368,7 +359,6 @@ HidParser_NumberOfTopCollections(
ULONG ULONG
HidParser_GetContextSize( HidParser_GetContextSize(
IN PHID_PARSER Parser,
IN PVOID ParserContext, IN PVOID ParserContext,
IN ULONG CollectionNumber); IN ULONG CollectionNumber);
@ -385,7 +375,6 @@ HidParser_GetTotalCollectionCount(
HIDPARSER_STATUS HIDPARSER_STATUS
HidParser_BuildCollectionContext( HidParser_BuildCollectionContext(
IN PHID_PARSER Parser,
IN PHID_COLLECTION RootCollection, IN PHID_COLLECTION RootCollection,
IN PVOID Context, IN PVOID Context,
IN ULONG ContextSize); IN ULONG ContextSize);