On 05.10.2016 02:23, Aric Stewart wrote:
+NTSTATUS WINAPI common_power_dispatch(DEVICE_OBJECT *device, IRP *irp) +{
- IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
- TRACE("Device entering power state %i\n", irpsp->Parameters.Power.State.DeviceState);
You are ignoring the MinorFunction parameter here. DeviceState is only valid for IRP_MN_SET_POWER, but there are also other IRP_MJ_POWER requests. For those it would be better to keep irp->IoStatus.u.Status set the original value, similar to how its done in common_pnp_dispatch.
I would also suggest to add a TRACE with device and irp here (and to common_pnp_dispatch), otherwise it is difficult to interpret the meaning of the logged values. The TRACE in handle_IRP_MN_QUERY_ID could be removed then.
Regards, Sebastian
- irp->IoStatus.u.Status = STATUS_SUCCESS;
- IoCompleteRequest(irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
+}