48 DPRINT(
"NtfsGetFreeClusters(%p)\n", DeviceExt);
50 BitmapRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
51 if (BitmapRecord ==
NULL)
59 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
66 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
71 ASSERT((BitmapDataSize * 8) >= DeviceExt->NtfsInfo.ClusterCount);
76 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
81 for (;
Read < BitmapDataSize;
Read += DeviceExt->NtfsInfo.BytesPerSector)
87 DPRINT1(
"Total clusters: %I64x\n", DeviceExt->NtfsInfo.ClusterCount);
88 DPRINT1(
"Total clusters in bitmap: %I64x\n", BitmapDataSize * 8);
89 DPRINT1(
"Diff in size: %I64d B\n", ((BitmapDataSize * 8) - DeviceExt->NtfsInfo.ClusterCount) * DeviceExt->NtfsInfo.SectorsPerCluster * DeviceExt->NtfsInfo.BytesPerSector);
95 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
106 ULONG FirstDesiredCluster,
107 ULONG DesiredClusters,
108 PULONG FirstAssignedCluster,
121 DPRINT(
"NtfsAllocateClusters(%p, %lu, %lu, %p, %p)\n", DeviceExt, FirstDesiredCluster, DesiredClusters, FirstAssignedCluster, AssignedClusters);
123 BitmapRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
124 if (BitmapRecord ==
NULL)
132 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
139 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
144 BitmapDataSize =
min(BitmapDataSize, 0xffffffff);
145 ASSERT((BitmapDataSize * 8) >= DeviceExt->NtfsInfo.ClusterCount);
150 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
154 DPRINT(
"Total clusters: %I64x\n", DeviceExt->NtfsInfo.ClusterCount);
155 DPRINT(
"Total clusters in bitmap: %I64x\n", BitmapDataSize * 8);
156 DPRINT(
"Diff in size: %I64d B\n", ((BitmapDataSize * 8) - DeviceExt->NtfsInfo.ClusterCount) * DeviceExt->NtfsInfo.SectorsPerCluster * DeviceExt->NtfsInfo.BytesPerSector);
168 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
177 if (AssignedRun != 0xFFFFFFFF)
179 *FirstAssignedCluster = AssignedRun;
180 *AssignedClusters = DesiredClusters;
187 if (*AssignedClusters == 0)
200 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, BitmapRecord);
211 DPRINT(
"NtfsGetFsVolumeInformation() called\n");
217 DPRINT(
"Required length %lu\n",
219 DPRINT(
"LabelLength %hu\n",
245 DPRINT(
"NtfsGetFsVolumeInformation() done\n");
259 DPRINT(
"NtfsGetFsAttributeInformation()\n");
260 DPRINT(
"FsAttributeInfo = %p\n", FsAttributeInfo);
277 DPRINT(
"Finished NtfsGetFsAttributeInformation()\n");
295 DPRINT(
"NtfsGetFsSizeInformation()\n");
296 DPRINT(
"FsSizeInfo = %p\n", FsSizeInfo);
308 DPRINT(
"Finished NtfsGetFsSizeInformation()\n");
322 DPRINT(
"NtfsGetFsDeviceInformation()\n");
323 DPRINT(
"FsDeviceInfo = %p\n", FsDeviceInfo);
333 DPRINT(
"NtfsGetFsDeviceInformation() finished.\n");
354 DPRINT(
"NtfsQueryVolumeInformation() called\n");
371 SystemBuffer =
Irp->AssociatedIrp.SystemBuffer;
375 DPRINT(
"SystemBuffer %p\n", SystemBuffer);
410 Irp->IoStatus.Information =
413 Irp->IoStatus.Information = 0;
424 DPRINT(
"NtfsSetVolumeInformation() called\n");
430 Irp->IoStatus.Information = 0;
#define STATUS_NOT_SUPPORTED
#define RtlInitializeBitMap
#define RtlFindNextForwardRunClear
#define RtlFindClearBitsAndSet
#define RtlFindLongestRunClear
#define RtlNumberOfClearBits
#define NT_SUCCESS(StatCode)
NTSTATUS FreeClusters(PNTFS_VCB Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, ULONG ClustersToFree)
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
#define IRPCONTEXT_CANWAIT
#define ExAllocatePoolWithTag(hernya, size, tag)
#define ExAcquireResourceSharedLite(res, wait)
#define ROUND_UP(n, align)
#define BooleanFlagOn(F, SF)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ FS_INFORMATION_CLASS FsInformationClass
#define FILE_READ_ONLY_VOLUME
struct _FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION
@ FileFsDeviceInformation
@ FileFsAttributeInformation
@ FileFsVolumeInformation
struct _FILE_FS_SIZE_INFORMATION FILE_FS_SIZE_INFORMATION
enum _FSINFOCLASS FS_INFORMATION_CLASS
#define FILE_CASE_PRESERVED_NAMES
#define FILE_UNICODE_ON_DISK
NTSTATUS ReadFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG index, PFILE_RECORD_HEADER file)
VOID ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
ULONG ReadAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONG Length)
NTSTATUS WriteAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, const PUCHAR Buffer, ULONG Length, PULONG RealLengthWritten, PFILE_RECORD_HEADER FileRecord)
#define memcpy(s1, s2, n)
#define ExFreePoolWithTag(_P, _T)
static FsInfoType * FsVolumeInfo(char *fpath)
struct _FILE_FS_DEVICE_INFORMATION FILE_FS_DEVICE_INFORMATION
#define UNREFERENCED_PARAMETER(P)
static NTSTATUS NtfsGetFsDeviceInformation(PDEVICE_OBJECT DeviceObject, PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, PULONG BufferLength)
ULONGLONG NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt)
static NTSTATUS NtfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject, PFILE_FS_VOLUME_INFORMATION FsVolumeInfo, PULONG BufferLength)
static NTSTATUS NtfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt, PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo, PULONG BufferLength)
NTSTATUS NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
NTSTATUS NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
static NTSTATUS NtfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject, PFILE_FS_SIZE_INFORMATION FsSizeInfo, PULONG BufferLength)
NTSTATUS NtfsAllocateClusters(PDEVICE_EXTENSION DeviceExt, ULONG FirstDesiredCluster, ULONG DesiredClusters, PULONG FirstAssignedCluster, PULONG AssignedClusters)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
struct _FILE_FS_VOLUME_INFORMATION FILE_FS_VOLUME_INFORMATION
#define STATUS_BUFFER_OVERFLOW
PDEVICE_OBJECT DeviceObject
#define RtlZeroMemory(Destination, Length)
#define STATUS_INFO_LENGTH_MISMATCH
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack