22#define BugCheckFileId (FAT_BUG_CHECK_FATDATA)
28#define Dbg (DEBUG_TRACE_CATCH_EXCEPTIONS)
34#pragma alloc_text(PAGE, FatBugCheckExceptionFilter)
38#pragma alloc_text(PAGE, FatCompleteRequest_Real)
39#pragma alloc_text(PAGE, FatFastIoCheckIfPossible)
40#pragma alloc_text(PAGE, FatFastQueryBasicInfo)
41#pragma alloc_text(PAGE, FatFastQueryNetworkOpenInfo)
42#pragma alloc_text(PAGE, FatFastQueryStdInfo)
43#pragma alloc_text(PAGE, FatIsIrpTopLevel)
44#pragma alloc_text(PAGE, FatPopUpFileCorrupt)
45#pragma alloc_text(PAGE, FatProcessException)
54#pragma prefast( suppress:22112, "only applies to user mode processes" )
94#pragma prefast( suppress:22112, "only applies to user mode processes" )
134LONG FatDebugTraceLevel = 0x00000009;
135LONG FatDebugTraceIndent = 0;
137ULONG FatFsdEntryCount = 0;
138ULONG FatFspEntryCount = 0;
139ULONG FatIoCallDriverCount = 0;
141LONG FatPerformanceTimerLevel = 0x00000000;
143ULONG FatTotalTicks[32] = { 0 };
159NTSTATUS FatBreakOnInterestingExceptionStatus = 0;
160NTSTATUS FatBreakOnInterestingIrpCompletion = 0;
167FatBugCheckExceptionFilter (
195 (
ULONG_PTR)ExceptionPointer->ContextRecord,
196 (
ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
232 ExceptionCode = ExceptionPointer->ExceptionRecord->ExceptionCode;
238 if( FatBreakOnInterestingExceptionStatus != 0 &&
ExceptionCode == FatBreakOnInterestingExceptionStatus ) {
250 if (ExceptionPointer->ExceptionRecord->NumberParameters >= 3) {
264#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
267 (
ULONG_PTR)ExceptionPointer->ContextRecord,
268 (
ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
288 if ( IrpContext->ExceptionStatus == 0 ) {
299#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
302 (
ULONG_PTR)ExceptionPointer->ContextRecord,
303 (
ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
352 ULONG SavedFlags = 0;
404 SavedFlags = IrpContext->Flags;
414 IrpContext->Flags = SavedFlags;
440 IrpContext->ExceptionStatus = 0;
442 IrpContext->Flags = SavedFlags;
521 if (IrpContext->Vcb) {
523 Device = IrpContext->Vcb->Vpb->RealDevice;
531 Device = IrpContext->RealDevice;
550 return FatPerformVerify( IrpContext,
Irp,
Device );
591 if ( RealDevice ==
NULL ) {
607 if (IrpContext->Vcb) {
609 RealDevice = IrpContext->Vcb->Vpb->RealDevice;
617 RealDevice = IrpContext->RealDevice;
624 if (RealDevice ==
NULL) {
665 Vcb = IrpContext->Vcb;
714 FatMarkVolume( IrpContext,
Vcb, TransitionState );
761 if ( (FatBreakOnInterestingIrpCompletion != 0) && (
Status == FatBreakOnInterestingIrpCompletion) ) {
772 if (IrpContext !=
NULL) {
785 if (IrpContext !=
NULL) {
805 Irp->IoStatus.Information = 0;
860FatFastIoCheckIfPossible (
969FatFastQueryBasicInfo (
1071 Buffer->FileAttributes = 0;
1093 Buffer->ChangeTime.QuadPart = 0;
1098 Buffer->LastWriteTime.QuadPart = 0;
1099 Buffer->CreationTime.QuadPart = 0;
1100 Buffer->LastAccessTime.QuadPart = 0;
1101 Buffer->ChangeTime.QuadPart = 0;
1120 if (
Buffer->FileAttributes == 0) {
1149FatFastQueryStdInfo (
1252 Buffer->NumberOfLinks = 1;
1310FatFastQueryNetworkOpenInfo (
1460 if (
Buffer->FileAttributes == 0) {
1508FatPopUpFileCorrupt (
1551 FatSetFullFileNameInFcb( IrpContext,
Fcb );
1566 Thread = IrpContext->OriginatingIrp->Tail.Overlay.Thread;
1568 Thread = (
PKTHREAD)IrpContext->OriginatingIrp->Tail.Overlay.Thread;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_EA_LIST_INCONSISTENT
VOID NTAPI CcMdlWriteAbort(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
_In_ PFCB _In_ LONGLONG FileOffset
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
_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 IRP_CONTEXT_FLAG_DISABLE_POPUPS
#define _Requires_lock_held_(lock)
#define NT_SUCCESS(StatCode)
#define FILE_ATTRIBUTE_NORMAL
_In_ PIO_STACK_LOCATION IrpSp
#define FatBugCheck(A, B, C)
#define FAT_NTC_IRP_CONTEXT
#define ExLocalTimeToSystemTime(LocTime, SysTime)
#define PsGetCurrentThread()
#define KeGetCurrentIrql()
#define ExAcquireResourceSharedLite(res, wait)
#define ClearFlag(_F, _SF)
#define BooleanFlagOn(F, SF)
VOID FatUnpinRepinnedBcbs(IN PIRP_CONTEXT IrpContext)
NPAGED_LOOKASIDE_LIST FatNonPagedFcbLookasideList
FAST_MUTEX FatCloseQueueMutex
PDEVICE_OBJECT FatDiskFileSystemDeviceObject
LARGE_INTEGER FatJanOne1980
LARGE_INTEGER FatDecThirtyOne1979
LARGE_INTEGER Fat30Milliseconds
FAT_TIME_STAMP FatTimeJanOne1980
SLIST_HEADER FatCloseContextSList
LOGICAL FatDiskAccountingEnabled
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
LARGE_INTEGER FatMaxLarge
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
LARGE_INTEGER FatLargeZero
NPAGED_LOOKASIDE_LIST FatIrpContextLookasideList
LARGE_INTEGER FatMagic10000
NPAGED_LOOKASIDE_LIST FatEResourceLookasideList
FAST_IO_DISPATCH FatFastIoDispatch
LARGE_INTEGER FatMagic86400000
VOID FatCompleteRequest_Real(IN PIRP_CONTEXT IrpContext OPTIONAL, IN PIRP Irp OPTIONAL, IN NTSTATUS Status)
LARGE_INTEGER Fat100Milliseconds
PDEVICE_OBJECT FatCdromFileSystemDeviceObject
#define DebugDump(STR, LEVEL, PTR)
#define DebugTrace(INDENT, LEVEL, X, Y)
@ VolumeDirtyWithSurfaceTest
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
#define FatDeleteIrpContext(IRPCONTEXT)
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)
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
#define FatDeviceIsFatFsdo(D)
#define FatResetExceptionState(IRPCONTEXT)
#define FatAcquireExclusiveVcbNoOpCheck(IC, V)
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
enum _FAT_VOLUME_STATE FAT_VOLUME_STATE
#define FatReleaseVcb(IRPCONTEXT, Vcb)
#define IRP_CONTEXT_FLAG_RECURSIVE_CALL
#define VCB_STATE_FLAG_MOUNTED_DIRTY
#define FCB_STATE_TEMPORARY
#define VCB_STATE_FLAG_WRITE_PROTECTED
#define FCB_STATE_DELETE_ON_CLOSE
#define FCB_LOOKUP_ALLOCATIONSIZE_HINT
#define FCB_STATE_PAGING_FILE
#define IRP_CONTEXT_FLAG_DISABLE_WRITE_THROUGH
BOOLEAN NTAPI FsRtlFastCheckLockForWrite(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
BOOLEAN NTAPI FsRtlFastCheckLockForRead(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define FSRTL_CACHE_TOP_LEVEL_IRP
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define EXCEPTION_EXECUTE_HANDLER
#define FILE_STANDARD_INFORMATION
#define FILE_BASIC_INFORMATION
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define _Function_class_(n)
struct _KTHREAD * PKTHREAD
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_ATTRIBUTE_TEMPORARY
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define ARGUMENT_PRESENT(ArgumentPointer)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
BOOLEAN NTAPI FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus)
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
VOID NTAPI IoRaiseHardError(IN PIRP Irp, IN PVPB Vpb, IN PDEVICE_OBJECT RealDeviceObject)
BOOLEAN NTAPI IoRaiseInformationalHardError(IN NTSTATUS ErrorStatus, IN PUNICODE_STRING String, IN PKTHREAD Thread)
#define IoCompleteRequest
PIRP NTAPI IoGetTopLevelIrp(VOID)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
VOID NTAPI IoSetDeviceToVerify(IN PETHREAD Thread, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN NTAPI IoIsSystemThread(IN PETHREAD Thread)
PDEVICE_OBJECT NTAPI IoGetDeviceToVerify(IN PETHREAD Thread)
BOOLEAN NTAPI KeAreAllApcsDisabled(VOID)
#define STATUS_FILE_LOCK_CONFLICT
#define STATUS_INVALID_EA_NAME
#define STATUS_EA_CORRUPT_ERROR
#define STATUS_NO_EAS_ON_FILE
#define STATUS_IN_PAGE_ERROR
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
PULONG MinorVersion OPTIONAL
UNICODE_STRING FullFileName
FCB_CONDITION FcbCondition
LARGE_INTEGER LastWriteTime
FSRTL_ADVANCED_FCB_HEADER Header
LARGE_INTEGER LastAccessTime
struct _FCB::@731::@734 Fcb
union _FCB::@731 Specific
PDEVICE_OBJECT DeviceObject
#define RtlZeroMemory(Destination, Length)
#define STATUS_DRIVER_INTERNAL_ERROR
#define STATUS_DISK_CORRUPT_ERROR
#define STATUS_VERIFY_REQUIRED
#define STATUS_FILE_CORRUPT_ERROR
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFDPC _In_ BOOLEAN Wait
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
#define IoIsErrorUserInduced(Status)
#define IRP_INPUT_OPERATION
#define IO_DISK_INCREMENT
#define IRP_MN_COMPLETE_MDL
#define PsGetCurrentProcess