Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

  1. #include "pch.h"
  2. NTSTATUS
  3. PptPdoPower(
  4. IN PDEVICE_OBJECT Pdo,
  5. IN PIRP Irp
  6. )
  7. {
  8. PPDO_EXTENSION pdx = Pdo->DeviceExtension;
  9. PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation( Irp );
  10. NTSTATUS status;
  11. ULONG_PTR info = Irp->IoStatus.Information;
  12. POWER_STATE powerState = irpSp->Parameters.Power.State;
  13. POWER_STATE_TYPE powerType = irpSp->Parameters.Power.Type;
  14. UCHAR minorFunction = irpSp->MinorFunction;
  15. switch( minorFunction ) {
  16. case IRP_MN_QUERY_POWER:
  17. status = STATUS_SUCCESS;
  18. break;
  19. case IRP_MN_SET_POWER:
  20. switch( powerType ) {
  21. case DevicePowerState:
  22. PoSetPowerState( pdx->DeviceObject, powerType, powerState );
  23. pdx->DeviceState = powerState.DeviceState;
  24. status = STATUS_SUCCESS;
  25. break;
  26. case SystemPowerState:
  27. status = STATUS_SUCCESS;
  28. break;
  29. default:
  30. status = Irp->IoStatus.Status;
  31. }
  32. break;
  33. default:
  34. status = Irp->IoStatus.Status;
  35. }
  36. PoStartNextPowerIrp( Irp );
  37. P4CompleteRequest( Irp, status, info );
  38. DD((PCE)pdx,DDT,"PptPdoPower - minorFunction=%x, powerState=%x, powerType=%x, status=%x",minorFunction,powerState,powerType,status);
  39. return status;
  40. }