mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[HIDCLASS]
- Fix some whitespace svn path=/trunk/; revision=59003
This commit is contained in:
parent
e0936866ae
commit
df2001250f
4 changed files with 131 additions and 115 deletions
|
@ -7,6 +7,7 @@
|
||||||
* Michael Martin (michael.martin@reactos.org)
|
* Michael Martin (michael.martin@reactos.org)
|
||||||
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -221,7 +222,7 @@ HidClassFDO_GetDescriptors(
|
||||||
ASSERT(FDODeviceExtension->Common.IsFDO);
|
ASSERT(FDODeviceExtension->Common.IsFDO);
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets allocate irp
|
// let's allocate irp
|
||||||
//
|
//
|
||||||
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
|
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
|
||||||
if (!Irp)
|
if (!Irp)
|
||||||
|
@ -262,7 +263,7 @@ HidClassFDO_GetDescriptors(
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets get device attributes
|
// let's get device attributes
|
||||||
//
|
//
|
||||||
IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_DEVICE_ATTRIBUTES;
|
IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_DEVICE_ATTRIBUTES;
|
||||||
IoStack->Parameters.DeviceIoControl.OutputBufferLength = sizeof(HID_DEVICE_ATTRIBUTES);
|
IoStack->Parameters.DeviceIoControl.OutputBufferLength = sizeof(HID_DEVICE_ATTRIBUTES);
|
||||||
|
@ -290,7 +291,6 @@ HidClassFDO_GetDescriptors(
|
||||||
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength > 0);
|
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].wReportLength > 0);
|
||||||
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].bReportType == HID_REPORT_DESCRIPTOR_TYPE);
|
ASSERT(FDODeviceExtension->HidDescriptor.DescriptorList[0].bReportType == HID_REPORT_DESCRIPTOR_TYPE);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// now allocate space for the report descriptor
|
// now allocate space for the report descriptor
|
||||||
//
|
//
|
||||||
|
@ -359,7 +359,7 @@ HidClassFDO_StartDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets start the lower device too
|
// let's start the lower device too
|
||||||
//
|
//
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp);
|
Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp);
|
||||||
|
@ -372,7 +372,7 @@ HidClassFDO_StartDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets get the descriptors
|
// let's get the descriptors
|
||||||
//
|
//
|
||||||
Status = HidClassFDO_GetDescriptors(DeviceObject);
|
Status = HidClassFDO_GetDescriptors(DeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -457,7 +457,7 @@ HidClassFDO_CopyDeviceRelations(
|
||||||
//
|
//
|
||||||
// copy device objects
|
// copy device objects
|
||||||
//
|
//
|
||||||
for(Index = 0; Index < FDODeviceExtension->DeviceRelations->Count; Index++)
|
for (Index = 0; Index < FDODeviceExtension->DeviceRelations->Count; Index++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// reference pdo
|
// reference pdo
|
||||||
|
@ -573,7 +573,7 @@ HidClassFDO_PnP(
|
||||||
// get current irp stack location
|
// get current irp stack location
|
||||||
//
|
//
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
switch(IoStack->MinorFunction)
|
switch (IoStack->MinorFunction)
|
||||||
{
|
{
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
{
|
{
|
||||||
|
@ -596,7 +596,7 @@ HidClassFDO_PnP(
|
||||||
// set status to success and fall through
|
// set status to success and fall through
|
||||||
//
|
//
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,7 +41,6 @@ HidClassAddDevice(
|
||||||
ULONG DeviceExtensionSize;
|
ULONG DeviceExtensionSize;
|
||||||
PHIDCLASS_DRIVER_EXTENSION DriverExtension;
|
PHIDCLASS_DRIVER_EXTENSION DriverExtension;
|
||||||
|
|
||||||
|
|
||||||
/* increment device number */
|
/* increment device number */
|
||||||
InterlockedIncrement((PLONG)&HidClassDeviceNumber);
|
InterlockedIncrement((PLONG)&HidClassDeviceNumber);
|
||||||
|
|
||||||
|
@ -313,7 +312,7 @@ HidClass_Close(
|
||||||
//
|
//
|
||||||
// now free all irps
|
// now free all irps
|
||||||
//
|
//
|
||||||
while(!IsListEmpty(&IrpContext->IrpCompletedListHead))
|
while (!IsListEmpty(&IrpContext->IrpCompletedListHead))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// remove head irp
|
// remove head irp
|
||||||
|
@ -336,9 +335,6 @@ HidClass_Close(
|
||||||
//
|
//
|
||||||
KeReleaseSpinLock(&IrpContext->Lock, OldLevel);
|
KeReleaseSpinLock(&IrpContext->Lock, OldLevel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// remove context
|
// remove context
|
||||||
//
|
//
|
||||||
|
@ -429,13 +425,15 @@ HidClass_ReadCompleteIrp(
|
||||||
//
|
//
|
||||||
// get collection description
|
// get collection description
|
||||||
//
|
//
|
||||||
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
|
||||||
|
IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
||||||
ASSERT(CollectionDescription);
|
ASSERT(CollectionDescription);
|
||||||
|
|
||||||
//
|
//
|
||||||
// get report description
|
// get report description
|
||||||
//
|
//
|
||||||
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
|
||||||
|
IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
||||||
ASSERT(ReportDescription);
|
ASSERT(ReportDescription);
|
||||||
|
|
||||||
if (CollectionDescription && ReportDescription)
|
if (CollectionDescription && ReportDescription)
|
||||||
|
@ -638,13 +636,15 @@ HidClass_BuildIrp(
|
||||||
//
|
//
|
||||||
// get collection description
|
// get collection description
|
||||||
//
|
//
|
||||||
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
CollectionDescription = HidClassPDO_GetCollectionDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
|
||||||
|
IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
||||||
ASSERT(CollectionDescription);
|
ASSERT(CollectionDescription);
|
||||||
|
|
||||||
//
|
//
|
||||||
// get report description
|
// get report description
|
||||||
//
|
//
|
||||||
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription, IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
ReportDescription = HidClassPDO_GetReportDescription(&IrpContext->FileOp->DeviceExtension->Common.DeviceDescription,
|
||||||
|
IrpContext->FileOp->DeviceExtension->CollectionNumber);
|
||||||
ASSERT(ReportDescription);
|
ASSERT(ReportDescription);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -664,7 +664,6 @@ HidClass_BuildIrp(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// store report length
|
// store report length
|
||||||
//
|
//
|
||||||
|
@ -712,7 +711,6 @@ HidClass_BuildIrp(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HidClass_Read(
|
HidClass_Read(
|
||||||
|
@ -757,21 +755,25 @@ HidClass_Read(
|
||||||
|
|
||||||
if (Context->StopInProgress)
|
if (Context->StopInProgress)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// stop in progress
|
// stop in progress
|
||||||
//
|
//
|
||||||
DPRINT1("[HIDCLASS] Stop In Progress\n");
|
DPRINT1("[HIDCLASS] Stop In Progress\n");
|
||||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_CANCELLED;
|
return STATUS_CANCELLED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// build irp request
|
// build irp request
|
||||||
//
|
//
|
||||||
Status = HidClass_BuildIrp(DeviceObject, Irp, Context, IOCTL_HID_READ_REPORT, IoStack->Parameters.Read.Length, &NewIrp, &NewIrpContext);
|
Status = HidClass_BuildIrp(DeviceObject,
|
||||||
|
Irp,
|
||||||
|
Context,
|
||||||
|
IOCTL_HID_READ_REPORT,
|
||||||
|
IoStack->Parameters.Read.Length,
|
||||||
|
&NewIrp,
|
||||||
|
&NewIrpContext);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -814,7 +816,7 @@ HidClass_Read(
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets dispatch the request
|
// let's dispatch the request
|
||||||
//
|
//
|
||||||
ASSERT(Context->DeviceExtension);
|
ASSERT(Context->DeviceExtension);
|
||||||
Status = Context->DeviceExtension->Common.DriverExtension->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL](Context->DeviceExtension->FDODeviceObject, NewIrp);
|
Status = Context->DeviceExtension->Common.DriverExtension->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL](Context->DeviceExtension->FDODeviceObject, NewIrp);
|
||||||
|
@ -881,7 +883,7 @@ HidClass_DeviceControl(
|
||||||
//
|
//
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
switch(IoStack->Parameters.DeviceIoControl.IoControlCode)
|
switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
|
||||||
{
|
{
|
||||||
case IOCTL_HID_GET_COLLECTION_INFORMATION:
|
case IOCTL_HID_GET_COLLECTION_INFORMATION:
|
||||||
{
|
{
|
||||||
|
@ -907,7 +909,8 @@ HidClass_DeviceControl(
|
||||||
//
|
//
|
||||||
// get collection description
|
// get collection description
|
||||||
//
|
//
|
||||||
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription, PDODeviceExtension->CollectionNumber);
|
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
|
||||||
|
PDODeviceExtension->CollectionNumber);
|
||||||
ASSERT(CollectionDescription);
|
ASSERT(CollectionDescription);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -932,7 +935,8 @@ HidClass_DeviceControl(
|
||||||
//
|
//
|
||||||
// get collection description
|
// get collection description
|
||||||
//
|
//
|
||||||
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription, PDODeviceExtension->CollectionNumber);
|
CollectionDescription = HidClassPDO_GetCollectionDescription(&CommonDeviceExtension->DeviceDescription,
|
||||||
|
PDODeviceExtension->CollectionNumber);
|
||||||
ASSERT(CollectionDescription);
|
ASSERT(CollectionDescription);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -985,7 +989,6 @@ HidClass_InternalDeviceControl(
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HidClass_Power(
|
HidClass_Power(
|
||||||
|
@ -1075,7 +1078,7 @@ HidClassDispatch(
|
||||||
//
|
//
|
||||||
// dispatch request based on major function
|
// dispatch request based on major function
|
||||||
//
|
//
|
||||||
switch(IoStack->MajorFunction)
|
switch (IoStack->MajorFunction)
|
||||||
{
|
{
|
||||||
case IRP_MJ_CREATE:
|
case IRP_MJ_CREATE:
|
||||||
return HidClass_Create(DeviceObject, Irp);
|
return HidClass_Create(DeviceObject, Irp);
|
||||||
|
@ -1134,7 +1137,9 @@ HidRegisterMinidriver(
|
||||||
DriverExtension->DriverUnload = MinidriverRegistration->DriverObject->DriverUnload;
|
DriverExtension->DriverUnload = MinidriverRegistration->DriverObject->DriverUnload;
|
||||||
|
|
||||||
/* copy driver dispatch routines */
|
/* copy driver dispatch routines */
|
||||||
RtlCopyMemory(DriverExtension->MajorFunction, MinidriverRegistration->DriverObject->MajorFunction, sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1));
|
RtlCopyMemory(DriverExtension->MajorFunction,
|
||||||
|
MinidriverRegistration->DriverObject->MajorFunction,
|
||||||
|
sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1));
|
||||||
|
|
||||||
/* initialize lock */
|
/* initialize lock */
|
||||||
KeInitializeSpinLock(&DriverExtension->Lock);
|
KeInitializeSpinLock(&DriverExtension->Lock);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* Michael Martin (michael.martin@reactos.org)
|
* Michael Martin (michael.martin@reactos.org)
|
||||||
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
PHIDP_COLLECTION_DESC
|
PHIDP_COLLECTION_DESC
|
||||||
|
@ -42,7 +43,7 @@ HidClassPDO_GetReportDescription(
|
||||||
{
|
{
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
for(Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
|
for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
|
||||||
{
|
{
|
||||||
if (DeviceDescription->ReportIDs[Index].CollectionNumber == CollectionNumber)
|
if (DeviceDescription->ReportIDs[Index].CollectionNumber == CollectionNumber)
|
||||||
{
|
{
|
||||||
|
@ -151,8 +152,8 @@ HidClassPDO_HandleQueryHardwareId(
|
||||||
//
|
//
|
||||||
// get device extension
|
// get device extension
|
||||||
//
|
//
|
||||||
PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
|
ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// copy current stack location
|
// copy current stack location
|
||||||
|
@ -196,7 +197,7 @@ HidClassPDO_HandleQueryHardwareId(
|
||||||
|
|
||||||
if (CollectionDescription->UsagePage == HID_USAGE_PAGE_GENERIC)
|
if (CollectionDescription->UsagePage == HID_USAGE_PAGE_GENERIC)
|
||||||
{
|
{
|
||||||
switch(CollectionDescription->Usage)
|
switch (CollectionDescription->Usage)
|
||||||
{
|
{
|
||||||
case HID_USAGE_GENERIC_POINTER:
|
case HID_USAGE_GENERIC_POINTER:
|
||||||
case HID_USAGE_GENERIC_MOUSE:
|
case HID_USAGE_GENERIC_MOUSE:
|
||||||
|
@ -253,7 +254,7 @@ HidClassPDO_HandleQueryHardwareId(
|
||||||
//
|
//
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
//
|
//
|
||||||
Ptr = (LPWSTR)ExAllocatePool(NonPagedPool, (Offset +1)* sizeof(WCHAR));
|
Ptr = (LPWSTR)ExAllocatePool(NonPagedPool, (Offset + 1) * sizeof(WCHAR));
|
||||||
if (!Ptr)
|
if (!Ptr)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -287,9 +288,8 @@ HidClassPDO_HandleQueryInstanceId(
|
||||||
//
|
//
|
||||||
// get device extension
|
// get device extension
|
||||||
//
|
//
|
||||||
PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
PDODeviceExtension = (PHIDCLASS_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
|
ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
|
@ -370,47 +370,47 @@ HidClassPDO_PnP(
|
||||||
//
|
//
|
||||||
// handle request
|
// handle request
|
||||||
//
|
//
|
||||||
switch(IoStack->MinorFunction)
|
switch (IoStack->MinorFunction)
|
||||||
{
|
{
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
{
|
{
|
||||||
if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
|
if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// handle query device id
|
// handle query device id
|
||||||
//
|
//
|
||||||
Status = HidClassPDO_HandleQueryDeviceId(DeviceObject, Irp);
|
Status = HidClassPDO_HandleQueryDeviceId(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
|
else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// handle instance id
|
// handle instance id
|
||||||
//
|
//
|
||||||
Status = HidClassPDO_HandleQueryHardwareId(DeviceObject, Irp);
|
Status = HidClassPDO_HandleQueryHardwareId(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
|
else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// handle instance id
|
// handle instance id
|
||||||
//
|
//
|
||||||
Status = HidClassPDO_HandleQueryInstanceId(DeviceObject, Irp);
|
Status = HidClassPDO_HandleQueryInstanceId(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
|
else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// handle instance id
|
// handle instance id
|
||||||
//
|
//
|
||||||
Status = HidClassPDO_HandleQueryCompatibleId(DeviceObject, Irp);
|
Status = HidClassPDO_HandleQueryCompatibleId(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n", IoStack->Parameters.QueryId.IdType);
|
DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n", IoStack->Parameters.QueryId.IdType);
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
{
|
{
|
||||||
|
@ -426,7 +426,9 @@ HidClassPDO_PnP(
|
||||||
//
|
//
|
||||||
// copy capabilities
|
// copy capabilities
|
||||||
//
|
//
|
||||||
RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
|
RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
|
||||||
|
&PDODeviceExtension->Capabilities,
|
||||||
|
sizeof(DEVICE_CAPABILITIES));
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +438,7 @@ HidClassPDO_PnP(
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
BusInformation = (PPNP_BUS_INFORMATION)ExAllocatePool(NonPagedPool, sizeof(PNP_BUS_INFORMATION));
|
BusInformation = (PPNP_BUS_INFORMATION)ExAllocatePool(NonPagedPool, sizeof(PNP_BUS_INFORMATION));
|
||||||
|
|
||||||
//
|
//
|
||||||
// fill in result
|
// fill in result
|
||||||
//
|
//
|
||||||
|
@ -510,7 +512,10 @@ HidClassPDO_PnP(
|
||||||
//
|
//
|
||||||
// now register the device interface
|
// now register the device interface
|
||||||
//
|
//
|
||||||
Status = IoRegisterDeviceInterface(PDODeviceExtension->Common.HidDeviceExtension.PhysicalDeviceObject, &GUID_DEVINTERFACE_HID, NULL, &PDODeviceExtension->DeviceInterface);
|
Status = IoRegisterDeviceInterface(PDODeviceExtension->Common.HidDeviceExtension.PhysicalDeviceObject,
|
||||||
|
&GUID_DEVINTERFACE_HID,
|
||||||
|
NULL,
|
||||||
|
&PDODeviceExtension->DeviceInterface);
|
||||||
DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status);
|
DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -533,22 +538,22 @@ HidClassPDO_PnP(
|
||||||
if (PDODeviceExtension->DeviceInterface.Length != 0)
|
if (PDODeviceExtension->DeviceInterface.Length != 0)
|
||||||
IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, FALSE);
|
IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// remove us from the fdo's pdo list
|
// remove us from the fdo's pdo list
|
||||||
//
|
//
|
||||||
bFound = FALSE;
|
bFound = FALSE;
|
||||||
for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
|
for (Index = 0; Index < PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
|
||||||
{
|
{
|
||||||
if (PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] == DeviceObject)
|
if (PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] == DeviceObject)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// remove us
|
// remove us
|
||||||
//
|
//
|
||||||
bFound = TRUE;
|
bFound = TRUE;
|
||||||
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
|
PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete the IRP */
|
/* Complete the IRP */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
@ -659,15 +664,21 @@ HidClassPDO_CreatePDO(
|
||||||
RtlZeroMemory(DeviceRelations, Length);
|
RtlZeroMemory(DeviceRelations, Length);
|
||||||
|
|
||||||
//
|
//
|
||||||
// lets create a PDO for top level collection
|
// let's create a PDO for top level collection
|
||||||
//
|
//
|
||||||
Index = 0;
|
Index = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// lets create the device object
|
// let's create the device object
|
||||||
//
|
//
|
||||||
Status = IoCreateDevice(FDODeviceExtension->Common.DriverExtension->DriverObject, sizeof(HIDCLASS_PDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_UNKNOWN, FILE_AUTOGENERATED_DEVICE_NAME, FALSE, &PDODeviceObject);
|
Status = IoCreateDevice(FDODeviceExtension->Common.DriverExtension->DriverObject,
|
||||||
|
sizeof(HIDCLASS_PDO_DEVICE_EXTENSION),
|
||||||
|
NULL,
|
||||||
|
FILE_DEVICE_UNKNOWN,
|
||||||
|
FILE_AUTOGENERATED_DEVICE_NAME,
|
||||||
|
FALSE,
|
||||||
|
&PDODeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -724,10 +735,10 @@ HidClassPDO_CreatePDO(
|
||||||
|
|
||||||
//
|
//
|
||||||
// move to next
|
// move to next
|
||||||
//
|
//
|
||||||
Index++;
|
Index++;
|
||||||
|
|
||||||
}while(Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength);
|
} while(Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -738,7 +749,7 @@ HidClassPDO_CreatePDO(
|
||||||
//
|
//
|
||||||
// failed
|
// failed
|
||||||
//
|
//
|
||||||
for(Index = 0; Index < DeviceRelations->Count; Index++)
|
for (Index = 0; Index < DeviceRelations->Count; Index++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// delete device
|
// delete device
|
||||||
|
@ -762,4 +773,4 @@ HidClassPDO_CreatePDO(
|
||||||
// done
|
// done
|
||||||
//
|
//
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef struct
|
||||||
PDRIVER_UNLOAD DriverUnload;
|
PDRIVER_UNLOAD DriverUnload;
|
||||||
KSPIN_LOCK Lock;
|
KSPIN_LOCK Lock;
|
||||||
|
|
||||||
}HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
|
} HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ typedef struct
|
||||||
//
|
//
|
||||||
HID_DEVICE_ATTRIBUTES Attributes;
|
HID_DEVICE_ATTRIBUTES Attributes;
|
||||||
|
|
||||||
}HIDCLASS_COMMON_DEVICE_EXTENSION, *PHIDCLASS_COMMON_DEVICE_EXTENSION;
|
} HIDCLASS_COMMON_DEVICE_EXTENSION, *PHIDCLASS_COMMON_DEVICE_EXTENSION;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ typedef struct
|
||||||
//
|
//
|
||||||
PDEVICE_RELATIONS DeviceRelations;
|
PDEVICE_RELATIONS DeviceRelations;
|
||||||
|
|
||||||
}HIDCLASS_FDO_EXTENSION, *PHIDCLASS_FDO_EXTENSION;
|
} HIDCLASS_FDO_EXTENSION, *PHIDCLASS_FDO_EXTENSION;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ typedef struct
|
||||||
ULONG CollectionNumber;
|
ULONG CollectionNumber;
|
||||||
|
|
||||||
//
|
//
|
||||||
// device interface
|
// device interface
|
||||||
//
|
//
|
||||||
UNICODE_STRING DeviceInterface;
|
UNICODE_STRING DeviceInterface;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ typedef struct
|
||||||
//
|
//
|
||||||
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
|
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
|
||||||
|
|
||||||
}HIDCLASS_PDO_DEVICE_EXTENSION, *PHIDCLASS_PDO_DEVICE_EXTENSION;
|
} HIDCLASS_PDO_DEVICE_EXTENSION, *PHIDCLASS_PDO_DEVICE_EXTENSION;
|
||||||
|
|
||||||
typedef struct __HIDCLASS_FILEOP_CONTEXT__
|
typedef struct __HIDCLASS_FILEOP_CONTEXT__
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ typedef struct __HIDCLASS_FILEOP_CONTEXT__
|
||||||
//
|
//
|
||||||
KEVENT IrpReadComplete;
|
KEVENT IrpReadComplete;
|
||||||
|
|
||||||
}HIDCLASS_FILEOP_CONTEXT, *PHIDCLASS_FILEOP_CONTEXT;
|
} HIDCLASS_FILEOP_CONTEXT, *PHIDCLASS_FILEOP_CONTEXT;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ typedef struct
|
||||||
//
|
//
|
||||||
PIO_WORKITEM CompletionWorkItem;
|
PIO_WORKITEM CompletionWorkItem;
|
||||||
|
|
||||||
}HIDCLASS_IRP_CONTEXT, *PHIDCLASS_IRP_CONTEXT;
|
} HIDCLASS_IRP_CONTEXT, *PHIDCLASS_IRP_CONTEXT;
|
||||||
|
|
||||||
/* fdo.c */
|
/* fdo.c */
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
Loading…
Reference in a new issue