How can I use FILE_OBJECT level Context?

Hi, I’m developing a filter based on minifilter.
Now I want to store some information for each single FILE_OBJECT, I have learned about File Stream Context but found that what I need is the file object level context.
I use an array to store the FILE_OBJECT address and its cooresponding context, but I find that sometimes I will missing some IRPs, so I guess the address of FILE_OBJECT may not be stable.(e.g. I can not catch the IRP_MJ_WRITE with PAGING_IO marks from wordpad.exe)
So I wonder is there any build-in method to store the FILE_OBJECT context, or any other stable method to identify a FILE_OBJECT?
Thanks in advance, any help will be appreciated!

Hi Haotian,

What about using Stream Handle Contexts?
http://msdn.microsoft.com/en-us/library/windows/hardware/ff549729(v=vs.85).aspx

Regards,

Fernando Roberto da Silva
DriverEntry Kernel Development
http://www.driverentry.com.br

yeah, you can use stream handle context!

Thanks so much!
It’s exactly what I want :slight_smile: