reactos操作系统实现(115)

前端之家收集整理的这篇文章主要介绍了reactos操作系统实现(115)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

PciIdeXFdoPnpDispatch函数主要处理PCIIDE即插即用的消息处理。具体实现代码如下:

#001 NTSTATUS NTAPI

#002 PciIdeXFdoPnpDispatch(

#003 IN PDEVICE_OBJECT DeviceObject,

#004 IN PIRP Irp)

#005 {

#006 ULONG MinorFunction;

#007 PIO_STACK_LOCATION Stack;

#008 ULONG_PTR Information = 0;

#009 NTSTATUS Status;

#010

获取当前栈位置。

#011 Stack = IoGetCurrentIrpStackLocation(Irp);

功能码,用来选择那一种功能处理代码

#012 MinorFunction = Stack->MinorFunction;

#013

#014 switch (MinorFunction)

#015 {

启动设备。

#016 case IRP_MN_START_DEVICE: /* 0x00 */

#017 {

#018 DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE/n");

#019 /* Call lower driver */

#020 Status = ForwardIrpAndWait(DeviceObject,Irp);

#021 if (NT_SUCCESS(Status))

#022 Status = PciIdeXFdoStartDevice(DeviceObject,Irp);

#023 break;

#024 }

查询总线有多少个物理设备。

#025 case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */

#026 {

#027 switch (Stack->Parameters.QueryDeviceRelations.Type)

#028 {

#029 case BusRelations:

#030 {

#031 PDEVICE_RELATIONS DeviceRelations = NULL;

#032 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations/n");

#033 Status = PciIdeXFdoQueryBusRelations(DeviceObject,&DeviceRelations);

#034 Information = (ULONG_PTR)DeviceRelations;

#035 break;

#036 }

#037 default:

#038 {

#039 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx/n",

#040 Stack->Parameters.QueryDeviceRelations.Type);

#041 Status = STATUS_NOT_IMPLEMENTED;

#042 break;

#043 }

#044 }

#045 break;

#046 }

过滤分配的资源请求。

#047 case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0x0d */

#048 {

#049 DPRINT("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS/n");

#050 return ForwardIrpAndForget(DeviceObject,Irp);

#051 }

#052 default:

#053 {

#054 DPRINT1("IRP_MJ_PNP / Unknown minor function 0x%lx/n",MinorFunction);

#055 return ForwardIrpAndForget(DeviceObject,Irp);

#056 }

#057 }

#058

返回这个IRP的状态,并标记这个IRP完成。

#059 Irp->IoStatus.Information = Information;

#060 Irp->IoStatus.Status = Status;

#061 IoCompleteRequest(Irp,IO_NO_INCREMENT);

#062 return Status;

#063}

原文链接:https://www.f2er.com/react/308411.html

猜你在找的React相关文章