ReactOS  0.4.15-dev-1074-gffc96d2
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->SupportsObjects = 0;
31 
32  NameLength = 18;
33  InfoBuffer->VolumeLabelLength = 18;
34 
35  if (*Length < 18)
36  {
37  NameLength = (USHORT)*Length;
39  }
40  else
41  {
43  }
44 
45  RtlCopyMemory(InfoBuffer->VolumeLabel, L"NamedPipe", NameLength);
46  *Length -= NameLength;
47 
48  TRACE("Leaving, Status = %lx\n", Status);
49  return Status;
50 }
51 
53 NTAPI
56 {
57  PFILE_FS_SIZE_INFORMATION InfoBuffer = Buffer;
58  TRACE("Entered\n");
59 
60  *Length -= sizeof(*InfoBuffer);
61 
62  InfoBuffer->SectorsPerAllocationUnit = 1;
63  InfoBuffer->BytesPerSector = 1;
64 
65  TRACE("Leaving, Status = STATUS_SUCCESS\n");
66  return STATUS_SUCCESS;
67 }
68 
70 NTAPI
73 {
75  TRACE("Entered\n");
76 
77  InfoBuffer->DeviceType = FILE_DEVICE_NAMED_PIPE;
78  *Length -= sizeof(*InfoBuffer);
79 
80  TRACE("Leaving, Status = STATUS_SUCCESS\n");
81  return STATUS_SUCCESS;
82 }
83 
85 NTAPI
88 {
91  USHORT NameLength;
92  TRACE("Entered\n");
93 
94  NameLength = (USHORT)(*Length - 12);
95  if (NameLength < 8)
96  {
97  *Length = 0;
99  }
100  else
101  {
102  *Length -= 20;
103  NameLength = 8;
105  }
106 
107  InfoBuffer->MaximumComponentNameLength = 0xFFFFFFFF;
108  InfoBuffer->FileSystemNameLength = 8;
110  RtlCopyMemory(InfoBuffer->FileSystemName, L"NPFS", NameLength);
111 
112  TRACE("Leaving, Status = %lx\n", Status);
113  return Status;
114 }
115 
116 NTSTATUS
117 NTAPI
120 {
122  TRACE("Entered\n");
123 
124  *Length -= sizeof(*InfoBuffer);
125 
126  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
127 
128  TRACE("Leaving, Status = STATUS_SUCCESS\n");
129  return STATUS_SUCCESS;
130 }
131 
132 NTSTATUS
133 NTAPI
135  IN PIRP Irp)
136 {
137  PIO_STACK_LOCATION IoStack;
138  FS_INFORMATION_CLASS InfoClass;
139  ULONG Length;
140  PVOID Buffer;
142  PAGED_CODE();
143  TRACE("Entered\n");
144 
146  Buffer = Irp->AssociatedIrp.SystemBuffer;
147  Length = IoStack->Parameters.QueryVolume.Length;
148  InfoClass = IoStack->Parameters.QueryVolume.FsInformationClass;
149 
151 
152  switch (InfoClass)
153  {
156  break;
159  break;
162  break;
165  break;
168  break;
169  default:
171  break;
172  }
173 
174  Irp->IoStatus.Information = IoStack->Parameters.QueryVolume.Length - Length;
175  TRACE("Leaving, Status = %lx\n", Status);
176  return Status;
177 }
178 
179 NTSTATUS
180 NTAPI
182  IN PIRP Irp)
183 {
185  PAGED_CODE();
186  TRACE("Entered\n");
187 
190 
192 
193  NpReleaseVcb();
195 
196  if (Status != STATUS_PENDING)
197  {
198  Irp->IoStatus.Status = Status;
200  }
201 
202  TRACE("Leaving, Status = %lx\n", Status);
203  return Status;
204 }
205 
206 /* EOF */
#define IN
Definition: typedefs.h:39
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:118
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volinfo.c:181
#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:71
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
#define IoCompleteRequest
Definition: irp.c:1240
Definition: bufpool.h:45
enum _FSINFOCLASS FS_INFORMATION_CLASS
#define TRACE(s)
Definition: solgame.cpp:4
#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:587
NTSTATUS NTAPI NpCommonQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volinfo.c:134
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NpQueryFsAttributeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:86
#define FILE_CASE_PRESERVED_NAMES
Definition: from_kernel.h:234
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned short USHORT
Definition: pedump.c:61
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:40
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
NTSTATUS NTAPI NpQueryFsSizeInfo(IN PVOID Buffer, IN OUT PULONG Length)
Definition: volinfo.c:54
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define PAGED_CODE()