2 * PROJECT: ReactOS Named Pipe FileSystem
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/filesystems/npfs/volinfo.c
5 * PURPOSE: Named Pipe FileSystem Volume Information
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
13 // File ID number for NPFS bugchecking support
14 #define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_VOLINFO)
16 /* FUNCTIONS ******************************************************************/
20 NpQueryFsVolumeInfo(IN PVOID Buffer
,
23 PFILE_FS_VOLUME_INFORMATION InfoBuffer
= Buffer
;
28 *Length
-= FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION
, VolumeLabel
);
30 InfoBuffer
->VolumeCreationTime
.QuadPart
= 0;
31 InfoBuffer
->VolumeSerialNumber
= 0;
32 InfoBuffer
->SupportsObjects
= 0;
35 InfoBuffer
->VolumeLabelLength
= 18;
39 NameLength
= (USHORT
)*Length
;
40 Status
= STATUS_BUFFER_OVERFLOW
;
44 Status
= STATUS_SUCCESS
;
47 RtlCopyMemory(InfoBuffer
->VolumeLabel
, L
"NamedPipe", NameLength
);
48 *Length
-= NameLength
;
50 TRACE("Leaving, Status = %lx\n", Status
);
56 NpQueryFsSizeInfo(IN PVOID Buffer
,
59 PFILE_FS_SIZE_INFORMATION InfoBuffer
= Buffer
;
62 *Length
-= sizeof(*InfoBuffer
);
64 InfoBuffer
->TotalAllocationUnits
.QuadPart
= 0;
65 InfoBuffer
->AvailableAllocationUnits
.QuadPart
= 0;
66 InfoBuffer
->SectorsPerAllocationUnit
= 1;
67 InfoBuffer
->BytesPerSector
= 1;
69 TRACE("Leaving, Status = STATUS_SUCCESS\n");
70 return STATUS_SUCCESS
;
75 NpQueryFsDeviceInfo(IN PVOID Buffer
,
78 PFILE_FS_DEVICE_INFORMATION InfoBuffer
= Buffer
;
81 InfoBuffer
->DeviceType
= 0;
82 InfoBuffer
->Characteristics
= 0;
83 InfoBuffer
->DeviceType
= FILE_DEVICE_NAMED_PIPE
;
84 *Length
-= sizeof(*InfoBuffer
);
86 TRACE("Leaving, Status = STATUS_SUCCESS\n");
87 return STATUS_SUCCESS
;
92 NpQueryFsAttributeInfo(IN PVOID Buffer
,
95 PFILE_FS_ATTRIBUTE_INFORMATION InfoBuffer
= Buffer
;
100 NameLength
= (USHORT
)(*Length
- 12);
104 Status
= STATUS_BUFFER_OVERFLOW
;
110 Status
= STATUS_SUCCESS
;
113 InfoBuffer
->MaximumComponentNameLength
= 0xFFFFFFFF;
114 InfoBuffer
->FileSystemNameLength
= 8;
115 InfoBuffer
->FileSystemAttributes
= FILE_CASE_PRESERVED_NAMES
;
116 RtlCopyMemory(InfoBuffer
->FileSystemName
, L
"NPFS", NameLength
);
118 TRACE("Leaving, Status = %lx\n", Status
);
124 NpQueryFsFullSizeInfo(IN PVOID Buffer
,
125 IN OUT PULONG Length
)
127 PFILE_FS_FULL_SIZE_INFORMATION InfoBuffer
= Buffer
;
130 *Length
-= sizeof(*InfoBuffer
);
132 RtlZeroMemory(InfoBuffer
, sizeof(*InfoBuffer
));
134 TRACE("Leaving, Status = STATUS_SUCCESS\n");
135 return STATUS_SUCCESS
;
140 NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
143 PIO_STACK_LOCATION IoStack
;
144 FS_INFORMATION_CLASS InfoClass
;
151 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
152 Buffer
= Irp
->AssociatedIrp
.SystemBuffer
;
153 Length
= IoStack
->Parameters
.QueryVolume
.Length
;
154 InfoClass
= IoStack
->Parameters
.QueryVolume
.FsInformationClass
;
158 case FileFsVolumeInformation
:
159 Status
= NpQueryFsVolumeInfo(Buffer
, &Length
);
161 case FileFsSizeInformation
:
162 Status
= NpQueryFsSizeInfo(Buffer
, &Length
);
164 case FileFsDeviceInformation
:
165 Status
= NpQueryFsDeviceInfo(Buffer
, &Length
);
167 case FileFsAttributeInformation
:
168 Status
= NpQueryFsAttributeInfo(Buffer
, &Length
);
170 case FileFsFullSizeInformation
:
171 Status
= NpQueryFsFullSizeInfo(Buffer
, &Length
);
174 Status
= STATUS_NOT_SUPPORTED
;
178 Irp
->IoStatus
.Information
= IoStack
->Parameters
.QueryVolume
.Length
- Length
;
179 TRACE("Leaving, Status = %lx\n", Status
);
185 NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
192 FsRtlEnterFileSystem();
193 NpAcquireSharedVcb();
195 Status
= NpCommonQueryVolumeInformation(DeviceObject
, Irp
);
198 FsRtlExitFileSystem();
200 if (Status
!= STATUS_PENDING
)
202 Irp
->IoStatus
.Status
= Status
;
203 IoCompleteRequest(Irp
, IO_NAMED_PIPE_INCREMENT
);
206 TRACE("Leaving, Status = %lx\n", Status
);