Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

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:

Questions about FltUnregisterFilter

HaiboHaibo Member Posts: 187

I have two questions about FltUnregisterFilter:
1. Is it possbile that minifilter is unregistered between a pre and corresponding post calls? how can i free CompletionContext if post callback is skipped because of driver unloading.
2. Does system free all allocated stream contexts and stream handle contexts allocated by my minifilter during FltUnregisterFilter call? i assume yes, can someone confirm?



  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,224

    1) yes. You will be called at the post call with the draining bit set. And you won’t be called in the same context even if you specified SYNCHRONIZE, which has implications….

    2) no. It detaches them from their related object (instance, file object,…) and issues a dereference. If the attachment was the only thing pinning them then they will be freed, but if you had a reference on them they will only be freed when you dereference them.

  • HaiboHaibo Member Posts: 187

    Thank you rod, more about unloading minifilter. Now I want to unload my driver from memory in order to update it, and i have unload routine in FLT_REGISTRATION, do i have to implement DriverObject->DriverUnload?

  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,224
    edited September 2021

    I said no, but I meant "I usually doe" (I was thinking about something else)

    I don't usually do anything in there - instead I rely on the filter manager callback.

  • HHosseinKHHosseinK Member Posts: 8

    For having standard structure in minifilter driver you should implement Unload driver routine in FLT_REGISTRATION, and to free all allocated memory or other contexts, you should call to the Unload routine for freeing up all of these memories

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online