[HIDCLASS]

- Get rid of HidClass_GetSystemAddress
- More minor fixes

svn path=/trunk/; revision=59008
This commit is contained in:
Thomas Faber 2013-05-12 17:16:41 +00:00
parent ba151570a1
commit 6c4c227878
2 changed files with 9 additions and 32 deletions

View file

@ -20,7 +20,7 @@ HidClassFDO_QueryCapabilitiesCompletionRoutine(
// //
// set event // set event
// //
KeSetEvent((PRKEVENT)Context, 0, FALSE); KeSetEvent(Context, 0, FALSE);
// //
// completion is done in the HidClassFDO_QueryCapabilities routine // completion is done in the HidClassFDO_QueryCapabilities routine
@ -131,7 +131,7 @@ HidClassFDO_DispatchRequestSynchronousCompletion(
// //
// signal event // signal event
// //
KeSetEvent((PRKEVENT)Context, 0, FALSE); KeSetEvent(Context, 0, FALSE);
// //
// done // done
@ -447,7 +447,7 @@ HidClassFDO_CopyDeviceRelations(
// allocate result // allocate result
// //
DeviceRelations = ExAllocatePoolWithTag(NonPagedPool, DeviceRelations = ExAllocatePoolWithTag(NonPagedPool,
sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count-1) * sizeof(PDEVICE_OBJECT), sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count - 1) * sizeof(PDEVICE_OBJECT),
HIDCLASS_TAG); HIDCLASS_TAG);
if (!DeviceRelations) if (!DeviceRelations)
{ {

View file

@ -354,31 +354,6 @@ HidClass_Close(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
PVOID
HidClass_GetSystemAddress(
IN PMDL ReportMDL)
{
//
// sanity check
//
ASSERT(ReportMDL);
if (ReportMDL->MdlFlags & (MDL_SOURCE_IS_NONPAGED_POOL | MDL_MAPPED_TO_SYSTEM_VA))
{
//
// buffer is non paged pool
//
return ReportMDL->MappedSystemVa;
}
else
{
//
// map mdl
//
return MmMapLockedPages(ReportMDL, KernelMode);
}
}
NTSTATUS NTSTATUS
NTAPI NTAPI
HidClass_ReadCompleteIrp( HidClass_ReadCompleteIrp(
@ -415,7 +390,7 @@ HidClass_ReadCompleteIrp(
// //
// get address // get address
// //
Address = HidClass_GetSystemAddress(IrpContext->OriginalIrp->MdlAddress); Address = MmGetSystemAddressForMdlSafe(IrpContext->OriginalIrp->MdlAddress, NormalPagePriority);
if (Address) if (Address)
{ {
// //
@ -1061,7 +1036,6 @@ HidClass_DispatchDefault(
return IoCallDriver(CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, Irp); return IoCallDriver(CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, Irp);
} }
NTSTATUS NTSTATUS
NTAPI NTAPI
HidClassDispatch( HidClassDispatch(
@ -1119,7 +1093,10 @@ HidRegisterMinidriver(
} }
/* now allocate the driver object extension */ /* now allocate the driver object extension */
Status = IoAllocateDriverObjectExtension(MinidriverRegistration->DriverObject, (PVOID)ClientIdentificationAddress, sizeof(HIDCLASS_DRIVER_EXTENSION), (PVOID*)&DriverExtension); Status = IoAllocateDriverObjectExtension(MinidriverRegistration->DriverObject,
ClientIdentificationAddress,
sizeof(HIDCLASS_DRIVER_EXTENSION),
(PVOID *)&DriverExtension);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* failed to allocate driver extension */ /* failed to allocate driver extension */
@ -1140,7 +1117,7 @@ HidRegisterMinidriver(
/* copy driver dispatch routines */ /* copy driver dispatch routines */
RtlCopyMemory(DriverExtension->MajorFunction, RtlCopyMemory(DriverExtension->MajorFunction,
MinidriverRegistration->DriverObject->MajorFunction, MinidriverRegistration->DriverObject->MajorFunction,
sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1)); sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION + 1));
/* initialize lock */ /* initialize lock */
KeInitializeSpinLock(&DriverExtension->Lock); KeInitializeSpinLock(&DriverExtension->Lock);