maharmstone/winmd

Power Manage Mode - Can Not Sleep

Thompson-NO3 opened this issue · 1 comments

I've installed it in windows. But I have just found it can't enter sleep mode. So the computer can't enter sleep mode. Woud you please fix this issue by modifying code about IRP_MJ_POWER.

I noticed that the two functions below are the related functions:

NTSTATUS device::power(PIRP Irp) {
  NTSTATUS Status = Irp->IoStatus.Status;
  PoStartNextPowerIrp(Irp);

  return Status;
}


NTSTATUS control_device::power(PIRP Irp) {
  NTSTATUS Status;
  PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);

  if (IrpSp->MinorFunction == IRP_MN_SET_POWER || IrpSp->MinorFunction == IRP_MN_QUERY_POWER)
      Irp->IoStatus.Status = STATUS_SUCCESS;

  Status = Irp->IoStatus.Status;
  PoStartNextPowerIrp(Irp);

  return Status;
}

They are in winmd.cpp, the code manipulate IRP_MJ_POWER correctly, but for some reason, the function control_device::power is not called during running, but the function device::power is called.

I don't know why, but code indicates we should use control_device::power which inheritage from device::power. So we can use function control_device::power instead of device::power.

Could the author please tell me the reason why the correct function is NOT called?

This issue cause we can not enter Stand By mode in Windows.