Use of ValidDataLength

Hi!
I am filtering Non cached I/Os ( Paging I/O also ) Writes in my minifilter driver. I wanted to know the following:

  1. whether it is safe to use the value of ValidDataLength to find out the actual data length that is present in the buffer.

  2. How to access it safely? Are there any special conditions that i need to look out for?

3.Additionally, is checking the value of ValidDataLength, the correct way of finding the length of data that is in the buffer?

-Ayush Gupta

Also, can i use the value of FileSize safely?
How to know that the page being written in the paging i/o path is the last page in the file?