[A] “For each IRP_MJ_CLOSE the filter driver decrements the reference count
on the per-file context structure if the FO_STREAM_FILE bit is not set for
the file object.”
[B] The document previously noted that if my driver encountered an I/O with
stream file object that is is not in list thus I add reference to FsContext.
Now how will the reference decrement if [A] disallow reference decrementing
for case [B] ?
The files with the FO_STREAM_FILE will not AddRef your your FsContext.
You will have a sublist of FILE_OBJECTs, and add this FILE_OBJECT to the
list.
“… a reference count (for file objects seen via the IRP_MJ_CREATE
mechanism) and an explicit list … of stream file objects seen by the
filter. On each I/O operation, the filter examines the FO_STREAM_FILE
Flag. If this bit is set, the filter verifies that the file object is
in its list ? if not, it allocates the necessary storage for its
tracking information and ***inserts it into its list***”
“Then, when it observes an IRP_MJ_CLOSE operation, it will **either**
decrement the reference count ***or remove it from the list***”
IRP_MJ_CREATE
RefCount++
IRP_MJ_CLOSE
FILE_OBJECT in list?
o Yes: Remove from list
o No: decrement the reference count
FILE_OBJECT list empty and RefCount == 0?
o Yes: Delete the file (FsContext) reference
IRP_MJ_* (I/O)
Flag FO_STREAM_FILE?
o Yes: FsContext in the list?
? Yes: FILE_OBJECT in the FsContext sublist?
? No: Insert FILE_OBJECT in the sublist
I ask the more experienced folks to say if my interpretation is correct
:-).
[A] “For each IRP_MJ_CLOSE the filter driver decrements the reference count
on the per-file context structure if the FO_STREAM_FILE bit is not set for
the file object.”
[B] The document previously noted that if my driver encountered an I/O with
stream file object that is is not in list thus I add reference to FsContext.
Now how will the reference decrement if [A] disallow reference decrementing
for case [B] ?