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.

Hang in PostCleanup Operation when Deleting a file

Mehtab_SyedMehtab_Syed Member Posts: 6

Hi Folks,
I am getting a hang in my minifilter when I try to Delete a file in the PostCleanup. The hang occurs as the thread is waiting for an oplock.
From the dump the oplock is shared RH .
So I was think of ways I need to handle the deletion for the file.
1.Post it to the Worker thread and purge the File cache, so that oplocks on the file are gone.
2.Wait of Oplock break notify to start deletion of the file .

Any inputs on the pros and cons of these approaches ?



  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,450

    Why did you choose PostCleanup and how are you trying to delete the file? If you’re sending a SetDisposition on the cleaned up File Object then you’re pretty much doomed.


  • Mehtab_SyedMehtab_Syed Member Posts: 6

    We monitor file copy scenarios. We need to read the file content of the file and check if it contains data of interest. So cleanup provides a place to analyze and delete the file in the PostCleanup.
    Yes we are using SetDisposition , however we are rolling our own create on the file to delete the file. If that fails we try DeleteOnClose.


  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,450

    Are you opening in the PostCleanup callback or doing it in a worker thread? Also, who owns the oplock when you’re stuck? !fltmgr.oplock should tell you.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online