20#define FASTIO_DEBUG_LEVEL DL_NVR
25#pragma alloc_text(PAGE, Ext2FastIoRead)
26#pragma alloc_text(PAGE, Ext2FastIoWrite)
27#pragma alloc_text(PAGE, Ext2FastIoCheckIfPossible)
28#pragma alloc_text(PAGE, Ext2FastIoQueryBasicInfo)
29#pragma alloc_text(PAGE, Ext2FastIoQueryStandardInfo)
30#pragma alloc_text(PAGE, Ext2FastIoQueryNetworkOpenInfo)
31#pragma alloc_text(PAGE, Ext2FastIoLock)
32#pragma alloc_text(PAGE, Ext2FastIoUnlockSingle)
33#pragma alloc_text(PAGE, Ext2FastIoUnlockAll)
34#pragma alloc_text(PAGE, Ext2FastIoUnlockAll)
117 &
Fcb->FileLockAnchor,
128 &
Fcb->FileLockAnchor,
138 DEBUG(
DL_INF, (
"Ext2FastIIOCheckPossible: %s %s %wZ\n",
140 "FASTIO_CHECK_IF_POSSIBLE",
145 "Ext2FastIIOCheckPossible: Offset: %I64xg Length: %xh Key: %u %s %s\n",
150 "CheckForWriteOperation:"),
151 (bPossible ?
"Succeeded" :
"Failed")));
196 DEBUG(
DL_IO, (
"Ext2FastIoRead: %wZ Offset: %I64xh Length: %xh Key: %u Status: %d\n",
269 DEBUG(
DL_IO, (
"Ext2FastIoWrite: %wZ Offset: %I64xh Length: %xh Key: %xh Status=%d\n",
315 "Ext2FastIoQueryBasicInfo: %s %s %wZ\n",
317 "FASTIO_QUERY_BASIC_INFO",
327 FcbMainResourceAcquired =
TRUE;
342 Buffer->CreationTime =
Mcb->CreationTime;
343 Buffer->LastAccessTime =
Mcb->LastAccessTime;
344 Buffer->LastWriteTime =
Mcb->LastWriteTime;
347 if (
Buffer->FileAttributes == 0) {
362 if (FcbMainResourceAcquired) {
373 DEBUG(
DL_ERR, (
"Ext2FastIoQueryBasicInfo: %s %s Status: FALSE ***\n",
375 "FASTIO_QUERY_BASIC_INFO"));
380 "Ext2FastIoQueryBasicInfo: %s %s Status: %#x ***\n",
382 "FASTIO_QUERY_BASIC_INFO",
432 "Ext2FastIoQueryStandardInfo: %s %s %wZ\n",
434 "FASTIO_QUERY_STANDARD_INFO",
445 FcbMainResourceAcquired =
TRUE;
460 Buffer->NumberOfLinks =
Fcb->Inode->i_nlink;
465 Buffer->AllocationSize.QuadPart = 0;
466 Buffer->EndOfFile.QuadPart = 0;
476 DEBUG(
DL_INF, (
"Ext2FastIoQueryStandInfo: AllocatieonSize = %I64xh FileSize = %I64xh\n",
477 Buffer->AllocationSize.QuadPart,
Buffer->EndOfFile.QuadPart));
487 if (FcbMainResourceAcquired) {
497 "Ext2FastIoQueryStandardInfo: %s %s Status: FALSE ***\n",
499 "FASTIO_QUERY_STANDARD_INFO" ));
502 "Ext2FastIoQueryStandardInfo: %s %s Status: %#x ***\n",
504 "FASTIO_QUERY_STANDARD_INFO",
559 "Ext2FastIoLock: %s %s %wZ\n",
565 "Ext2FastIoLock: Offset: %I64xh Length: %I64xh Key: %u %s%s\n",
578 &
Fcb->FileLockAnchor,
606 "Ext2FastIoLock: %s %s *** Status: FALSE ***\n",
612 "Ext2FastIoLock: %s %s *** Status: %s (%#x) ***\n",
671 "Ext2FastIoUnlockSingle: %s %s %wZ\n",
673 "FASTIO_UNLOCK_SINGLE",
677 "Ext2FastIoUnlockSingle: Offset: %I64xh Length: %I64xh Key: %u\n",
688 &
Fcb->FileLockAnchor,
715 "Ext2FastIoUnlockSingle: %s %s *** Status: FALSE ***\n",
717 "FASTIO_UNLOCK_SINGLE" ));
720 "Ext2FastIoUnlockSingle: %s %s *** Status: %s (%#x) ***\n",
722 "FASTIO_UNLOCK_SINGLE",
773 "Ext2FastIoUnlockSingle: %s %s %wZ\n",
785 &
Fcb->FileLockAnchor,
808 "Ext2FastIoUnlockSingle: %s %s *** Status: FALSE ***\n",
814 "Ext2FastIoUnlockSingle: %s %s *** Status: %s (%#x) ***\n",
875 "Ext2FastIoUnlockAllByKey: %s %s %wZ\n",
877 "FASTIO_UNLOCK_ALL_BY_KEY",
882 "Ext2FastIoUnlockAllByKey: Key: %u\n",
892 &
Fcb->FileLockAnchor,
917 "Ext2FastIoUnlockAllByKey: %s %s *** Status: FALSE ***\n",
919 "FASTIO_UNLOCK_ALL_BY_KEY"
924 "Ext2FastIoUnlockAllByKey: %s %s *** Status: %s (%#x) ***\n",
926 "FASTIO_UNLOCK_ALL_BY_KEY",
981 "FASTIO_QUERY_NETWORK_OPEN_INFO",
999 FcbResourceAcquired =
TRUE;
1003 PFNOI->AllocationSize.QuadPart = 0;
1004 PFNOI->EndOfFile.QuadPart = 0;
1006 PFNOI->AllocationSize =
Fcb->
Header.AllocationSize;
1007 PFNOI->EndOfFile =
Fcb->
Header.FileSize;
1010 PFNOI->FileAttributes =
Mcb->FileAttr;
1011 if (PFNOI->FileAttributes == 0) {
1015 PFNOI->CreationTime =
Mcb->CreationTime;
1016 PFNOI->LastAccessTime =
Mcb->LastAccessTime;
1017 PFNOI->LastWriteTime =
Mcb->LastWriteTime;
1018 PFNOI->ChangeTime =
Mcb->ChangeTime;
1027 if (FcbResourceAcquired) {
1095 if (!ResourceAcquired) {
1100 Fcb, ResourceAcquired));
_In_ PFCB _In_ LONGLONG FileOffset
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define FILE_ATTRIBUTE_NORMAL
BOOLEAN Ext2FastIoRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoLock(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN BOOLEAN FailImmediately, IN BOOLEAN ExclusiveLock, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoQueryBasicInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoUnlockAllByKey(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
NTSTATUS Ext2ReleaseFileForModWrite(IN PFILE_OBJECT FileObject, IN PERESOURCE ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
VOID Ext2AcquireForCreateSection(IN PFILE_OBJECT FileObject)
BOOLEAN Ext2FastIoQueryStandardInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
NTSTATUS Ext2ReleaseFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
NTSTATUS Ext2PreAcquireForCreateSection(IN PFS_FILTER_CALLBACK_DATA cd, OUT PVOID *cc)
NTSTATUS Ext2AcquireFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoQueryNetworkOpenInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN OUT PFILE_NETWORK_OPEN_INFORMATION PFNOI, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoUnlockAll(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN Ext2FastIoCheckIfPossible(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN BOOLEAN CheckForReadOperation, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
VOID Ext2ReleaseForCreateSection(IN PFILE_OBJECT FileObject)
#define FASTIO_DEBUG_LEVEL
BOOLEAN Ext2FastIoUnlockSingle(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
NTSTATUS Ext2AcquireFileForModWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER EndingOffset, OUT PERESOURCE *ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
FAST_IO_POSSIBLE Ext2IsFastIoPossible(IN PEXT2_FCB Fcb)
#define ExAcquireResourceExclusiveLite(res, wait)
#define ExAcquireResourceSharedLite(res, wait)
#define Ext2GetCurrentProcessName()
#define VCB_VOLUME_LOCKED
#define IsVcbReadOnly(Vcb)
#define IsExt2FsDevice(DO)
#define FCB_DELETE_PENDING
struct _EXT2_FCB EXT2_FCB
#define IsWritingToEof(Pos)
struct _EXT2_CCB * PEXT2_CCB
struct _EXT2_FCB * PEXT2_FCB
PUCHAR Ext2NtStatusToString(IN NTSTATUS Status)
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
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)
NTSTATUS NTAPI FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL, IN BOOLEAN AlreadySynchronized)
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
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)
NTSTATUS NTAPI FsRtlFastUnlockAllByKey(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL)
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
#define FsRtlAreThereCurrentFileLocks(FL)
#define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)
enum _FAST_IO_POSSIBLE FAST_IO_POSSIBLE
#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
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
_In_ ULONG _In_ ULONG _In_ ULONG Length
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
BOOLEAN NTAPI FsRtlCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
BOOLEAN NTAPI FsRtlCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
#define STATUS_FILE_LOCKED_WITH_ONLY_READERS
#define STATUS_FILE_LOCKED_WITH_WRITERS
#define STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
NTFSIDENTIFIER Identifier
FSRTL_ADVANCED_FCB_HEADER Header
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFDPC _In_ BOOLEAN Wait
_In_ PLARGE_INTEGER _Out_ struct _ERESOURCE ** ResourceToRelease
_In_ PLARGE_INTEGER EndingOffset
#define FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION
#define PsGetCurrentProcess