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
.LowPart
= 0;
31 InfoBuffer
->VolumeCreationTime
.HighPart
= 0;
32 InfoBuffer
->VolumeSerialNumber
= 0;
33 InfoBuffer
->SupportsObjects
= 0;
36 InfoBuffer
->VolumeLabelLength
= 18;
40 NameLength
= (USHORT
)*Length
;
41 Status
= STATUS_BUFFER_OVERFLOW
;
45 Status
= STATUS_SUCCESS
;
48 RtlCopyMemory(InfoBuffer
->VolumeLabel
, L
"NamedPipe", NameLength
);
49 *Length
-= NameLength
;
51 TRACE("Leaving, Status = %lx\n", Status
);
57 NpQueryFsSizeInfo(IN PVOID Buffer
,
60 PFILE_FS_SIZE_INFORMATION InfoBuffer
= Buffer
;
63 *Length
-= sizeof(*InfoBuffer
);
65 InfoBuffer
->TotalAllocationUnits
.QuadPart
= 0;
66 InfoBuffer
->AvailableAllocationUnits
.QuadPart
= 0;
67 InfoBuffer
->SectorsPerAllocationUnit
= 1;
68 InfoBuffer
->BytesPerSector
= 1;
70 TRACE("Leaving, Status = STATUS_SUCCESS\n");
71 return STATUS_SUCCESS
;
76 NpQueryFsDeviceInfo(IN PVOID Buffer
,
79 PFILE_FS_DEVICE_INFORMATION InfoBuffer
= Buffer
;
82 InfoBuffer
->DeviceType
= 0;
83 InfoBuffer
->Characteristics
= 0;
84 InfoBuffer
->DeviceType
= FILE_DEVICE_NAMED_PIPE
;
85 *Length
-= sizeof(*InfoBuffer
);
87 TRACE("Leaving, Status = STATUS_SUCCESS\n");
88 return STATUS_SUCCESS
;
93 NpQueryFsAttributeInfo(IN PVOID Buffer
,
96 PFILE_FS_ATTRIBUTE_INFORMATION InfoBuffer
= Buffer
;
101 NameLength
= (USHORT
)(*Length
- 12);
105 Status
= STATUS_BUFFER_OVERFLOW
;
111 Status
= STATUS_SUCCESS
;
114 InfoBuffer
->MaximumComponentNameLength
= 0xFFFFFFFF;
115 InfoBuffer
->FileSystemNameLength
= 8;
116 InfoBuffer
->FileSystemAttributes
= FILE_CASE_PRESERVED_NAMES
;
117 RtlCopyMemory(InfoBuffer
->FileSystemName
, L
"NPFS", NameLength
);
119 TRACE("Leaving, Status = %lx\n", Status
);
125 NpQueryFsFullSizeInfo(IN PVOID Buffer
,
126 IN OUT PULONG Length
)
128 PFILE_FS_FULL_SIZE_INFORMATION InfoBuffer
= Buffer
;
131 *Length
-= sizeof(*InfoBuffer
);
133 RtlZeroMemory(InfoBuffer
, sizeof(*InfoBuffer
));
135 TRACE("Leaving, Status = STATUS_SUCCESS\n");
136 return STATUS_SUCCESS
;
141 NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
144 PIO_STACK_LOCATION IoStack
;
145 FS_INFORMATION_CLASS InfoClass
;
152 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
153 Buffer
= Irp
->AssociatedIrp
.SystemBuffer
;
154 Length
= IoStack
->Parameters
.QueryVolume
.Length
;
155 InfoClass
= IoStack
->Parameters
.QueryVolume
.FsInformationClass
;
159 case FileFsVolumeInformation
:
160 Status
= NpQueryFsVolumeInfo(Buffer
, &Length
);
162 case FileFsSizeInformation
:
163 Status
= NpQueryFsSizeInfo(Buffer
, &Length
);
165 case FileFsDeviceInformation
:
166 Status
= NpQueryFsDeviceInfo(Buffer
, &Length
);
168 case FileFsAttributeInformation
:
169 Status
= NpQueryFsAttributeInfo(Buffer
, &Length
);
171 case FileFsFullSizeInformation
:
172 Status
= NpQueryFsFullSizeInfo(Buffer
, &Length
);
175 Status
= STATUS_NOT_SUPPORTED
;
179 Irp
->IoStatus
.Information
= IoStack
->Parameters
.QueryVolume
.Length
- Length
;
180 TRACE("Leaving, Status = %lx\n", Status
);
186 NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
193 FsRtlEnterFileSystem();
194 ExAcquireResourceSharedLite(&NpVcb
->Lock
, TRUE
);
196 Status
= NpCommonQueryVolumeInformation(DeviceObject
, Irp
);
198 ExReleaseResourceLite(&NpVcb
->Lock
);
199 FsRtlExitFileSystem();
201 if (Status
!= STATUS_PENDING
)
203 Irp
->IoStatus
.Status
= Status
;
204 IoCompleteRequest(Irp
, IO_NAMED_PIPE_INCREMENT
);
207 TRACE("Leaving, Status = %lx\n", Status
);