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
HidParser_GetMaxUsageListLengthWithReportAndPage(
IN PVOID CollectionContext,
HIDPARSER_STATUS
HidParser_GetSpecificValueCapsWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USHORT UsagePage,
//
// zero caps
//
- Parser->Zero(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS));
+ ZeroFunction(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS));
//
// init caps
HIDPARSER_STATUS
HidParser_GetUsagesWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
//
// 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
{
//
// success, clear rest of array
//
- Parser->Zero(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE));
+ ZeroFunction(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE));
}
HIDPARSER_STATUS
HidParser_GetUsageValueWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
// one extra shift for skipping the prepended report id
//
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
HIDPARSER_STATUS
HidParser_GetScaledUsageValueWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
// one extra shift for skipping the prepended report id
//
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
HIDPARSER_STATUS
HidParser_TranslateKbdUsage(
- IN PHID_PARSER Parser,
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
HIDPARSER_STATUS
HidParser_TranslateCustUsage(
- IN PHID_PARSER Parser,
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
ULONG
HidParser_StoreCollection(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION Collection,
IN PHID_COLLECTION_CONTEXT CollectionContext,
IN ULONG CurrentOffset)
//
// first copy the collection details
//
- Parser->Copy(TargetCollection, Collection, sizeof(HID_COLLECTION));
+ CopyFunction(TargetCollection, Collection, sizeof(HID_COLLECTION));
//
// calulcate collection size
//
// 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 sub collections
//
- CurrentOffset += HidParser_StoreCollection(Parser, Collection->Nodes[Index], CollectionContext, CurrentOffset);
+ CurrentOffset += HidParser_StoreCollection(Collection->Nodes[Index], CollectionContext, CurrentOffset);
//
// sanity check
HIDPARSER_STATUS
HidParser_BuildCollectionContext(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION RootCollection,
IN PVOID Context,
IN ULONG ContextSize)
//
// store collections
//
- CollectionSize = HidParser_StoreCollection(Parser, RootCollection, CollectionContext, 0);
+ CollectionSize = HidParser_StoreCollection(RootCollection, CollectionContext, 0);
//
// sanity check
HidP_FreeCollectionDescription(
IN PHIDP_DEVICE_DESC DeviceDescription)
{
- HID_PARSER Parser;
-
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// free collection
//
- HidParser_FreeCollectionDescription(&Parser, DeviceDescription);
+ HidParser_FreeCollectionDescription(DeviceDescription);
}
IN PHIDP_PREPARSED_DATA PreparsedData,
OUT PHIDP_CAPS Capabilities)
{
- HID_PARSER Parser;
-
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// get caps
//
- return HidParser_GetCaps(&Parser, PreparsedData, Capabilities);
+ return HidParser_GetCaps(PreparsedData, Capabilities);
}
NTSTATUS
IN POOL_TYPE PoolType,
OUT PHIDP_DEVICE_DESC DeviceDescription)
{
- HID_PARSER Parser;
NTSTATUS Status;
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// get description;
//
- Status = HidParser_GetCollectionDescription(&Parser, ReportDesc, DescLength, PoolType, DeviceDescription);
+ Status = HidParser_GetCollectionDescription(ReportDesc, DescLength, PoolType, DeviceDescription);
return TranslateStatusForUpperLayer(Status);
}
IN USAGE UsagePage OPTIONAL,
IN PHIDP_PREPARSED_DATA PreparsedData)
{
- HID_PARSER Parser;
-
//
// sanity check
//
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
-
//
// get usage length
//
- return HidParser_MaxUsageListLength(&Parser, PreparsedData, ReportType, UsagePage);
+ return HidParser_MaxUsageListLength(PreparsedData, ReportType, UsagePage);
}
HIDAPI
IN OUT PUSHORT ValueCapsLength,
IN PHIDP_PREPARSED_DATA PreparsedData)
{
- HID_PARSER Parser;
-
//
// sanity check
//
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// 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
IN PCHAR Report,
IN ULONG ReportLength)
{
- HID_PARSER Parser;
-
//
// sanity check
//
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// 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);
}
IN PCHAR Report,
IN ULONG ReportLength)
{
- HID_PARSER Parser;
-
//
// sanity check
//
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// 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
IN PCHAR Report,
IN ULONG ReportLength)
{
- HID_PARSER Parser;
-
//
// sanity check
//
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// 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);
}
IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
IN PVOID InsertCodesContext)
{
- HID_PARSER Parser;
-
- //
- // init parser
- //
- HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
-
//
// translate usage pages
//
- return HidParser_TranslateUsageAndPagesToI8042ScanCodes(&Parser, ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
+ return HidParser_TranslateUsageAndPagesToI8042ScanCodes(ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
}
HIDAPI
NTSTATUS
NTAPI
HidParser_GetCollectionDescription(
- IN PHID_PARSER Parser,
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength,
IN POOL_TYPE PoolType,
//
// first parse the report descriptor
//
- ParserStatus = HidParser_ParseReportDescriptor(Parser, ReportDesc, DescLength, &ParserContext);
+ ParserStatus = HidParser_ParseReportDescriptor(ReportDesc, DescLength, &ParserContext);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{
//
// 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;
}
//
// zero description
//
- Parser->Zero(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
+ ZeroFunction(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
//
// 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)
{
//
//
// 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)
{
//
// no memory
//
- Parser->Free(DeviceDescription->CollectionDesc);
+ FreeFunction(DeviceDescription->CollectionDesc);
return STATUS_INSUFFICIENT_RESOURCES;
}
//
// set preparsed data length
//
- DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser, ParserContext, Index);
- ParserStatus = HidParser_BuildContext(Parser, ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
+ DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(ParserContext, Index);
+ ParserStatus = HidParser_BuildContext(ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{
//
// no memory
//
- Parser->Free(DeviceDescription->CollectionDesc);
- Parser->Free(DeviceDescription->ReportIDs);
+ FreeFunction(DeviceDescription->CollectionDesc);
+ FreeFunction(DeviceDescription->ReportIDs);
return ParserStatus;
}
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
{
// collection not found
- Parser->Free(DeviceDescription->CollectionDesc);
- Parser->Free(DeviceDescription->ReportIDs);
+ FreeFunction(DeviceDescription->CollectionDesc);
+ FreeFunction(DeviceDescription->ReportIDs);
return ParserStatus;
}
VOID
NTAPI
HidParser_FreeCollectionDescription(
- IN PHID_PARSER Parser,
IN PHIDP_DEVICE_DESC DeviceDescription)
{
ULONG Index;
//
// free collection context
//
- Parser->Free(DeviceDescription->CollectionDesc[Index].PreparsedData);
+ FreeFunction(DeviceDescription->CollectionDesc[Index].PreparsedData);
}
//
// now free collection description
//
- Parser->Free(DeviceDescription->CollectionDesc);
+ FreeFunction(DeviceDescription->CollectionDesc);
//
// free report description
//
- Parser->Free(DeviceDescription->ReportIDs);
+ FreeFunction(DeviceDescription->ReportIDs);
}
HIDAPI
NTSTATUS
NTAPI
HidParser_GetCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PHIDP_CAPS Capabilities)
{
//
// zero capabilities
//
- Parser->Zero(Capabilities, sizeof(HIDP_CAPS));
+ ZeroFunction(Capabilities, sizeof(HIDP_CAPS));
//
// init capabilities
ULONG
NTAPI
HidParser_MaxUsageListLength(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage OPTIONAL)
NTSTATUS
NTAPI
HidParser_GetButtonCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_BUTTON_CAPS ButtonCaps,
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
NTSTATUS
NTAPI
HidParser_GetSpecificValueCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
//
// 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)
{
//
// 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)
{
//
// 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
{
NTSTATUS
NTAPI
HidParser_GetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
//
// 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)
{
//
// 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)
{
//
// 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
{
NTSTATUS
NTAPI
HidParser_GetScaledUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
//
// 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)
{
//
// 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)
{
//
// 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
{
NTSTATUS
NTAPI
HidParser_TranslateUsageAndPagesToI8042ScanCodes(
- IN PHID_PARSER Parser,
IN PUSAGE_AND_PAGE ChangedUsageList,
IN ULONG UsageListLength,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
//
// 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)
{
//
// 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
{
NTSTATUS
NTAPI
HidParser_GetUsagesEx(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USHORT LinkCollection,
IN PCHAR Report,
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
NTSTATUS
NTAPI
HidParser_GetSpecificButtonCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_GetData(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
OUT PHIDP_DATA DataList,
NTSTATUS
NTAPI
HidParser_GetExtendedAttributes(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USHORT DataIndex,
NTSTATUS
NTAPI
HidParser_GetLinkCollectionNodes(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
IN OUT PULONG LinkCollectionNodesLength)
NTSTATUS
NTAPI
HidParser_GetUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
//
// 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)
{
//
// 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)
{
//
// 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
{
NTSTATUS
NTAPI
HidParser_SysPowerEvent(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN PCHAR HidPacket,
IN USHORT HidPacketLength,
NTSTATUS
NTAPI
HidParser_SysPowerCaps (
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PULONG OutputBuffer)
{
NTSTATUS
NTAPI
HidParser_GetUsageValueArray(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_UnsetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetUsageValueArray(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetScaledUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetData(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_DATA DataList,
ULONG
NTAPI
HidParser_MaxDataListLength(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType)
{
NTSTATUS
NTAPI
HidParser_InitializeReportForID(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN UCHAR ReportID,
NTSTATUS
NTAPI
HidParser_GetValueCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType,
PHIDP_VALUE_CAPS ValueCaps,
#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
//
HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10
}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
NTAPI
HidParser_GetCollectionDescription(
- IN PHID_PARSER Parser,
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength,
IN POOL_TYPE PoolType,
VOID
NTAPI
HidParser_FreeCollectionDescription(
- IN PHID_PARSER Parser,
IN PHIDP_DEVICE_DESC DeviceDescription);
HIDAPI
NTSTATUS
NTAPI
HidParser_GetCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PHIDP_CAPS Capabilities);
NTSTATUS
NTAPI
HidParser_GetSpecificValueCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_GetButtonCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType,
PHIDP_BUTTON_CAPS ButtonCaps,
NTSTATUS
NTAPI
HidParser_GetSpecificButtonCaps(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_GetScaledUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_GetData(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
OUT PHIDP_DATA DataList,
NTSTATUS
NTAPI
HidParser_GetExtendedAttributes(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USHORT DataIndex,
NTSTATUS
NTAPI
HidParser_GetLinkCollectionNodes(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
IN OUT PULONG LinkCollectionNodesLength);
NTSTATUS
NTAPI
HidParser_GetUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
ULONG
NTAPI
HidParser_MaxUsageListLength(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage OPTIONAL);
NTSTATUS
NTAPI
HidParser_GetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_GetUsagesEx(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USHORT LinkCollection,
NTSTATUS
NTAPI
HidParser_SysPowerEvent (
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN PCHAR HidPacket,
IN USHORT HidPacketLength,
NTSTATUS
NTAPI
HidParser_SysPowerCaps (
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
OUT PULONG OutputBuffer);
NTSTATUS
NTAPI
HidParser_GetUsageValueArray(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_UnsetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_TranslateUsageAndPagesToI8042ScanCodes(
- IN PHID_PARSER Parser,
IN PUSAGE_AND_PAGE ChangedUsageList,
IN ULONG UsageListLength,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
NTSTATUS
NTAPI
HidParser_SetUsages(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetUsageValueArray(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetScaledUsageValue(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN USAGE UsagePage,
NTSTATUS
NTAPI
HidParser_SetData(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN PHIDP_DATA DataList,
ULONG
NTAPI
HidParser_MaxDataListLength(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType);
NTSTATUS
NTAPI
HidParser_InitializeReportForID(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN HIDP_REPORT_TYPE ReportType,
IN UCHAR ReportID,
HIDPARSER_STATUS
HidParser_TranslateKbdUsage(
- IN PHID_PARSER Parser,
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
HIDPARSER_STATUS
HidParser_TranslateCustUsage(
- IN PHID_PARSER Parser,
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
NTSTATUS
NTAPI
HidParser_GetValueCaps(
- PHID_PARSER Parser,
IN PVOID CollectionContext,
HIDP_REPORT_TYPE ReportType,
PHIDP_VALUE_CAPS ValueCaps,
VOID
HidParser_DeleteReport(
- IN PHID_PARSER Parser,
IN PHID_REPORT Report)
{
//
VOID
HidParser_FreeCollection(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION Collection)
{
//
HIDPARSER_STATUS
HidParser_AllocateCollection(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION ParentCollection,
IN UCHAR Type,
IN PLOCAL_ITEM_STATE LocalItemState,
//
// first allocate the collection
//
- Collection = (PHID_COLLECTION)Parser->Alloc(sizeof(HID_COLLECTION));
+ Collection = (PHID_COLLECTION)AllocFunction(sizeof(HID_COLLECTION));
if (!Collection)
{
//
//
// no usage set
//
- Parser->Debug("HIDPARSE] No usage set\n");
+ DebugFunction("HIDPARSE] No usage set\n");
UsageValue.u.Extended = 0;
}
HIDPARSER_STATUS
HidParser_AddCollection(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION CurrentCollection,
IN PHID_COLLECTION NewCollection)
{
//
// allocate new collection
//
- NewAllocCollection = (PHID_COLLECTION*)Parser->Alloc(sizeof(PHID_COLLECTION) * CollectionCount);
+ NewAllocCollection = (PHID_COLLECTION*)AllocFunction(sizeof(PHID_COLLECTION) * CollectionCount);
if (!NewAllocCollection)
{
//
//
// 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
//
- Parser->Free(CurrentCollection->Nodes);
+ FreeFunction(CurrentCollection->Nodes);
}
//
HIDPARSER_STATUS
HidParser_FindReport(
- IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext,
IN UCHAR ReportType,
IN UCHAR ReportID,
HIDPARSER_STATUS
HidParser_AllocateReport(
- IN PHID_PARSER Parser,
IN UCHAR ReportType,
IN UCHAR ReportID,
OUT PHID_REPORT *OutReport)
//
// allocate report
//
- Report = (PHID_REPORT)Parser->Alloc(sizeof(HID_REPORT));
+ Report = (PHID_REPORT)AllocFunction(sizeof(HID_REPORT));
if (!Report)
{
//
HIDPARSER_STATUS
HidParser_AddReportToCollection(
- IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION CurrentCollection,
IN PHID_REPORT NewReport)
//
// 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)
{
//
//
// 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
//
- Parser->Free(CurrentCollection->Reports);
+ FreeFunction(CurrentCollection->Reports);
}
//
HIDPARSER_STATUS
HidParser_GetReport(
- IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION Collection,
IN UCHAR ReportType,
//
// 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)
{
//
//
// allocate new report
//
- Status = HidParser_AllocateReport(Parser, ReportType, ReportID, OutReport);
+ Status = HidParser_AllocateReport(ReportType, ReportID, OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS)
{
//
//
// add report
//
- Status = HidParser_AddReportToCollection(Parser, ParserContext, Collection, *OutReport);
+ Status = HidParser_AddReportToCollection(ParserContext, Collection, *OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS)
{
//
// failed to allocate report
//
- Parser->Free(*OutReport);
+ FreeFunction(*OutReport);
}
//
HIDPARSER_STATUS
HidParser_ReserveReportItems(
- IN PHID_PARSER Parser,
IN PHID_REPORT Report,
IN ULONG ReportCount,
OUT PHID_REPORT *OutReport)
//
// allocate memory
//
- NewReport = (PHID_REPORT)Parser->Alloc(Size + OldSize);
+ NewReport = (PHID_REPORT)AllocFunction(Size + OldSize);
if (!NewReport)
{
//
//
// copy old report
//
- Parser->Copy(NewReport, Report, OldSize);
+ CopyFunction(NewReport, Report, OldSize);
//
// increase array size
HIDPARSER_STATUS
HidParser_AddMainItem(
- IN PHID_PARSER Parser,
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_REPORT Report,
IN PGLOBAL_ITEM_STATE GlobalItemState,
//
// 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)
{
//
HIDPARSER_STATUS
HidParser_ParseReportDescriptor(
- IN PHID_PARSER Parser,
IN PUCHAR ReportDescriptor,
IN ULONG ReportLength,
OUT PVOID *OutParser)
//
// allocate parser
//
- ParserContext = Parser->Alloc(sizeof(HID_PARSER_CONTEXT));;
+ ParserContext = AllocFunction(sizeof(HID_PARSER_CONTEXT));
if (!ParserContext)
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
// allocate usage stack
//
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)
{
//
// no memory
//
- Parser->Free(ParserContext);
+ FreeFunction(ParserContext);
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
}
//
// 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)
{
//
// no memory
//
- Parser->Free(ParserContext->LocalItemState.UsageStack);
+ FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL;
- Parser->Free(ParserContext);
+ FreeFunction(ParserContext);
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
}
//
// 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
//
//
// 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);
//
// add new collection to current collection
//
- Status = HidParser_AddCollection(Parser, CurrentCollection, NewCollection);
+ Status = HidParser_AddCollection(CurrentCollection, NewCollection);
ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
//
break;
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);
break;
}
//
// 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);
// fill in a sensible default if the index isn't set
//
// 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);
}
//
// 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
{
switch (CurrentItem->Tag) {
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;
break;
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;
break;
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;
break;
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;
break;
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;
break;
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;
break;
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;
break;
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;
break;
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->UseReportIDs = TRUE;
break;
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;
break;
case ITEM_TAG_GLOBAL_PUSH:
{
- Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n");
+ DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n");
//
// 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);
//
// 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
}
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)
{
//
//
// 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
//
- Parser->Free(LinkedGlobalItemState);
+ FreeFunction(LinkedGlobalItemState);
break;
}
//
// 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);
//
// 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
//
- Parser->Free(ParserContext->LocalItemState.UsageStack);
+ FreeFunction(ParserContext->LocalItemState.UsageStack);
//
// replace with new usage stack
}
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.IsExtended
= CurrentItemSize == sizeof(ULONG);
break;
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.IsExtended
= CurrentItemSize == sizeof(ULONG);
break;
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.DesignatorIndexSet = TRUE;
break;
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;
break;
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;
break;
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.StringIndexSet = TRUE;
break;
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;
break;
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;
break;
default:
- Parser->Debug("Unknown Local Item Tag %x\n", CurrentItem->Tag);
+ DebugFunction("Unknown Local Item Tag %x\n", CurrentItem->Tag);
ASSERT(FALSE);
break;
}
case ITEM_TYPE_LONG:
{
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;
}
}
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)ParserContext->GlobalItemState.Next;
while(LinkedGlobalItemState != NULL)
{
- Parser->Debug("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState);
+ DebugFunction("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState);
//
// free global item state
//
//
// free state
//
- Parser->Free(LinkedGlobalItemState);
+ FreeFunction(LinkedGlobalItemState);
//
// move to next global state
//
// free usage stack
//
- Parser->Free(ParserContext->LocalItemState.UsageStack);
+ FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL;
//
PHID_COLLECTION
HidParser_GetCollection(
- IN PHID_PARSER Parser,
PHID_PARSER_CONTEXT ParserContext,
IN ULONG CollectionNumber)
{
//
// no such collection
//
- Parser->Debug("HIDPARSE] No such collection %lu\n", CollectionNumber);
+ DebugFunction("HIDPARSE] No such collection %lu\n", CollectionNumber);
return NULL;
}
HIDPARSER_STATUS
HidParser_BuildContext(
- IN PHID_PARSER Parser,
IN PVOID ParserContext,
IN ULONG CollectionIndex,
IN ULONG ContextSize,
//
// lets get the collection
//
- Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
+ Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
ASSERT(Collection);
//
// lets allocate the context
//
- Context = Parser->Alloc(ContextSize);
+ Context = AllocFunction(ContextSize);
if (Context == NULL)
{
//
//
// lets build the context
//
- Status = HidParser_BuildCollectionContext(Parser, Collection, Context, ContextSize);
+ Status = HidParser_BuildCollectionContext(Collection, Context, ContextSize);
if (Status == HIDPARSER_STATUS_SUCCESS)
{
//
ULONG
HidParser_GetContextSize(
- IN PHID_PARSER Parser,
IN PVOID ParserContext,
IN ULONG CollectionIndex)
{
//
// lets get the collection
//
- Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
+ Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
//
// calculate size
#include <hidpddi.h>
#include "hidparser.h"
+#include "hidp.h"
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
IN PVOID CollectionContext,
IN UCHAR ReportType);
-UCHAR
-HidParser_IsReportIDUsed(
- IN PHID_PARSER Parser);
-
ULONG
HidParser_GetReportItemCountFromReportType(
IN PVOID CollectionContext,
HIDPARSER_STATUS
HidParser_GetSpecificValueCapsWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USHORT UsagePage,
HIDPARSER_STATUS
HidParser_GetUsagesWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
HIDPARSER_STATUS
HidParser_GetScaledUsageValueWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
HIDPARSER_STATUS
HidParser_GetUsageValueWithReport(
- IN PHID_PARSER Parser,
IN PVOID CollectionContext,
IN UCHAR ReportType,
IN USAGE UsagePage,
HIDPARSER_STATUS
HidParser_BuildContext(
- IN PHID_PARSER Parser,
IN PVOID ParserContext,
IN ULONG CollectionIndex,
IN ULONG ContextSize,
HIDPARSER_STATUS
HidParser_ParseReportDescriptor(
- PHID_PARSER Parser,
PUCHAR Report,
ULONG ReportSize,
OUT PVOID *ParserContext);
ULONG
HidParser_GetContextSize(
- IN PHID_PARSER Parser,
IN PVOID ParserContext,
IN ULONG CollectionNumber);
HIDPARSER_STATUS
HidParser_BuildCollectionContext(
- IN PHID_PARSER Parser,
IN PHID_COLLECTION RootCollection,
IN PVOID Context,
IN ULONG ContextSize);