Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
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/
It is not directly documented.
But from samples by Microsoft I can guess WdfControlFinishInitializing frees the init structure allocated by WdfControlDeviceInitAllocate.
Again, it is not in the doc for WdfControlDeviceInitAllocate but the sample at the end of the page shows the use of WdfDeviceInitFree in error cases to free the init structure.
But in success case there is no call to WdfDeviceInitFree so I guess WdfControlFinishInitializing does the job.
1. Am I right about this?
2. what happens in case I call WdfControlFinishInitializing and then WdfDeviceInitFree after that? Do I have to manually set the variable containing the return pointer from WdfControlDeviceInitAllocate to NULL to avoid WdfDeviceInitFree being called in error conditions after WdfControlFinishInitializing being called?
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 |
Comments
WdfDeviceCreate frees the device init structure when successful. If WdfDeviceCreate fails (or you fail somewhere before calling WdfDeviceCreate) then you need to free the structure with WdfDeviceInitFree.
WdfControlFinishInitializing takes a WDFDEVICE handle so you can't call it until WdfDeviceCreate succeeds.
-scott
OSR
I was completely wrong!
Thanks for response.