23#define BugCheckFileId (FAT_BUG_CHECK_FLUSH)
29#define Dbg (DEBUG_TRACE_FLUSH)
32#pragma alloc_text(PAGE, FatCommonFlushBuffers)
33#pragma alloc_text(PAGE, FatFlushDirectory)
34#pragma alloc_text(PAGE, FatFlushFat)
35#pragma alloc_text(PAGE, FatFlushFile)
36#pragma alloc_text(PAGE, FatFlushVolume)
37#pragma alloc_text(PAGE, FatFsdFlushBuffers)
38#pragma alloc_text(PAGE, FatFlushDirentForFile)
39#pragma alloc_text(PAGE, FatFlushFatEntries)
40#pragma alloc_text(PAGE, FatHijackIrpAndFlushDevice)
118 Status = FatCommonFlushBuffers( IrpContext,
Irp );
150FatCommonFlushBuffers (
220#if (NTDDI_VERSION >= NTDDI_WIN8)
232 if ((
Irp->Tail.Overlay.Thread !=
NULL) &&
235 OriginatingThread =
Irp->Tail.Overlay.Thread;
270 (
VOID)FatAcquireExclusiveFcb( IrpContext,
Fcb );
274 FatVerifyFcb( IrpContext,
Fcb );
301 FatFlushRequired =
TRUE;
310 while (NextFcb !=
NULL) {
318 FatVerifyFcb( IrpContext, NextFcb );
330 LocalStatus = FatFlushFile( IrpContext, NextFcb,
Flush );
339 FatFlushRequired =
TRUE;
351 if (FatFlushRequired) {
383 DebugTrace(0,
Dbg,
"Flush User Volume Open, or root dcb\n", 0);
392#pragma prefast( suppress:28931, "needed for debug build" )
447#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
469#if (NTDDI_VERSION >= NTDDI_WIN8)
508#if (NTDDI_VERSION >= NTDDI_WIN8)
567 ULONG CorrectedFileSize = 0;
585 ClearWriteThroughOnExit =
TRUE;
591 ClearWaitOnExit =
TRUE;
606 (
VOID)FatAcquireExclusiveFcb( IrpContext,
Fcb );
630 FatVerifyFcb( IrpContext,
Fcb );
656 FatTruncateFileAllocation( IrpContext,
671 FatGetDirentFromFcbOrDcb( IrpContext,
678 CorrectedFileSize =
Fcb->
Header.FileSize.LowPart;
681 if (
Dirent->FileSize != CorrectedFileSize) {
683 Dirent->FileSize = CorrectedFileSize;
754 FatVerifyFcb( IrpContext,
Fcb );
782 ReturnStatus = IrpContext->ExceptionStatus;
785 if (ClearWriteThroughOnExit) {
789 if (ClearWaitOnExit) {
794 DebugTrace(-1,
Dbg,
"FatFlushDirectory -> 0x%08lx\n", ReturnStatus);
879 if (
Vcb->AllocationSupport.FatIndexBitSize != 12) {
894 Page < NumberOfPages;
913 ReturnStatus =
Iosb.Status;
919 ReturnStatus = IrpContext->ExceptionStatus;
948 ReturnStatus =
Iosb.Status;
954 ReturnStatus = IrpContext->ExceptionStatus;
1036 return ReturnStatus;
1183 Irp->IoStatus.Status = 0;
1184 Irp->IoStatus.Information = 0;
1229 if (
Vcb->AllocationSupport.FatIndexBitSize == 12) {
1234 }
else if (
Vcb->AllocationSupport.FatIndexBitSize == 32) {
1253 IrpContext->OriginatingIrp,
1254 Vcb->TargetDeviceObject );
1300 IrpContext->OriginatingIrp,
1325 if (
Irp->PendingReturned ) {
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
VOID NTAPI CcUnpinRepinnedBcb(IN PVOID Bcb, IN BOOLEAN WriteThrough, OUT PIO_STATUS_BLOCK IoStatus)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
VOID NTAPI CcSetDirtyPinnedData(IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
VOID NTAPI CcRepinBcb(IN PVOID Bcb)
_In_ PFCB _In_ LONGLONG FileOffset
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define IRP_CONTEXT_FLAG_WAIT
#define _Requires_lock_held_(lock)
#define NT_SUCCESS(StatCode)
BOOLEAN NTAPI KeRemoveQueueDpc(IN PKDPC Dpc)
_In_ PIO_STACK_LOCATION IrpSp
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
#define FatReservedBytes(B)
#define FatBytesPerFat(B)
#define FatBugCheck(A, B, C)
#define PsGetCurrentThread()
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
#define ExAcquireResourceExclusiveLite(res, wait)
#define ClearFlag(_F, _SF)
#define IRP_CONTEXT_FLAG_WRITE_THROUGH
#define IsFileDeleted(Mcb)
VOID FatUnpinRepinnedBcbs(IN PIRP_CONTEXT IrpContext)
NTSTATUS FatToggleMediaEjectDisable(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN BOOLEAN PreventRemoval)
IO_COMPLETION_ROUTINE FatHijackCompletionRoutine
VOID FatFlushFatEntries(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG Cluster, IN ULONG Count)
NTSTATUS FatFlushFat(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
VOID FatFlushDirentForFile(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
IO_COMPLETION_ROUTINE FatFlushCompletionRoutine
NTSTATUS FatHijackIrpAndFlushDevice(IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN PDEVICE_OBJECT TargetDeviceObject)
LOGICAL FatDiskAccountingEnabled
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
#define DebugTrace(INDENT, LEVEL, X, Y)
#define FatVcbAcquiredExclusive(IRPCONTEXT, VCB)
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
PFCB FatGetNextFcbTopDown(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
#define FatUnpinBcb(IRPCONTEXT, BCB)
NTSTATUS FatFsdPostRequest(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
#define FatReleaseFcb(IRPCONTEXT, Fcb)
#define FatResetExceptionState(IRPCONTEXT)
#define FatAcquireExclusiveVcb(IC, V)
IN PFCB IN FAT_FLUSH_TYPE FlushType
enum _FAT_FLUSH_TYPE FAT_FLUSH_TYPE
#define FatNormalizeAndRaiseStatus(IRPCONTEXT, STATUS)
VOID FatVerifyVcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
#define FatReleaseVcb(IRPCONTEXT, Vcb)
VOID FatMarkFcbCondition(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN FCB_CONDITION FcbCondition, IN BOOLEAN Recursive)
PIRP_CONTEXT FatCreateIrpContext(IN PIRP Irp, IN BOOLEAN Wait)
#define VCB_STATE_FLAG_VOLUME_DIRTY
#define FCB_STATE_FLUSH_FAT
#define VCB_STATE_FLAG_DELETED_FCB
#define VCB_STATE_FLAG_REMOVABLE_MEDIA
#define VCB_STATE_FLAG_BOOT_OR_PAGING_FILE
#define VCB_STATE_FLAG_MOUNTED_DIRTY
#define VCB_STATE_FLAG_WRITE_PROTECTED
#define FCB_STATE_TRUNCATE_ON_CLOSE
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define EXCEPTION_EXECUTE_HANDLER
#define EXCEPTION_CONTINUE_SEARCH
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
#define _Function_class_(x)
#define _In_reads_opt_(size)
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
#define IoCopyCurrentIrpStackLocationToNext(Irp)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
BOOLEAN NTAPI IoIsSystemThread(IN PETHREAD Thread)
#define STATUS_FILE_INVALID
VOID NTAPI CcUnpinData(IN PVOID Bcb)
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
#define _SEH2_AbnormalTermination()
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
#define STATUS_MORE_PROCESSING_REQUIRED
FCB_CONDITION FcbCondition
FSRTL_ADVANCED_FCB_HEADER Header
VBO DirentOffsetWithinDirectory
SECTION_OBJECT_POINTERS SectionObjectPointers
PDEVICE_OBJECT TargetDeviceObject
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
#define STATUS_INVALID_DEVICE_REQUEST
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
#define FO_FILE_SIZE_CHANGED
#define IRP_MJ_FLUSH_BUFFERS