Hello all,
I’ve a weird problem, and this stems from driverA <->driverB communication. I basically need to get the PDO of driverB (which I stored in driverB’s device extension.
I was using the DeviceObject returned from IoGetDevicePointer’s DeviceObject->Extension, but if VERIFIER is enabled, it seems that the extensions are “zeroed out”.
The deviceobject still works, since I can make PnP calls to get PCIId and stuff. The device extension is non-null, and is pointing to some location, but it seems that the data in this location is Zeroed out of sorts
If VERIFIER is turned off, I can see valid data in the device-extension from driver B. Other then the device-extension muck-up, as far as I can tell, the deviceobject is generally correct (at least I can still use it to get the PCIId/InstanceId … to be able to tell that at least it’s the correct device)
//// [Driver A] //////
// On detect interface arrival (from DriverB)
// Open the device object
//
status = IoGetDeviceObjectPointer(
pSymbolicLink,
FILE_ALL_ACCESS,
&FileObject,
&DeviceObject
);
::
::
// GetPciId/InstanceId …etc …
::
::
pExtOut = (DEVICE_EXTENSION_OUTPUT *) pDevice->DeviceExtension;
if (pExtOut) {
PhysicalDeviceObject = pExtOut->PhysicalDeviceObject;
// NOTE: If VERIFIER is on, this returns NULL, if it’s not on, this works fine
// Get the BusNumber.
if (PhysicalDeviceObject != NULL) {
__try
{
IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyBusNumber,
sizeof(ULONG),
(PVOID)&BusNumber,
&length);
}
::
/// [Driver B] ///
NTSTATUS HandleAddDevice( IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject )
{
DEVICE_OBJECT * pDeviceObject;
NTSTATUS status;
DEVICE_EXTENSION * pDeviceExtension;
PAGED_CODE();
// Create the device object.
//
status = IoCreateDevice(
DriverObject,
sizeof(DEVICE_EXTENSION),
NULL,
THIS_DEVICE_TYPE,
0, // DeviceCharacteristics
TRUE, // exclusive
&pDeviceObject );
if (!NT_SUCCESS( status )) {
return status;
}
// Init the extension
pDeviceExtension = (DEVICE_EXTENSION *)pDeviceObject->DeviceExtension;
// Tell the extension who it belongs to
pDeviceExtension->pDriverObject = DriverObject;
pDeviceExtension->pDeviceObject = pDeviceObject; // save the object
pDeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
pDeviceExtension->PnPState = NotStarted;
//
// Attach to the device stack
//
pDeviceExtension->pNextLowerDevice =
IoAttachDeviceToDeviceStack( pDeviceObject, PhysicalDeviceObject );
if(pDeviceExtension->pNextLowerDevice == NULL) {
status = STATUS_DEVICE_REMOVED;
goto error_exit;
}
// Complete the initialization
pDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
}