ReactOS  0.4.13-dev-259-g5ca9c9c
volinfo.c
Go to the documentation of this file.
1 /*
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
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "npfs.h"
12 
13 // File ID number for NPFS bugchecking support
14 #define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_VOLINFO)
15 
16 /* FUNCTIONS ******************************************************************/
17 
19 NTAPI
22 {
25  USHORT NameLength;
26  TRACE("Entered\n");
27 
29 
30  InfoBuffer->VolumeCreationTime.QuadPart = 0;
31  InfoBuffer->VolumeSerialNumber = 0;
32  InfoBuffer->SupportsObjects = 0;
33 
34  NameLength = 18;
35  InfoBuffer->VolumeLabelLength = 18;
36 
37  if (*Length < 18)
38  {
39  NameLength = (USHORT)*Length;
41  }
42  else
43  {
45  }
46 
47  RtlCopyMemory(InfoBuffer->VolumeLabel, L"NamedPipe", NameLength);
48  *Length -= NameLength;
49 
50  TRACE("Leaving, Status = %lx\n", Status);
51  return Status;
52 }
53 
55 NTAPI
58 {
59  PFILE_FS_SIZE_INFORMATION InfoBuffer = Buffer;
60  TRACE("Entered\n");
61 
62  *Length -= sizeof(*InfoBuffer);
63 
64  InfoBuffer->TotalAllocationUnits.QuadPart = 0;
65  InfoBuffer->AvailableAllocationUnits.QuadPart = 0;
66  InfoBuffer->SectorsPerAllocationUnit = 1;
67  InfoBuffer->BytesPerSector = 1;
68 
69  TRACE("Leaving, Status = STATUS_SUCCESS\n");
70  return STATUS_SUCCESS;
71 }
72 
74 NTAPI
77 {
79  TRACE("Entered\n");
80 
81  InfoBuffer->DeviceType = 0;
82  InfoBuffer->Characteristics = 0;
83  InfoBuffer->DeviceType = FILE_DEVICE_NAMED_PIPE;
84  *Length -= sizeof(*InfoBuffer);
85 
86  TRACE("Leaving, Status = STATUS_SUCCESS\n");
87  return STATUS_SUCCESS;
88 }
89 
91 NTAPI
94 {
97  USHORT NameLength;
98  TRACE("Entered\n");
99 
100  NameLength = (USHORT)(*Length - 12);
101  if (NameLength < 8)
102  {
103  *Length = 0;
105  }
106  else
107  {
108  *Length -= 20;
109  NameLength = 8;
111  }
112 
113  InfoBuffer->MaximumComponentNameLength = 0xFFFFFFFF;
114  InfoBuffer->FileSystemNameLength = 8;
116  RtlCopyMemory(InfoBuffer->FileSystemName, L"NPFS", NameLength);
117 
118  TRACE("Leaving, Status = %lx\n", Status);
119  return Status;
120 }
121 
122 NTSTATUS
123 NTAPI
126 {
128  TRACE("Entered\n");
129 
130  *Length -= sizeof(*InfoBuffer);
131 
132  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
133 
134  TRACE("Leaving, Status = STATUS_SUCCESS\n");
135  return STATUS_SUCCESS;
136 }
137 
138 NTSTATUS
139 NTAPI
141  IN PIRP Irp)
142 {
143  PIO_STACK_LOCATION IoStack;
144  FS_INFORMATION_CLASS InfoClass;
145  ULONG Length;
146  PVOID Buffer;
148  PAGED_CODE();
149  TRACE("Entered\n");
150 
152  Buffer = Irp->AssociatedIrp.SystemBuffer;
153  Length = IoStack->Parameters.QueryVolume.Length;
154  InfoClass = IoStack->Parameters.QueryVolume.FsInformationClass;
155 
156  switch (InfoClass)
157  {
160  break;
163  break;
166  break;
169  break;
172  break;
173  default:
175  break;
176  }
177 
178  Irp->IoStatus.Information = IoStack->Parameters.QueryVolume.Length - Length;
179  TRACE("Leaving, Status = %lx\n", Status);
180  return Status;
181 }
182 
183 NTSTATUS
184 NTAPI
186  IN PIRP Irp)
187 {
189  PAGED_CODE();
190  TRACE("Entered\n");
191 
194 
196 
197  NpReleaseVcb();
199 
200  if (Status != STATUS_PENDING)
201  {
202  Irp->IoStatus.Status = Status;
204  }
205 
206  TRACE("Leaving, Status = %lx\n", Status);
207  return Status;
208 }
209 
210 /* EOF */
LARGE_INTEGER TotalAllocationUnits
Definition: from_kernel.h:263
#define IN
Definition: typedefs.h:38
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
NTSTATUS NTAPI NpQueryFsFullSizeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:124
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volinfo.c:185
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:122
#define FileFsFullSizeInformation
Definition: ntifs_ex.h:389
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NpQueryFsDeviceInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:75
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpQueryFsVolumeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:20
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
LARGE_INTEGER AvailableAllocationUnits
Definition: from_kernel.h:264
#define IoCompleteRequest
Definition: irp.c:1240
Definition: bufpool.h:45
enum _FSINFOCLASS FS_INFORMATION_CLASS
#define TRACE(s)
Definition: solgame.cpp:4
LARGE_INTEGER VolumeCreationTime
Definition: winioctl.h:408
#define STATUS_PENDING
Definition: ntstatus.h:82
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:571
NTSTATUS NTAPI NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volinfo.c:140
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NpQueryFsAttributeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:92
#define FILE_CASE_PRESERVED_NAMES
Definition: from_kernel.h:234
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
unsigned short USHORT
Definition: pedump.c:61
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:39
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI NpQueryFsSizeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:56
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2745
LONGLONG QuadPart
Definition: typedefs.h:112