-/* $Id: util.c,v 1.7 2001/04/24 18:36:39 ea Exp $
+/* $Id: util.c,v 1.13 2003/03/16 13:18:49 chorns Exp $
*
* reactos/ntoskrnl/fs/util.c
*
*/
-#include <ntos.h>
+#include <ddk/ntddk.h>
#include <ddk/ntifs.h>
/**********************************************************************
* NAME EXPORTED
- * FsRtlIsNtstatusExpected@4
+ * FsRtlIsNtstatusExpected/1
+ * stack32 = 4
*
* DESCRIPTION
* Check an NTSTATUS value is expected by the FS kernel
* NTSTATUS to test.
*
* RETURN VALUE
- * TRUE if NtStatus is either STATUS_ACCESS_VIOLATION,
- * STATUS_ILLEGAL_INSTRUCTION, STATUS_DATATYPE_MISALIGNMENT,
- * 0xC00000AA; FALSE otherwise.
- *
- * NOTES
- * By calling the function with all possible values,
- * one unknown NTSTATUS value makes the function
- * return 0x00 (0xC00000AA).
+ * TRUE if NtStatus is NOT one out of:
+ * - STATUS_ACCESS_VIOLATION
+ * - STATUS_ILLEGAL_INSTRUCTION
+ * - STATUS_DATATYPE_MISALIGNMENT
+ * - STATUS_INSTRUCTION_MISALIGNMENT
+ * which are the forbidden return stati in the FsRtl
+ * subsystem; FALSE otherwise.
+ *
+ * REVISIONS
+ * 2002-01-17 Fixed a bad bug reported by Bo Brantén.
+ * Up to version 1.8, this function's semantics was
+ * exactly the opposite! Thank you Bo.
*/
BOOLEAN
STDCALL
|| (STATUS_ILLEGAL_INSTRUCTION == NtStatus)
|| (STATUS_INSTRUCTION_MISALIGNMENT == NtStatus)
)
- ? TRUE
- : FALSE;
+ ? FALSE
+ : TRUE;
}
* RETURN VALUE
*
*/
-DWORD
+NTSTATUS
STDCALL
FsRtlGetFileSize (
- DWORD Unknown0,
- DWORD Unknown1
- )
+ IN PFILE_OBJECT FileObject,
+ IN OUT PLARGE_INTEGER FileSize
+ )
{
- return 0;
+ FILE_STANDARD_INFORMATION Info;
+ NTSTATUS Status;
+ ULONG Length;
+
+ Status = IoQueryFileInformation(FileObject,
+ FileStandardInformation,
+ sizeof(Info),
+ &Info,
+ &Length);
+ if (NT_SUCCESS(Status))
+ {
+ FileSize->QuadPart = Info.EndOfFile.QuadPart;
+ }
+
+ return Status;
}