阅读:2070回复:1
PCI网卡Driver 中不懂的一点,求助!
以下是取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 ); |
|
沙发#
发布于:2014-10-21 05:57
注意Iocalldriver的参数,你可以检查是不是自己,它怎么来的,仔细看代码
|
|
|