NTSTATUS NTAPI SysPoCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension) { NTSTATUS ntStatus; PIO_STACK_LOCATION irpStack; ntStatus = Irp->IoStatus.Status; irpStack = IoGetCurrentIrpStackLocation(Irp); FreeBT_DbgPrint(3, ("FBTUSB: SysPoCompletionRoutine: Entered\n")); // lower drivers failed this Irp if(!NT_SUCCESS(ntStatus)) { PoStartNextPowerIrp(Irp); FreeBT_DbgPrint(3, ("FBTUSB: SysPoCompletionRoutine::")); FreeBT_IoDecrement(DeviceExtension); return STATUS_SUCCESS; } // ..otherwise update the cached system power state (IRP_MN_SET_POWER) if(irpStack->MinorFunction == IRP_MN_SET_POWER) { DeviceExtension->SysPower = irpStack->Parameters.Power.State.SystemState; } // queue device irp and return STATUS_MORE_PROCESSING_REQUIRED SendDeviceIrp(DeviceObject, Irp); FreeBT_DbgPrint(3, ("FBTUSB: SysPoCompletionRoutine: Leaving\n")); return STATUS_MORE_PROCESSING_REQUIRED; }
NTSTATUS SysPoCompletionRoutine( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension ) /*++ Routine Description: This is the completion routine for the system power irps of minor function types IRP_MN_QUERY_POWER and IRP_MN_SET_POWER. This completion routine sends the corresponding device power irp and returns STATUS_MORE_PROCESSING_REQUIRED. The system irp is passed as a context to the device power irp completion routine and is completed in the device power irp completion routine. Arguments: DeviceObject - pointer to device object Irp - I/O request packet DeviceExtension - pointer to device extension Return Value: NT status value --*/ { NTSTATUS ntStatus; PIO_STACK_LOCATION irpStack; // // initialize variables // ntStatus = Irp->IoStatus.Status; irpStack = IoGetCurrentIrpStackLocation(Irp); MobiUsb_DbgPrint(3, ("file mobipwr: SysPoCompletionRoutine - begins\n")); // // lower drivers failed this Irp // if(!NT_SUCCESS(ntStatus)) { PoStartNextPowerIrp(Irp); MobiUsb_DbgPrint(3, ("file mobipwr: SysPoCompletionRoutine::")); MobiUsb_IoDecrement(DeviceExtension); return STATUS_SUCCESS; } // // ..otherwise update the cached system power state (IRP_MN_SET_POWER) // if(irpStack->MinorFunction == IRP_MN_SET_POWER) { DeviceExtension->SysPower = irpStack->Parameters.Power.State.SystemState; } // // queue device irp and return STATUS_MORE_PROCESSING_REQUIRED // SendDeviceIrp(DeviceObject, Irp); MobiUsb_DbgPrint(3, ("file mobipwr: SysPoCompletionRoutine - ends\n")); return STATUS_MORE_PROCESSING_REQUIRED; }