mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:56:00 +00:00
[NTFS]
Implement GetVolumeBitmap(). This allows NFI to find which file is at which LCN: http://www.heisspiter.net/~Pierre/rostests/NTFS_NFI_LCN.png So far, NFI is not as verbose as it is on Windows in such cases, because FILE_OPEN_BY_FILE_ID is *still* unimplemented (you should consider implementing it Pierre ;-)). I checked with Windows, the correct file is found though! CORE-8725 svn path=/trunk/; revision=65645
This commit is contained in:
parent
37d3115479
commit
ecb8f375f8
1 changed files with 58 additions and 2 deletions
|
@ -666,6 +666,11 @@ GetVolumeBitmap(PDEVICE_EXTENSION DeviceExt,
|
||||||
PIO_STACK_LOCATION Stack;
|
PIO_STACK_LOCATION Stack;
|
||||||
PVOLUME_BITMAP_BUFFER BitmapBuffer;
|
PVOLUME_BITMAP_BUFFER BitmapBuffer;
|
||||||
LONGLONG StartingLcn;
|
LONGLONG StartingLcn;
|
||||||
|
PFILE_RECORD_HEADER BitmapRecord;
|
||||||
|
PNTFS_ATTR_CONTEXT DataContext;
|
||||||
|
ULONGLONG TotalClusters;
|
||||||
|
ULONGLONG ToCopy;
|
||||||
|
BOOLEAN Overflow = FALSE;
|
||||||
|
|
||||||
DPRINT1("GetVolumeBitmap(%p, %p)\n", DeviceExt, Irp);
|
DPRINT1("GetVolumeBitmap(%p, %p)\n", DeviceExt, Irp);
|
||||||
|
|
||||||
|
@ -722,8 +727,59 @@ GetVolumeBitmap(PDEVICE_EXTENSION DeviceExt,
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
/* Round down to a multiple of 8 */
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
StartingLcn = StartingLcn & ~7;
|
||||||
|
TotalClusters = DeviceExt->NtfsInfo.ClusterCount - StartingLcn;
|
||||||
|
ToCopy = TotalClusters / 8;
|
||||||
|
if ((ToCopy + FIELD_OFFSET(VOLUME_BITMAP_BUFFER, Buffer)) > Stack->Parameters.FileSystemControl.OutputBufferLength)
|
||||||
|
{
|
||||||
|
DPRINT1("Buffer too small: %x, needed: %x\n", Stack->Parameters.FileSystemControl.OutputBufferLength, (ToCopy + FIELD_OFFSET(VOLUME_BITMAP_BUFFER, Buffer)));
|
||||||
|
Overflow = TRUE;
|
||||||
|
ToCopy = Stack->Parameters.FileSystemControl.OutputBufferLength - FIELD_OFFSET(VOLUME_BITMAP_BUFFER, Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapRecord = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
|
DeviceExt->NtfsInfo.BytesPerFileRecord,
|
||||||
|
TAG_NTFS);
|
||||||
|
if (BitmapRecord == NULL)
|
||||||
|
{
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ReadFileRecord(DeviceExt, NTFS_FILE_BITMAP, BitmapRecord);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed reading volume bitmap: %lx\n", Status);
|
||||||
|
ExFreePoolWithTag(BitmapRecord, TAG_NTFS);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = FindAttribute(DeviceExt, BitmapRecord, AttributeData, L"", 0, &DataContext);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed find $DATA for bitmap: %lx\n", Status);
|
||||||
|
ExFreePoolWithTag(BitmapRecord, TAG_NTFS);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapBuffer->StartingLcn.QuadPart = StartingLcn;
|
||||||
|
BitmapBuffer->BitmapSize.QuadPart = ToCopy * 8;
|
||||||
|
|
||||||
|
Irp->IoStatus.Information = FIELD_OFFSET(VOLUME_BITMAP_BUFFER, Buffer);
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
Irp->IoStatus.Information += ReadAttribute(DeviceExt, DataContext, StartingLcn / 8, (PCHAR)BitmapBuffer->Buffer, ToCopy);
|
||||||
|
Status = (Overflow ? STATUS_BUFFER_OVERFLOW : STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
ReleaseAttributeContext(DataContext);
|
||||||
|
ExFreePoolWithTag(BitmapRecord, TAG_NTFS);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue