lihai425
驱动牛犊
驱动牛犊
  • 注册日期2006-05-26
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分18分
  • 威望54点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
阅读:1900回复:1

PCI网卡Driver 中不懂的一点,求助!

楼主#
更多 发布于:2014-10-20 17:14
以下是取PCI Configuration Space的一段代码:
 IoGetAttachedDeviceReference()是去取Driver Stack中最顶层的驱动对象。
然后调用IoCallDriver(),但是我理解的是网卡驱动已经是当前PCI Bus驱动堆栈上最顶层的设备了。
再调用IoCallDriver()不就是调用了自己么???
KEVENT event;NTSTATUS status;PIRP irp;IO_STATUS_BLOCK ioStatusBlock;PIO_STACK_LOCATION irpStack;PDEVICE_OBJECT targetObject;DebugPrint(TRACE, DBG_INIT, "GetPciBusInterfaceStandard entered.\n");KeInitializeEvent( &event, NotificationEvent, FALSE );targetObject = IoGetAttachedDeviceReference( DeviceObject );irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP,                                    targetObject,                                    NULL,                                    0,                                    NULL,                                    &event,                                    &ioStatusBlock );if (irp == NULL) {    status = STATUS_INSUFFICIENT_RESOURCES;    goto End;}irpStack = IoGetNextIrpStackLocation( irp );irpStack->MinorFunction = IRP_MN_QUERY_INTERFACE;irpStack->Parameters.QueryInterface.InterfaceType =                     (LPGUID) &GUID_BUS_INTERFACE_STANDARD ;irpStack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);irpStack->Parameters.QueryInterface.Version = 1;irpStack->Parameters.QueryInterface.Interface =                                     (PINTERFACE)BusInterfaceStandard;irpStack->Parameters.QueryInterface.InterfaceSpecificData = NULL;//    // Initialize the status to error in case the bus driver does not // set it correctly.irp->IoStatus.Status = STATUS_NOT_SUPPORTED ;status = IoCallDriver( targetObject, irp );
 
 
游客

返回顶部