196{
208
209 DPRINT(
"NtfsGetVolumeData() called\n");
210
215 0,
216 &DiskGeometry,
220 {
221 DPRINT(
"NtfsDeviceIoControl() failed (Status %lx)\n",
Status);
223 }
224
230 {
232 }
233
235 0,
236 1,
241 {
244 }
245
246
251 NtfsInfo->
ClusterCount = DeviceExt->NtfsInfo.SectorCount / (
ULONGLONG)DeviceExt->NtfsInfo.SectorsPerCluster;
252
258 else
260 if (
BootSector->EBPB.ClustersPerIndexRecord > 0)
262 else
264
265 DPRINT(
"Boot sector information:\n");
271 DPRINT(
" ClustersPerMftRecord: %lx\n",
BootSector->EBPB.ClustersPerMftRecord);
272 DPRINT(
" ClustersPerIndexRecord: %lx\n",
BootSector->EBPB.ClustersPerIndexRecord);
274
276
279
280 DeviceExt->MasterFileTable = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
281 if (DeviceExt->MasterFileTable ==
NULL)
282 {
285 }
286
291 (
PVOID)DeviceExt->MasterFileTable,
294 {
295 DPRINT1(
"Failed reading MFT.\n");
296 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, DeviceExt->MasterFileTable);
299 }
300
302 DeviceExt->MasterFileTable,
305 0,
306 &DeviceExt->MFTContext,
307 &DeviceExt->MftDataOffset);
309 {
310 DPRINT1(
"Can't find data attribute for Master File Table.\n");
311 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, DeviceExt->MasterFileTable);
314 }
315
316 VolumeRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
317 if (VolumeRecord ==
NULL)
318 {
319 DPRINT1(
"Allocation failed for volume record\n");
320 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, DeviceExt->MasterFileTable);
323 }
324
325
329 VolumeRecord);
331 {
332 DPRINT1(
"Failed reading volume file\n");
333 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, VolumeRecord);
334 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, DeviceExt->MasterFileTable);
337 }
338
339
341
342
344
345
347
349 {
350 Attribute = AttrCtxt->pRecord;
358 }
359 else
360 {
363 }
364
366 {
368 }
369
371 if (VolumeFcb ==
NULL)
372 {
373 DPRINT1(
"Failed allocating volume FCB\n");
374 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, VolumeRecord);
375 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, DeviceExt->MasterFileTable);
378 }
379
381 VolumeFcb->
RFCB.
FileSize.
QuadPart = DeviceExt->NtfsInfo.SectorCount * DeviceExt->NtfsInfo.BytesPerSector;
385 DeviceExt->VolumeFcb = VolumeFcb;
386
387
389
391 {
392 Attribute = AttrCtxt->pRecord;
395
399 }
400
402 {
404 }
405
406 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, VolumeRecord);
407
409
411}
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
VOID NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
@ AttributeVolumeInformation
#define ExAllocatePoolWithTag(hernya, size, tag)
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
struct _DISK_GEOMETRY DISK_GEOMETRY
NTSTATUS NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject, IN ULONG DiskSector, IN ULONG SectorCount, IN ULONG SectorSize, IN OUT PUCHAR Buffer, IN BOOLEAN Override)
NTSTATUS NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG ControlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize, IN BOOLEAN Override)
PNTFS_FCB NtfsCreateFCB(PCWSTR FileName, PCWSTR Stream, PNTFS_VCB Vcb)
static ULONG NtfsQueryMftZoneReservation(VOID)
struct NTFS_ATTR_RECORD::@169::@171 Resident
FSRTL_COMMON_FCB_HEADER RFCB
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH]
ULONG BytesPerIndexRecord
ULARGE_INTEGER MftMirrStart
struct _ULARGE_INTEGER::@4136 u
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
#define MAXIMUM_VOLUME_LABEL_LENGTH