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
-= sizeof(*InfoBuffer
);
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
"Named Pipe", 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
;
83 if (*Length
>= sizeof(*InfoBuffer
))
85 InfoBuffer
->DeviceType
= 0;
86 InfoBuffer
->Characteristics
= 0;
87 InfoBuffer
->DeviceType
= FILE_DEVICE_NAMED_PIPE
;
88 *Length
-= sizeof(*InfoBuffer
);
89 Status
= STATUS_SUCCESS
;
93 Status
= STATUS_BUFFER_OVERFLOW
;
95 TRACE("Leaving, Status = %lx\n", Status
);
101 NpQueryFsAttributeInfo(IN PVOID Buffer
,
102 IN OUT PULONG Length
)
104 PFILE_FS_ATTRIBUTE_INFORMATION InfoBuffer
= Buffer
;
109 NameLength
= (USHORT
)(*Length
- 12);
113 Status
= STATUS_BUFFER_OVERFLOW
;
119 Status
= STATUS_SUCCESS
;
122 InfoBuffer
->MaximumComponentNameLength
= 0xFFFFFFFF;
123 InfoBuffer
->FileSystemNameLength
= 8;
124 InfoBuffer
->FileSystemAttributes
= FILE_CASE_PRESERVED_NAMES
;
125 RtlCopyMemory(InfoBuffer
->FileSystemName
, L
"NPFS", NameLength
);
127 TRACE("Leaving, Status = %lx\n", Status
);
133 NpQueryFsFullSizeInfo(IN PVOID Buffer
,
134 IN OUT PULONG Length
)
136 PFILE_FS_FULL_SIZE_INFORMATION InfoBuffer
= Buffer
;
139 *Length
-= sizeof(*InfoBuffer
);
141 RtlZeroMemory(InfoBuffer
, sizeof(*InfoBuffer
));
143 TRACE("Leaving, Status = STATUS_SUCCESS\n");
144 return STATUS_SUCCESS
;
149 NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
152 PIO_STACK_LOCATION IoStack
;
153 FS_INFORMATION_CLASS InfoClass
;
160 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
161 Buffer
= Irp
->AssociatedIrp
.SystemBuffer
;
162 Length
= IoStack
->Parameters
.QueryVolume
.Length
;
163 InfoClass
= IoStack
->Parameters
.QueryVolume
.FsInformationClass
;
167 case FileFsVolumeInformation
:
168 Status
= NpQueryFsVolumeInfo(Buffer
, &Length
);
170 case FileFsSizeInformation
:
171 Status
= NpQueryFsSizeInfo(Buffer
, &Length
);
173 case FileFsDeviceInformation
:
174 Status
= NpQueryFsDeviceInfo(Buffer
, &Length
);
176 case FileFsAttributeInformation
:
177 Status
= NpQueryFsAttributeInfo(Buffer
, &Length
);
179 case FileFsFullSizeInformation
:
180 Status
= NpQueryFsFullSizeInfo(Buffer
, &Length
);
183 Status
= STATUS_NOT_SUPPORTED
;
187 Irp
->IoStatus
.Information
= IoStack
->Parameters
.QueryVolume
.Length
- Length
;
188 TRACE("Leaving, Status = %lx\n", Status
);
194 NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
201 FsRtlEnterFileSystem();
202 ExAcquireResourceSharedLite(&NpVcb
->Lock
, TRUE
);
204 Status
= NpCommonQueryVolumeInformation(DeviceObject
, Irp
);
206 ExReleaseResourceLite(&NpVcb
->Lock
);
207 FsRtlExitFileSystem();
209 if (Status
!= STATUS_PENDING
)
211 Irp
->IoStatus
.Status
= Status
;
212 IoCompleteRequest(Irp
, IO_NAMED_PIPE_INCREMENT
);
215 TRACE("Leaving, Status = %lx\n", Status
);