Iterate over open driver file objects

Hi,
how can I find and iterate over all open (user mode) file objects to my KMDF device (from inside my KMDF driver providing a device object)?

Thanks, for any hint or recommendation!
Cheers,
Hagen.

How about making a list… At CreateFile put the WDFFILEOBJECT in a WDFCOLLECTION. Just be sure to provide a Cleanup even processing callback so you know when to remove/delete it.

Does that not work?

Peter
OSR
@OSRDrivers

Thanks, Peter,
OK. That would work.

But I thought the OS keeps track of the relation of device and file objects and I could ask for it (instead of inventing something which I would be responsible for keeping in sync with what the OS does anyways).

Thanks,
Hagen.

The os doesn?t have a list of file objects that are based on a device object. It is a ob reference count based system. After you have your list, what are you going to use it for?

Sent from Outlook Mailhttp: for Windows 10

From: xxxxx@dynax.at
Sent: Saturday, August 1, 2015 8:24 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Iterate over open driver file objects

Thanks, Peter,
OK. That would work.

But I thought the OS keeps track of the relation of device and file objects and I could ask for it (instead of inventing something which I would be responsible for keeping in sync with what the OS does anyways).

Thanks,
Hagen.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

Thanks, Doron,
for the clarification!

The reason behind that question:
I need to notify the user clients of asynchronous data arrival/space available events. Which could be done with threads and shared events as well, but I thought it would be a bit of an overkill.

The user clients itself do have shared user/kernel memory (ring buffers) which contain the updated data which the device is going to inform about.

Cheers and thanks,
Hagen.

Just put each type of event request in its own wdfqueue. Drain the queue when the event occurs. No need to track handles

Sent from Outlook Mailhttp: for Windows 10

From: xxxxx@dynax.at
Sent: Saturday, August 1, 2015 9:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Iterate over open driver file objects

Thanks, Doron,
for the clarification!

The reason behind that question:
I need to notify the user clients of asynchronous data arrival/space available events. Which could be done with threads and shared events as well, but I thought it would be a bit of an overkill.

The user clients itself do have shared user/kernel memory (ring buffers) which contain the updated data which the device is going to inform about.

Cheers and thanks,
Hagen.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

Thanks, Doron,

I will consider WDFQUEUEs for the signalling.

Cheers,
Hagen.