The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
In our driver we need to inform user of certain events in the kernel driver, so the user creates a handle, proceed to send it to kernel via IOCTL, then in kernel mode we use ObReferenceObjectByHandle to get our kernel handle linked to the user one, then at the event we just signal the kernel one and user gets its own signaled too, this works.
How would be the best way to deal in the case that the user process die? how I can know if the handle is still valid? tracking the process id? we need to support multiple users so we don't like the idea of creating many handles, if some of the current handles is stale, we would like to we use it, but how can we know?
First option for me would be to use ObDereferenceObject and then ObReferenceObjectByHandle again, if the call fails, the handle is not longer valid and I can flag it as stale for reuse.
Second option, track the process Id from the IOCTL and check if the process is still alive, but doesn't feel good to track user pids.
I know there should be a clean and elegant way to deal with such cases.
Thanks in advance.
|Upcoming OSR Seminars|
|OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!|
|Writing WDF Drivers||7 Dec 2020||LIVE ONLINE|
|Internals & Software Drivers||25 Jan 2021||LIVE ONLINE|
|Developing Minifilters||8 March 2021||LIVE ONLINE|