mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:03:00 +00:00
[NTFS]
- Create the volume FCB and save it in VCB. - Fix a memory leak svn path=/trunk/; revision=64288
This commit is contained in:
parent
2370abb48a
commit
17b30a2024
2 changed files with 21 additions and 0 deletions
|
@ -181,6 +181,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
PNTFS_INFO NtfsInfo = &DeviceExt->NtfsInfo;
|
PNTFS_INFO NtfsInfo = &DeviceExt->NtfsInfo;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PNTFS_FCB VolumeFcb;
|
||||||
|
PWSTR VolumeNameU;
|
||||||
|
|
||||||
DPRINT("NtfsGetVolumeData() called\n");
|
DPRINT("NtfsGetVolumeData() called\n");
|
||||||
|
|
||||||
|
@ -286,6 +288,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
MftRecord);
|
MftRecord);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
ExFreePool(VolumeRecord);
|
||||||
ExFreePool(MftRecord);
|
ExFreePool(MftRecord);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -308,12 +311,28 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
RtlCopyMemory(NtfsInfo->VolumeLabel,
|
RtlCopyMemory(NtfsInfo->VolumeLabel,
|
||||||
(PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset),
|
(PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset),
|
||||||
NtfsInfo->VolumeLabelLength);
|
NtfsInfo->VolumeLabelLength);
|
||||||
|
VolumeNameU = NtfsInfo->VolumeLabel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NtfsInfo->VolumeLabelLength = 0;
|
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 */
|
/* Get volume information */
|
||||||
Attribute = FindAttribute (VolumeRecord, AttributeVolumeInformation, NULL);
|
Attribute = FindAttribute (VolumeRecord, AttributeVolumeInformation, NULL);
|
||||||
DPRINT("Attribute %p\n", Attribute);
|
DPRINT("Attribute %p\n", Attribute);
|
||||||
|
|
|
@ -101,6 +101,8 @@ typedef struct
|
||||||
PDEVICE_OBJECT StorageDevice;
|
PDEVICE_OBJECT StorageDevice;
|
||||||
PFILE_OBJECT StreamFileObject;
|
PFILE_OBJECT StreamFileObject;
|
||||||
|
|
||||||
|
struct _FCB *VolumeFcb;
|
||||||
|
|
||||||
NTFS_INFO NtfsInfo;
|
NTFS_INFO NtfsInfo;
|
||||||
|
|
||||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;
|
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue