Hi,
I’m need to be able to read/write PCI config regs of multiple PCI devices in my driver. To get our validation driver working on Vista I managed to port it into a PCI bus filter driver which is working. The IRP_MN_QUERY_INTERFACE call to the lower bus driver (pci.sys) however is returning STATUS_NOT_SUPPORTED. This piece of code looks almost the same as what is posted in MS KB Q253232.
VOID SvAccessQueryBusInterface( IN PDEVICE_OBJECT DeviceObject ) {
PCONTROL_DEVICE_EXTENSION deviceExtension;
IO_STATUS_BLOCK ioStatus;
NTSTATUS status;
KEVENT kevent;
PIRP pIrp;
PIO_STACK_LOCATION pIrpSp;
PDEVICE_OBJECT targetObject;
deviceExtension = (PCONTROL_DEVICE_EXTENSION)ControlDeviceObject->DeviceExtension;
targetObject = IoGetAttachedDeviceReference( DeviceObject );
//
// initialize the kernel event to block on
KeInitializeEvent( &kevent, NotificationEvent, FALSE );
// build the IRP
pIrp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, targetObject,
NULL, 0, NULL, &kevent, &ioStatus );
if( !pIrp )
return;
pIrp->RequestorMode = KernelMode;
pIrp->IoStatus.Status = STATUS_NOT_SUPPORTED;
pIrp->IoStatus.Information = 0;
// get next stack location
pIrpSp = IoGetNextIrpStackLocation( pIrp );
// use QUERY_INTERFACE to get address of direct call ACPI interface
pIrpSp->MajorFunction = IRP_MJ_PNP;
pIrpSp->MinorFunction = IRP_MN_QUERY_INTERFACE;
pIrpSp->Parameters.QueryInterface.InterfaceType = (LPGUID) &GUID_BUS_INTERFACE_STANDARD;
pIrpSp->Parameters.QueryInterface.Version = 1;
pIrpSp->Parameters.QueryInterface.Size = sizeof( BUS_INTERFACE_STANDARD );
pIrpSp->Parameters.QueryInterface.Interface = (PINTERFACE)&deviceExtension->busInterface;
pIrpSp->Parameters.QueryInterface.InterfaceSpecificData = NULL;
// send the request to lower driver
status = IoCallDriver( targetObject, pIrp );
if( status == STATUS_PENDING ) {
KeWaitForSingleObject( &kevent, Executive, KernelMode, FALSE, NULL );
status = ioStatus.Status;
}
if( NT_SUCCESS(status) ) {
deviceExtension->bBusInterfaceInitialized = TRUE;
}
else
{
KdPrint( (“Query interface failed, Status = %x\n”, status ) );
}
}
Isn’t this call valid from a PCI upper filter driver?
Regards,
Uday