⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testpower.c

📁 USB2.0原理与工程开发光盘(第二版)
💻 C
字号:
#include "usbdriver.h"

NTSTATUS TestPowerIrp(IN PDEVICE_OBJECT fdo,IN PIRP Irp)
{
	NTSTATUS ntStatus;
	PIO_STACK_LOCATION IrpStack, NextStack;
    PDEVICE_EXTENSION pdx;

    pdx = fdo->DeviceExtension;
 
    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;
   
    IrpStack = IoGetCurrentIrpStackLocation (Irp);

    switch (IrpStack->MinorFunction) {
		case IRP_MN_SET_POWER:
			switch (IrpStack->Parameters.Power.Type) {
				case SystemPowerState:
					break; 
                case DevicePowerState:
					switch (IrpStack->Parameters.Power.State.DeviceState) {
						case PowerDeviceD3:
							break;
                        case PowerDeviceD2:
							break;
                        case PowerDeviceD1:
                            break;
                        case PowerDeviceD0:
                            break;
					}
                break; 
			}
         break;  
         case IRP_MN_QUERY_POWER:
			
             switch (IrpStack->Parameters.Power.Type) {
            case SystemPowerState:
				break; 
            case DevicePowerState:
				switch (IrpStack->Parameters.Power.State.DeviceState) {
					case PowerDeviceD2:                    
						break;
                    case PowerDeviceD1:
                         break;
                    case PowerDeviceD3:
                         break;
				} 
               break; 
			 }
         break; 
         default:
			
			 ;
	} 
    NextStack = IoGetNextIrpStackLocation(Irp);
    RtlCopyMemory(NextStack, IrpStack, sizeof(IO_STACK_LOCATION));
  
    ntStatus = IoCallDriver(pdx->LowerDeviceObject, Irp);
  
   if (ntStatus == STATUS_PENDING) {
	   IoMarkIrpPending(Irp);
   }
   return ntStatus;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -