mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[NPFS]: Add support for a few more volume information classes, and disable APCs like an FS should.
svn path=/trunk/; revision=59914
This commit is contained in:
parent
084a679a6b
commit
675f4b0d71
1 changed files with 77 additions and 35 deletions
|
@ -15,73 +15,91 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static NTSTATUS
|
||||
NpfsQueryFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||
PULONG BufferLength)
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpQueryFsDeviceInformation(IN PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
|
||||
OUT PULONG BufferLength)
|
||||
{
|
||||
PAGED_CODE();
|
||||
DPRINT("NpfsQueryFsDeviceInformation()\n");
|
||||
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
|
||||
{
|
||||
*BufferLength = sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
|
||||
FsDeviceInfo->Characteristics = 0;
|
||||
|
||||
*BufferLength = sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
|
||||
|
||||
DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
NpfsQueryFsAttributeInformation(PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
PULONG BufferLength)
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpQueryFsFullSizeInfo(IN PFILE_FS_FULL_SIZE_INFORMATION FsSizeInfo,
|
||||
OUT PULONG BufferSize)
|
||||
{
|
||||
RtlZeroMemory(FsSizeInfo, sizeof(FILE_FS_FULL_SIZE_INFORMATION));
|
||||
*BufferSize -= sizeof(FILE_FS_FULL_SIZE_INFORMATION);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpQueryFsSizeInfo(IN PFILE_FS_SIZE_INFORMATION FsSizeInfo,
|
||||
OUT PULONG BufferSize)
|
||||
{
|
||||
FsSizeInfo->TotalAllocationUnits.LowPart = 0;
|
||||
FsSizeInfo->TotalAllocationUnits.HighPart = 0;
|
||||
FsSizeInfo->AvailableAllocationUnits.LowPart = 0;
|
||||
FsSizeInfo->AvailableAllocationUnits.HighPart = 0;
|
||||
FsSizeInfo->SectorsPerAllocationUnit = 1;
|
||||
FsSizeInfo->BytesPerSector = 1;
|
||||
*BufferSize -= sizeof(FILE_FS_SIZE_INFORMATION);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpQueryFsAttributeInformation(IN PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
|
||||
OUT PULONG BufferLength)
|
||||
{
|
||||
PAGED_CODE();
|
||||
DPRINT("NpfsQueryFsAttributeInformation() called.\n");
|
||||
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
|
||||
|
||||
if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
|
||||
{
|
||||
*BufferLength = (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
*BufferLength = 0;
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
|
||||
FsAttributeInfo->MaximumComponentNameLength = 255;
|
||||
FsAttributeInfo->MaximumComponentNameLength = -1;
|
||||
FsAttributeInfo->FileSystemNameLength = 8;
|
||||
wcscpy(FsAttributeInfo->FileSystemName,
|
||||
L"NPFS");
|
||||
wcscpy(FsAttributeInfo->FileSystemName, L"NPFS");
|
||||
|
||||
DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
|
||||
*BufferLength = (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NpfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp)
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpCommonQueryVolumeInformation(IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
FS_INFORMATION_CLASS FsInformationClass;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
|
||||
/* PRECONDITION */
|
||||
ASSERT(DeviceObject != NULL);
|
||||
ASSERT(Irp != NULL);
|
||||
|
||||
DPRINT("NpfsQueryVolumeInformation(DeviceObject %p, Irp %p)\n",
|
||||
DeviceObject,
|
||||
Irp);
|
||||
NTSTATUS Status;
|
||||
PAGED_CODE();
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
|
||||
|
@ -93,25 +111,49 @@ NpfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
switch (FsInformationClass)
|
||||
{
|
||||
case FileFsFullSizeInformation:
|
||||
Status = NpQueryFsFullSizeInfo(SystemBuffer, &BufferLength);
|
||||
break;
|
||||
case FileFsSizeInformation:
|
||||
Status = NpQueryFsSizeInfo(SystemBuffer, &BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsDeviceInformation:
|
||||
Status = NpfsQueryFsDeviceInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
Status = NpQueryFsDeviceInformation(SystemBuffer, &BufferLength);
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
Status = NpfsQueryFsAttributeInformation(SystemBuffer,
|
||||
&BufferLength);
|
||||
Status = NpQueryFsAttributeInformation(SystemBuffer, &BufferLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("Query not implemented: %d\n", FsInformationClass);
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = BufferLength;
|
||||
Irp->IoStatus.Information = Stack->Parameters.QueryVolume.Length - BufferLength;
|
||||
return Status;
|
||||
}
|
||||
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NpfsQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PAGED_CODE();
|
||||
DPRINT("NpfsQueryVolumeInformation(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
FsRtlEnterFileSystem();
|
||||
Status = NpCommonQueryVolumeInformation(Irp);
|
||||
FsRtlExitFileSystem();
|
||||
|
||||
if (Status != STATUS_PENDING)
|
||||
{
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue