- Create the volume FCB and save it in VCB.
- Fix a memory leak

svn path=/trunk/; revision=64288
This commit is contained in:
Pierre Schweitzer 2014-09-25 20:15:00 +00:00
parent 2370abb48a
commit 17b30a2024
2 changed files with 21 additions and 0 deletions

View file

@ -181,6 +181,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
ULONG Size;
PNTFS_INFO NtfsInfo = &DeviceExt->NtfsInfo;
NTSTATUS Status;
PNTFS_FCB VolumeFcb;
PWSTR VolumeNameU;
DPRINT("NtfsGetVolumeData() called\n");
@ -286,6 +288,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
MftRecord);
if (!NT_SUCCESS(Status))
{
ExFreePool(VolumeRecord);
ExFreePool(MftRecord);
return Status;
}
@ -308,12 +311,28 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
RtlCopyMemory(NtfsInfo->VolumeLabel,
(PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset),
NtfsInfo->VolumeLabelLength);
VolumeNameU = NtfsInfo->VolumeLabel;
}
else
{
NtfsInfo->VolumeLabelLength = 0;
VolumeNameU = L"\0";
}
VolumeFcb = NtfsCreateFCB(VolumeNameU, DeviceExt);
if (VolumeFcb == NULL)
{
ExFreePool(VolumeRecord);
ExFreePool(MftRecord);
return STATUS_INSUFFICIENT_RESOURCES;
}
VolumeFcb->Flags = FCB_IS_VOLUME;
VolumeFcb->RFCB.FileSize.QuadPart = DeviceExt->NtfsInfo.SectorCount * DeviceExt->NtfsInfo.BytesPerSector;
VolumeFcb->RFCB.ValidDataLength = VolumeFcb->RFCB.FileSize;
VolumeFcb->RFCB.AllocationSize = VolumeFcb->RFCB.FileSize;
DeviceExt->VolumeFcb = VolumeFcb;
/* Get volume information */
Attribute = FindAttribute (VolumeRecord, AttributeVolumeInformation, NULL);
DPRINT("Attribute %p\n", Attribute);

View file

@ -101,6 +101,8 @@ typedef struct
PDEVICE_OBJECT StorageDevice;
PFILE_OBJECT StreamFileObject;
struct _FCB *VolumeFcb;
NTFS_INFO NtfsInfo;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;