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


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:

Before Posting...

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

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,210

    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,210
    edited September 1

    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.

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!
Internals & Software Drivers 15 November 2021 Live, Online
Writing WDF Drivers TBD Live, Online
Developing Minifilters 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online