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:

Hashing files after a write question

scotts3l33tscotts3l33t Member Posts: 7

Hello all!
My situation: Business requirements are such that I need to hash any file that has been written to by certain processes and report new hash. Until recently, I was doing the hash on irp_mj_cleanup but it was decided that the performance impact was to great and so something had to change.
I tried implementing a change where I use FltQueueGenericeWorkItem to push the hashing into another thread, allowing the original process to complete it's cleanup and thereby improving performance (or apparent performance anyway) because the process is not waiting on the cleanup of the file while I hash.
This has cause an issue though, because I need to reopen the file to do the hashing, if the process tries to reopen the file without sharing, the original process fails. This happens more than I would like (with word for instance). I am trying to fix this issue my having the irp_mj_create wait on the completion of the hash, but this has introduced additional problems, like a strange memory corruption other issues, like not being able to set an event without a BSOD.

My Question is this: am I barking up the wrong tree? Should I be doing this a completely different way? I saw that the AVSCAN driver sample had some code I could steal, but I have to support windows 7 so I am not sure I can use that code. Any help would be great, thank you in advance for your time.

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 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online
Developing Minifilters 23 May 2022 Live, Online
Writing WDF Drivers 12 September 2022 Live, Online