//
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_AllocateCollection(
IN PHID_COLLECTION ParentCollection,
IN UCHAR Type,
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
//
// done
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_AddCollection(
IN PHID_COLLECTION CurrentCollection,
IN PHID_COLLECTION NewCollection)
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
if (CurrentCollection->NodeCount)
//
// done
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_FindReportInCollection(
IN PHID_COLLECTION Collection,
IN UCHAR ReportType,
OUT PHID_REPORT *OutReport)
{
ULONG Index;
- HIDPARSER_STATUS Status;
+ NTSTATUS Status;
//
// search in local list
// found report
//
*OutReport = Collection->Reports[Index];
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
}
for(Index = 0; Index < Collection->NodeCount; Index++)
{
Status = HidParser_FindReportInCollection(Collection->Nodes[Index], ReportType, ReportID, OutReport);
- if (Status == HIDPARSER_STATUS_SUCCESS)
+ if (Status == HIDP_STATUS_SUCCESS)
return Status;
}
// no such report found
//
*OutReport = NULL;
- return HIDPARSER_STATUS_REPORT_NOT_FOUND;
+ return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_FindReport(
IN PHID_PARSER_CONTEXT ParserContext,
IN UCHAR ReportType,
return HidParser_FindReportInCollection(ParserContext->RootCollection->Nodes[ParserContext->RootCollection->NodeCount-1], ReportType, ReportID, OutReport);
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_AllocateReport(
IN UCHAR ReportType,
IN UCHAR ReportID,
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
// done
//
*OutReport = Report;
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_AddReportToCollection(
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION CurrentCollection,
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
if (CurrentCollection->ReportCount)
//
// completed successfully
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_GetReport(
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION Collection,
IN UCHAR CreateIfNotExists,
OUT PHID_REPORT *OutReport)
{
- HIDPARSER_STATUS Status;
+ NTSTATUS Status;
//
// try finding existing report
//
Status = HidParser_FindReport(ParserContext, ReportType, ReportID, OutReport);
- if (Status == HIDPARSER_STATUS_SUCCESS || CreateIfNotExists == FALSE)
+ if (Status == HIDP_STATUS_SUCCESS || CreateIfNotExists == FALSE)
{
//
// founed report
// allocate new report
//
Status = HidParser_AllocateReport(ReportType, ReportID, OutReport);
- if (Status != HIDPARSER_STATUS_SUCCESS)
+ if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to allocate report
// add report
//
Status = HidParser_AddReportToCollection(ParserContext, Collection, *OutReport);
- if (Status != HIDPARSER_STATUS_SUCCESS)
+ if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to allocate report
return Status;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_ReserveReportItems(
IN PHID_REPORT Report,
IN ULONG ReportCount,
// space is already allocated
//
*OutReport = Report;
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
//
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
// completed sucessfully
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
VOID
*NewMaximum = Maximum;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_InitReportItem(
IN PHID_REPORT Report,
IN PHID_REPORT_ITEM ReportItem,
//
// completed successfully
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
BOOLEAN
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_AddMainItem(
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_REPORT Report,
IN PMAIN_ITEM_DATA ItemData,
IN PHID_COLLECTION Collection)
{
- HIDPARSER_STATUS Status;
+ NTSTATUS Status;
ULONG Index;
PHID_REPORT NewReport;
BOOLEAN Found;
// first grow report item array
//
Status = HidParser_ReserveReportItems(Report, GlobalItemState->ReportCount, &NewReport);
- if (Status != HIDPARSER_STATUS_SUCCESS)
+ if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to allocate memory
for(Index = 0; Index < GlobalItemState->ReportCount; Index++)
{
Status = HidParser_InitReportItem(NewReport, &NewReport->Items[NewReport->ItemCount], GlobalItemState, LocalItemState, ItemData, Index);
- if (Status != HIDPARSER_STATUS_SUCCESS)
+ if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to init report item
//
// done
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_ParseReportDescriptor(
IN PUCHAR ReportDescriptor,
IN ULONG ReportLength,
PGLOBAL_ITEM_STATE LinkedGlobalItemState, NextLinkedGlobalItemState;
ULONG Index;
PUSAGE_VALUE NewUsageStack, UsageValue;
- HIDPARSER_STATUS Status;
+ NTSTATUS Status;
PHID_COLLECTION CurrentCollection, NewCollection;
PUCHAR CurrentOffset, ReportEnd;
PITEM_PREFIX CurrentItem;
ReportEnd = ReportDescriptor + ReportLength;
if (ReportDescriptor >= ReportEnd)
- return HIDPARSER_STATUS_COLLECTION_NOT_FOUND;
+ return HIDP_STATUS_USAGE_NOT_FOUND;
//
// allocate parser
//
ParserContext = AllocFunction(sizeof(HID_PARSER_CONTEXT));
if (!ParserContext)
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
//
// no memory
//
FreeFunction(ParserContext);
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
// now allocate root collection
//
Status = HidParser_AllocateCollection(NULL, COLLECTION_LOGICAL, &ParserContext->LocalItemState, &ParserContext->RootCollection);
- if (Status != HIDPARSER_STATUS_SUCCESS)
+ if (Status != HIDP_STATUS_SUCCESS)
{
//
// no memory
FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL;
FreeFunction(ParserContext);
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
// allocate new collection
//
Status = HidParser_AllocateCollection(CurrentCollection, (UCHAR)Data, &ParserContext->LocalItemState, &NewCollection);
- ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
//
// add new collection to current collection
//
Status = HidParser_AddCollection(CurrentCollection, NewCollection);
- ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
//
// make new collection current
// get report
//
Status = HidParser_GetReport(ParserContext, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
- ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
// fill in a sensible default if the index isn't set
if (!ParserContext->LocalItemState.DesignatorIndexSet) {
// add states & data to the report
//
Status = HidParser_AddMainItem(ParserContext, Report, &ParserContext->GlobalItemState, &ParserContext->LocalItemState, MainItemData, CurrentCollection);
- ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
+ ASSERT(Status == HIDP_STATUS_SUCCESS);
}
//
//
// done
//
- return HIDPARSER_STATUS_SUCCESS;
+ return HIDP_STATUS_SUCCESS;
}
PHID_COLLECTION
return ParserContext->RootCollection->NodeCount;
}
-HIDPARSER_STATUS
+NTSTATUS
HidParser_BuildContext(
IN PVOID ParserContext,
IN ULONG CollectionIndex,
{
PHID_COLLECTION Collection;
PVOID Context;
- HIDPARSER_STATUS Status;
+ NTSTATUS Status;
//
// lets get the collection
//
// no memory
//
- return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
+ return HIDP_STATUS_INTERNAL_ERROR;
}
//
// lets build the context
//
Status = HidParser_BuildCollectionContext(Collection, Context, ContextSize);
- if (Status == HIDPARSER_STATUS_SUCCESS)
+ if (Status == HIDP_STATUS_SUCCESS)
{
//
// store context