How to get the property of a device if I have wdfdevice and wdftarget in kmdf based filter driver?

573 views Asked by At

I have three disk: disk0, disk1, disk2. Evtdeviceadd routine will be called 3 times for each of device. Now I want to catch read IRP and when it is from disk1 then I want to change the target from disk1 to disk2. So how Would I differentiate that the request I got it from disk1. For that if I am able to get device property then I can get to know or any other solution?

1

There are 1 answers

0
Vivek On

When you add these disks, in your device add routine create an extension structure and allocate a context WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&objectAttribs, XX_EXTENSION); WdfObjectAllocateContext( Device, &objectAttribs, NULL);

differentiate them by having an identifier in that structure.

You would be able to access the queue object in your request callback. From the queue object get the device object and from that your extension structure and hence the identifier.