First of all, I’d like to say thanks to all those who have contributed to
this board. It’s been a wealth of knowledge in the beginnings of trying
to write a filter driver. I’ve come up against a problem that has me a
bit bewildered right now though.
The filter driver I’m writing is to do encryption on the fly in certain
protected directories. Seems to be a lot of that here From all I’ve
read, I realize that I can’t just modify the data buffer being sent down
through the IRP, so this has been my tactic so far for the encryption side
of things:
1 - Catch the IRP_MJ_WRITE and determine whether or not this is in a
protected folder. If the folder isn’t protected, I just pass the IRP
along, otherwise, I keep going in my own process below.
2 - I need the correct file size, and the only way I could figure to find
that was to generate another IRP with major function
IRP_MJ_QUERY_INFORMATION. This seems to get me the proper file size.
3 - I then copy the data buffer from the original IRP into my own buffer,
and encrypt the portion of data necessary (just making sure not to go
beyone the end of the file as this seemed to cause problems).
4 - I then generate another IRP with major function IRP_MJ_WRITE. I point
the IRP to the encrypted data buffer, and then send it off.
My first question is am I going about this completely wrong? It seems to
work a great deal of the time, but I’m sure there will be situations that
call for something different.
My second question, and the reason for the post is this. I got the idea
from a post on here to try building projects with developer studio in a
protected folder. This sometimes works, and other times, the compiler
just hangs while compiling. It seems to always get stuck on the .pch
files. I see it merrily sending data to me in 64k packets which I encrypt
and keep passing along. Eventually, no more packets are sent in, yet the
file isn’t complete yet. Sometimes it makes it all the way through
several projects before hanging, but it always seems to be on the .pch
file where it stops. Anyone have any ideas what I could possibly be doing
wrong?
That’s about it for now… if anyone has any suggestions, or if you think
it’s just a bug in my code, I would really appreciate any input. Thanks
for your time!
Bill