[HIDPARSER] Remove HIDPARSER specific error codes, and remplace them by HIDP_* NTSTATUS codes

Remove now useless TranslateHidParserStatus() function.
This commit is contained in:
Hervé Poussineau 2020-04-17 23:54:14 +02:00
parent c151f8a1c7
commit c4055c455f
7 changed files with 117 additions and 212 deletions

View file

@ -61,7 +61,7 @@ static struct
#define NTOHS(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
HIDPARSER_STATUS
NTSTATUS
HidParser_GetCollectionUsagePage(
IN PVOID CollectionContext,
OUT PUSHORT Usage,
@ -78,7 +78,7 @@ HidParser_GetCollectionUsagePage(
//
// collection not found
//
return HIDPARSER_STATUS_COLLECTION_NOT_FOUND;
return HIDP_STATUS_USAGE_NOT_FOUND;
}
//
@ -86,7 +86,7 @@ HidParser_GetCollectionUsagePage(
//
*UsagePage = (Collection->Usage >> 16);
*Usage = (Collection->Usage & 0xFFFF);
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
ULONG
@ -250,7 +250,7 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
return ItemCount;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_GetSpecificValueCapsWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -274,7 +274,7 @@ HidParser_GetSpecificValueCapsWithReport(
//
// no such report
//
return HIDPARSER_STATUS_REPORT_NOT_FOUND;
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
}
for(Index = 0; Index < Report->ItemCount; Index++)
@ -330,16 +330,16 @@ HidParser_GetSpecificValueCapsWithReport(
//
// success
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
//
// item not found
//
return HIDPARSER_STATUS_USAGE_NOT_FOUND;
return HIDP_STATUS_USAGE_NOT_FOUND;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_GetUsagesWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -367,7 +367,7 @@ HidParser_GetUsagesWithReport(
//
// no such report
//
return HIDPARSER_STATUS_REPORT_NOT_FOUND;
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
}
if (Report->ReportSize / 8 != (ReportDescriptorLength - 1))
@ -375,7 +375,7 @@ HidParser_GetUsagesWithReport(
//
// invalid report descriptor length
//
return HIDPARSER_STATUS_INVALID_REPORT_LENGTH;
return HIDP_STATUS_INVALID_REPORT_LENGTH;
}
//
@ -490,7 +490,7 @@ HidParser_GetUsagesWithReport(
//
// list too small
//
return HIDPARSER_STATUS_BUFFER_TOO_SMALL;
return HIDP_STATUS_BUFFER_TOO_SMALL;
}
if (UsagePage == HID_USAGE_PAGE_UNDEFINED)
@ -517,7 +517,7 @@ HidParser_GetUsagesWithReport(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
ULONG
@ -546,7 +546,7 @@ HidParser_UsesReportId(
}
HIDPARSER_STATUS
NTSTATUS
HidParser_GetUsageValueWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -571,7 +571,7 @@ HidParser_GetUsageValueWithReport(
//
// no such report
//
return HIDPARSER_STATUS_REPORT_NOT_FOUND;
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
}
if (Report->ReportSize / 8 != (ReportDescriptorLength - 1))
@ -579,7 +579,7 @@ HidParser_GetUsageValueWithReport(
//
// invalid report descriptor length
//
return HIDPARSER_STATUS_INVALID_REPORT_LENGTH;
return HIDP_STATUS_INVALID_REPORT_LENGTH;
}
for (Index = 0; Index < Report->ItemCount; Index++)
@ -631,18 +631,18 @@ HidParser_GetUsageValueWithReport(
// store result
//
*UsageValue = Data;
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
//
// usage not found
//
return HIDPARSER_STATUS_USAGE_NOT_FOUND;
return HIDP_STATUS_USAGE_NOT_FOUND;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_GetScaledUsageValueWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -667,7 +667,7 @@ HidParser_GetScaledUsageValueWithReport(
//
// no such report
//
return HIDPARSER_STATUS_REPORT_NOT_FOUND;
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
}
if (Report->ReportSize / 8 != (ReportDescriptorLength - 1))
@ -675,7 +675,7 @@ HidParser_GetScaledUsageValueWithReport(
//
// invalid report descriptor length
//
return HIDPARSER_STATUS_INVALID_REPORT_LENGTH;
return HIDP_STATUS_INVALID_REPORT_LENGTH;
}
for (Index = 0; Index < Report->ItemCount; Index++)
@ -738,20 +738,20 @@ HidParser_GetScaledUsageValueWithReport(
else
{
// logical boundaries are absolute values
return HIDPARSER_STATUS_BAD_LOG_PHY_VALUES;
return HIDP_STATUS_BAD_LOG_PHY_VALUES;
}
//
// store result
//
*UsageValue = Data;
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
//
// usage not found
//
return HIDPARSER_STATUS_USAGE_NOT_FOUND;
return HIDP_STATUS_USAGE_NOT_FOUND;
}
ULONG
@ -847,7 +847,7 @@ HidParser_DispatchKey(
}
}
HIDPARSER_STATUS
NTSTATUS
HidParser_TranslateKbdUsage(
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
@ -869,7 +869,7 @@ HidParser_TranslateKbdUsage(
// invalid lookup or no scan code available
//
DPRINT1("No Scan code for Usage %x\n", Usage);
return HIDPARSER_STATUS_I8042_TRANS_UNKNOWN;
return HIDP_STATUS_I8042_TRANS_UNKNOWN;
}
if (ScanCode & 0xFF00)
@ -906,10 +906,10 @@ HidParser_TranslateKbdUsage(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_TranslateCustUsage(
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
@ -929,7 +929,7 @@ HidParser_TranslateCustUsage(
// invalid lookup or no scan code available
//
DPRINT1("No Scan code for Usage %x\n", Usage);
return HIDPARSER_STATUS_I8042_TRANS_UNKNOWN;
return HIDP_STATUS_I8042_TRANS_UNKNOWN;
}
if (ScanCode & 0xFF00)
@ -948,5 +948,5 @@ HidParser_TranslateCustUsage(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}

View file

@ -181,7 +181,7 @@ HidParser_StoreCollection(
return CurrentOffset - InitialOffset;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_BuildCollectionContext(
IN PHID_COLLECTION RootCollection,
IN PVOID Context,
@ -213,7 +213,7 @@ HidParser_BuildCollectionContext(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
PHID_REPORT

View file

@ -35,7 +35,7 @@ HidP_GetCaps(
NTSTATUS
TranslateStatusForUpperLayer(
IN HIDPARSER_STATUS Status)
IN NTSTATUS Status)
{
//
// now we are handling only this values, for others just return
@ -43,13 +43,13 @@ TranslateStatusForUpperLayer(
//
switch (Status)
{
case HIDPARSER_STATUS_INSUFFICIENT_RESOURCES:
case HIDP_STATUS_INTERNAL_ERROR:
return STATUS_INSUFFICIENT_RESOURCES;
case HIDPARSER_STATUS_INVALID_REPORT_TYPE:
case HIDP_STATUS_INVALID_REPORT_TYPE:
return HIDP_STATUS_INVALID_REPORT_TYPE;
case HIDPARSER_STATUS_BUFFER_TOO_SMALL:
case HIDP_STATUS_BUFFER_TOO_SMALL:
return STATUS_BUFFER_TOO_SMALL;
case HIDPARSER_STATUS_COLLECTION_NOT_FOUND:
case HIDP_STATUS_USAGE_NOT_FOUND:
return STATUS_NO_DATA_DETECTED;
default:
return Status;

View file

@ -13,37 +13,6 @@
#define NDEBUG
#include <debug.h>
NTSTATUS
TranslateHidParserStatus(
IN HIDPARSER_STATUS Status)
{
switch(Status)
{
case HIDPARSER_STATUS_INSUFFICIENT_RESOURCES:
return HIDP_STATUS_INTERNAL_ERROR;
case HIDPARSER_STATUS_NOT_IMPLEMENTED:
return HIDP_STATUS_NOT_IMPLEMENTED;
case HIDPARSER_STATUS_REPORT_NOT_FOUND:
return HIDP_STATUS_REPORT_DOES_NOT_EXIST;
case HIDPARSER_STATUS_INVALID_REPORT_LENGTH:
return HIDP_STATUS_INVALID_REPORT_LENGTH;
case HIDPARSER_STATUS_INVALID_REPORT_TYPE:
return HIDP_STATUS_INVALID_REPORT_TYPE;
case HIDPARSER_STATUS_BUFFER_TOO_SMALL:
return HIDP_STATUS_BUFFER_TOO_SMALL;
case HIDPARSER_STATUS_USAGE_NOT_FOUND:
return HIDP_STATUS_USAGE_NOT_FOUND;
case HIDPARSER_STATUS_I8042_TRANS_UNKNOWN:
return HIDP_STATUS_I8042_TRANS_UNKNOWN;
case HIDPARSER_STATUS_COLLECTION_NOT_FOUND:
return HIDP_STATUS_NOT_IMPLEMENTED; //FIXME
case HIDPARSER_STATUS_BAD_LOG_PHY_VALUES:
return HIDP_STATUS_BAD_LOG_PHY_VALUES;
}
DPRINT1("TranslateHidParserStatus Status %ld not implemented\n", Status);
return HIDP_STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HidParser_GetCollectionDescription(
@ -52,7 +21,7 @@ HidParser_GetCollectionDescription(
IN POOL_TYPE PoolType,
OUT PHIDP_DEVICE_DESC DeviceDescription)
{
HIDPARSER_STATUS ParserStatus;
NTSTATUS ParserStatus;
ULONG CollectionCount;
ULONG Index;
PVOID ParserContext;
@ -61,7 +30,7 @@ HidParser_GetCollectionDescription(
// first parse the report descriptor
//
ParserStatus = HidParser_ParseReportDescriptor(ReportDesc, DescLength, &ParserContext);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
if (ParserStatus != HIDP_STATUS_SUCCESS)
{
//
// failed to parse report descriptor
@ -120,7 +89,7 @@ HidParser_GetCollectionDescription(
//
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)
if (ParserStatus != HIDP_STATUS_SUCCESS)
{
//
// no memory
@ -154,7 +123,7 @@ HidParser_GetCollectionDescription(
// get collection usage page
//
ParserStatus = HidParser_GetCollectionUsagePage((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, &DeviceDescription->CollectionDesc[Index].Usage, &DeviceDescription->CollectionDesc[Index].UsagePage);
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
if (ParserStatus != HIDP_STATUS_SUCCESS)
{
// collection not found
FreeFunction(DeviceDescription->CollectionDesc);
@ -358,7 +327,7 @@ HidParser_GetSpecificValueCaps(
OUT PHIDP_VALUE_CAPS ValueCaps,
IN OUT PUSHORT ValueCapsLength)
{
HIDPARSER_STATUS ParserStatus;
NTSTATUS ParserStatus;
//
// FIXME: implement searching in specific collection
@ -394,19 +363,10 @@ HidParser_GetSpecificValueCaps(
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
{
//
// success
//
return HIDP_STATUS_SUCCESS;
}
//
// translate error
// return status
//
return TranslateHidParserStatus(ParserStatus);
return ParserStatus;
}
HIDAPI
@ -551,7 +511,7 @@ HidParser_GetUsages(
IN PCHAR Report,
IN ULONG ReportLength)
{
HIDPARSER_STATUS ParserStatus;
NTSTATUS ParserStatus;
//
// FIXME: implement searching in specific collection
@ -587,18 +547,10 @@ HidParser_GetUsages(
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
{
//
// success
//
return HIDP_STATUS_SUCCESS;
}
//
// translate error
// return status
//
return TranslateHidParserStatus(ParserStatus);
return ParserStatus;
}
HIDAPI
@ -614,7 +566,7 @@ HidParser_GetScaledUsageValue(
IN PCHAR Report,
IN ULONG ReportLength)
{
HIDPARSER_STATUS ParserStatus;
NTSTATUS ParserStatus;
//
// FIXME: implement searching in specific collection
@ -650,18 +602,10 @@ HidParser_GetScaledUsageValue(
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
{
//
// success
//
return HIDP_STATUS_SUCCESS;
}
//
// translate error
// return status
//
return TranslateHidParserStatus(ParserStatus);
return ParserStatus;
}
HIDAPI
@ -676,7 +620,7 @@ HidParser_TranslateUsageAndPagesToI8042ScanCodes(
IN PVOID InsertCodesContext)
{
ULONG Index;
HIDPARSER_STATUS Status = HIDPARSER_STATUS_SUCCESS;
NTSTATUS Status = HIDP_STATUS_SUCCESS;
for(Index = 0; Index < UsageListLength; Index++)
{
@ -708,27 +652,19 @@ HidParser_TranslateUsageAndPagesToI8042ScanCodes(
//
// check status
//
if (Status != HIDPARSER_STATUS_SUCCESS)
if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed
//
return TranslateHidParserStatus(Status);
return Status;
}
}
if (Status != HIDPARSER_STATUS_SUCCESS)
{
//
// failed
//
return TranslateHidParserStatus(Status);
}
//
// done
// return status
//
return HIDP_STATUS_SUCCESS;
return Status;
}
@ -951,7 +887,7 @@ HidParser_GetUsageValue(
IN PCHAR Report,
IN ULONG ReportLength)
{
HIDPARSER_STATUS ParserStatus;
NTSTATUS ParserStatus;
//
// FIXME: implement searching in specific collection
@ -987,18 +923,10 @@ HidParser_GetUsageValue(
return HIDP_STATUS_INVALID_REPORT_TYPE;
}
if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
{
//
// success
//
return HIDP_STATUS_SUCCESS;
}
//
// translate error
// return status
//
return TranslateHidParserStatus(ParserStatus);
return ParserStatus;
}
NTSTATUS

View file

@ -10,29 +10,6 @@
#pragma once
//
// status code
//
typedef long HIDPARSER_STATUS;
//
// result codes
//
typedef enum
{
HIDPARSER_STATUS_SUCCESS = 0,
HIDPARSER_STATUS_INSUFFICIENT_RESOURCES = -1,
HIDPARSER_STATUS_NOT_IMPLEMENTED = -2,
HIDPARSER_STATUS_REPORT_NOT_FOUND = -3,
HIDPARSER_STATUS_COLLECTION_NOT_FOUND = -4,
HIDPARSER_STATUS_INVALID_REPORT_LENGTH = -5,
HIDPARSER_STATUS_INVALID_REPORT_TYPE = -6,
HIDPARSER_STATUS_BUFFER_TOO_SMALL = -7,
HIDPARSER_STATUS_USAGE_NOT_FOUND = -8,
HIDPARSER_STATUS_I8042_TRANS_UNKNOWN = -9,
HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10
}HIDPARSER_STATUS_CODES;
NTSTATUS
NTAPI
HidParser_GetCollectionDescription(
@ -344,7 +321,7 @@ HidParser_InitializeReportForID(
IN OUT PCHAR Report,
IN ULONG ReportLength);
HIDPARSER_STATUS
NTSTATUS
HidParser_TranslateKbdUsage(
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,
@ -352,7 +329,7 @@ HidParser_TranslateKbdUsage(
IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
IN PVOID InsertCodesContext);
HIDPARSER_STATUS
NTSTATUS
HidParser_TranslateCustUsage(
IN USAGE Usage,
IN HIDP_KEYBOARD_DIRECTION KeyAction,

View file

@ -33,7 +33,7 @@ HidParser_FreeCollection(
//
}
HIDPARSER_STATUS
NTSTATUS
HidParser_AllocateCollection(
IN PHID_COLLECTION ParentCollection,
IN UCHAR Type,
@ -52,7 +52,7 @@ HidParser_AllocateCollection(
//
// no memory
//
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
//
@ -119,10 +119,10 @@ HidParser_AllocateCollection(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_AddCollection(
IN PHID_COLLECTION CurrentCollection,
IN PHID_COLLECTION NewCollection)
@ -144,7 +144,7 @@ HidParser_AddCollection(
//
// no memory
//
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
if (CurrentCollection->NodeCount)
@ -175,10 +175,10 @@ HidParser_AddCollection(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_FindReportInCollection(
IN PHID_COLLECTION Collection,
IN UCHAR ReportType,
@ -186,7 +186,7 @@ HidParser_FindReportInCollection(
OUT PHID_REPORT *OutReport)
{
ULONG Index;
HIDPARSER_STATUS Status;
NTSTATUS Status;
//
// search in local list
@ -199,7 +199,7 @@ HidParser_FindReportInCollection(
// found report
//
*OutReport = Collection->Reports[Index];
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
}
@ -209,7 +209,7 @@ HidParser_FindReportInCollection(
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;
}
@ -217,11 +217,11 @@ HidParser_FindReportInCollection(
// 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,
@ -234,7 +234,7 @@ HidParser_FindReport(
return HidParser_FindReportInCollection(ParserContext->RootCollection->Nodes[ParserContext->RootCollection->NodeCount-1], ReportType, ReportID, OutReport);
}
HIDPARSER_STATUS
NTSTATUS
HidParser_AllocateReport(
IN UCHAR ReportType,
IN UCHAR ReportID,
@ -251,7 +251,7 @@ HidParser_AllocateReport(
//
// no memory
//
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
//
@ -264,10 +264,10 @@ HidParser_AllocateReport(
// 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,
@ -284,7 +284,7 @@ HidParser_AddReportToCollection(
//
// no memory
//
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
if (CurrentCollection->ReportCount)
@ -310,10 +310,10 @@ HidParser_AddReportToCollection(
//
// completed successfully
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_GetReport(
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_COLLECTION Collection,
@ -322,13 +322,13 @@ HidParser_GetReport(
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
@ -340,7 +340,7 @@ HidParser_GetReport(
// allocate new report
//
Status = HidParser_AllocateReport(ReportType, ReportID, OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS)
if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to allocate report
@ -352,7 +352,7 @@ HidParser_GetReport(
// add report
//
Status = HidParser_AddReportToCollection(ParserContext, Collection, *OutReport);
if (Status != HIDPARSER_STATUS_SUCCESS)
if (Status != HIDP_STATUS_SUCCESS)
{
//
// failed to allocate report
@ -366,7 +366,7 @@ HidParser_GetReport(
return Status;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_ReserveReportItems(
IN PHID_REPORT Report,
IN ULONG ReportCount,
@ -381,7 +381,7 @@ HidParser_ReserveReportItems(
// space is already allocated
//
*OutReport = Report;
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
//
@ -399,7 +399,7 @@ HidParser_ReserveReportItems(
//
// no memory
//
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
@ -421,7 +421,7 @@ HidParser_ReserveReportItems(
//
// completed sucessfully
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
VOID
@ -452,7 +452,7 @@ HidParser_SignRange(
*NewMaximum = Maximum;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_InitReportItem(
IN PHID_REPORT Report,
IN PHID_REPORT_ITEM ReportItem,
@ -575,7 +575,7 @@ HidParser_InitReportItem(
//
// completed successfully
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
BOOLEAN
@ -640,7 +640,7 @@ HidParser_UpdateCollectionReport(
}
HIDPARSER_STATUS
NTSTATUS
HidParser_AddMainItem(
IN PHID_PARSER_CONTEXT ParserContext,
IN PHID_REPORT Report,
@ -649,7 +649,7 @@ HidParser_AddMainItem(
IN PMAIN_ITEM_DATA ItemData,
IN PHID_COLLECTION Collection)
{
HIDPARSER_STATUS Status;
NTSTATUS Status;
ULONG Index;
PHID_REPORT NewReport;
BOOLEAN Found;
@ -658,7 +658,7 @@ HidParser_AddMainItem(
// 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
@ -683,7 +683,7 @@ HidParser_AddMainItem(
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
@ -700,10 +700,10 @@ HidParser_AddMainItem(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_ParseReportDescriptor(
IN PUCHAR ReportDescriptor,
IN ULONG ReportLength,
@ -712,7 +712,7 @@ HidParser_ParseReportDescriptor(
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;
@ -729,14 +729,14 @@ HidParser_ParseReportDescriptor(
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;
//
@ -750,14 +750,14 @@ HidParser_ParseReportDescriptor(
// 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
@ -765,7 +765,7 @@ HidParser_ParseReportDescriptor(
FreeFunction(ParserContext->LocalItemState.UsageStack);
ParserContext->LocalItemState.UsageStack = NULL;
FreeFunction(ParserContext);
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
return HIDP_STATUS_INTERNAL_ERROR;
}
//
@ -870,13 +870,13 @@ HidParser_ParseReportDescriptor(
// 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
@ -926,7 +926,7 @@ HidParser_ParseReportDescriptor(
// 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) {
@ -946,7 +946,7 @@ HidParser_ParseReportDescriptor(
// 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);
}
//
@ -1241,7 +1241,7 @@ HidParser_ParseReportDescriptor(
//
// done
//
return HIDPARSER_STATUS_SUCCESS;
return HIDP_STATUS_SUCCESS;
}
PHID_COLLECTION
@ -1299,7 +1299,7 @@ HidParser_NumberOfTopCollections(
return ParserContext->RootCollection->NodeCount;
}
HIDPARSER_STATUS
NTSTATUS
HidParser_BuildContext(
IN PVOID ParserContext,
IN ULONG CollectionIndex,
@ -1308,7 +1308,7 @@ HidParser_BuildContext(
{
PHID_COLLECTION Collection;
PVOID Context;
HIDPARSER_STATUS Status;
NTSTATUS Status;
//
// lets get the collection
@ -1325,14 +1325,14 @@ HidParser_BuildContext(
//
// 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

View file

@ -266,7 +266,7 @@ HidParser_UsesReportId(
IN PVOID CollectionContext,
IN UCHAR ReportType);
HIDPARSER_STATUS
NTSTATUS
HidParser_GetCollectionUsagePage(
IN PVOID CollectionContext,
OUT PUSHORT Usage,
@ -294,7 +294,7 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
IN UCHAR ReportType,
IN USAGE UsagePage OPTIONAL);
HIDPARSER_STATUS
NTSTATUS
HidParser_GetSpecificValueCapsWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -304,7 +304,7 @@ HidParser_GetSpecificValueCapsWithReport(
IN OUT PUSHORT ValueCapsLength);
HIDPARSER_STATUS
NTSTATUS
HidParser_GetUsagesWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -314,7 +314,7 @@ HidParser_GetUsagesWithReport(
IN PCHAR ReportDescriptor,
IN ULONG ReportDescriptorLength);
HIDPARSER_STATUS
NTSTATUS
HidParser_GetScaledUsageValueWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -324,7 +324,7 @@ HidParser_GetScaledUsageValueWithReport(
IN PCHAR ReportDescriptor,
IN ULONG ReportDescriptorLength);
HIDPARSER_STATUS
NTSTATUS
HidParser_GetUsageValueWithReport(
IN PVOID CollectionContext,
IN UCHAR ReportType,
@ -336,7 +336,7 @@ HidParser_GetUsageValueWithReport(
/* parser.c */
HIDPARSER_STATUS
NTSTATUS
HidParser_BuildContext(
IN PVOID ParserContext,
IN ULONG CollectionIndex,
@ -347,7 +347,7 @@ ULONG
HidParser_CalculateContextSize(
IN PHID_COLLECTION Collection);
HIDPARSER_STATUS
NTSTATUS
HidParser_ParseReportDescriptor(
PUCHAR Report,
ULONG ReportSize,
@ -373,7 +373,7 @@ ULONG
HidParser_GetTotalCollectionCount(
IN PVOID CollectionContext);
HIDPARSER_STATUS
NTSTATUS
HidParser_BuildCollectionContext(
IN PHID_COLLECTION RootCollection,
IN PVOID Context,