您可以使用它来获取文件大小
NTSTATUS
GetFileSize (
_In_ PFLT_INSTANCE Instance,
_In_ PFILE_OBJECT FileObject,
_Out_ PLONGLONG Size
)
/*++
Routine Description:
This routine obtains the size.
Arguments:
Instance - Opaque filter pointer for the caller. This parameter is required and cannot be NULL.
FileObject - File object pointer for the file. This parameter is required and cannot be NULL.
Size - Pointer to a LONGLONG indicating the file size. This is the output.
Return Value:
Returns statuses forwarded from FltQueryInformationFile.
--*/
{
NTSTATUS status = STATUS_SUCCESS;
FILE_STANDARD_INFORMATION standardInfo;
//
// Querying for FileStandardInformation gives you the offset of EOF.
//
status = FltQueryInformationFile( Instance,
FileObject,
&standardInfo,
sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation,
NULL );
if (NT_SUCCESS( status )) {
*Size = standardInfo.EndOfFile.QuadPart;
}
return status;
}