ReactOS 0.4.15-dev-8241-g63935f8
finfo.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: drivers/filesystems/msfs/finfo.c
5 * PURPOSE: Mailslot filesystem
6 * PROGRAMMER: Eric Kohl
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include "msfs.h"
12
13#define NDEBUG
14#include <debug.h>
15
16#undef MAILSLOT_NO_MESSAGE
17#undef MAILSLOT_WAIT_FOREVER
18#define MAILSLOT_NO_MESSAGE MAXULONG
19#define MAILSLOT_WAIT_FOREVER MAXULONG
20
21/* FUNCTIONS *****************************************************************/
22
23static NTSTATUS
27{
28 KIRQL oldIrql;
29
32
33 Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
34 Buffer->ReadTimeout = Fcb->TimeOut;
35
36 KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
37 Buffer->MessagesAvailable = Fcb->MessageCount;
38 if (Fcb->MessageCount == 0)
39 {
40 Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
41 }
42 else
43 {
44 PMSFS_MESSAGE Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
46 MessageListEntry);
47 Buffer->NextMessageSize = Message->Size;
48 }
49 KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
50
52
53 return STATUS_SUCCESS;
54}
55
56
57static NTSTATUS
61{
64
65 Fcb->TimeOut = *Buffer->ReadTimeout;
66
67 return STATUS_SUCCESS;
68}
69
70
73 PIRP Irp)
74{
75 PIO_STACK_LOCATION IoStack;
80 PVOID SystemBuffer;
83
84 DPRINT("MsfsQueryInformation(DeviceObject %p Irp %p)\n",
86
88 FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
89 FileObject = IoStack->FileObject;
90 Fcb = (PMSFS_FCB)FileObject->FsContext;
91 Ccb = (PMSFS_CCB)FileObject->FsContext2;
92
93 DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
94
95 /* querying information is not permitted on client side */
96 if (Fcb->ServerCcb != Ccb)
97 {
99
100 Irp->IoStatus.Status = Status;
101 Irp->IoStatus.Information = 0;
102
104
105 return Status;
106 }
107
108 SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
109 BufferLength = IoStack->Parameters.QueryFile.Length;
110
111 switch (FileInformationClass)
112 {
115 SystemBuffer,
116 &BufferLength);
117 break;
118
119 default:
121 }
122
123 Irp->IoStatus.Status = Status;
124 if (NT_SUCCESS(Status))
125 Irp->IoStatus.Information =
126 IoStack->Parameters.QueryFile.Length - BufferLength;
127 else
128 Irp->IoStatus.Information = 0;
130
131 return Status;
132}
133
134
137 PIRP Irp)
138{
139 PIO_STACK_LOCATION IoStack;
144 PVOID SystemBuffer;
147
148 DPRINT("MsfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
149
151 FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
152 FileObject = IoStack->FileObject;
153 Fcb = (PMSFS_FCB)FileObject->FsContext;
154 Ccb = (PMSFS_CCB)FileObject->FsContext2;
155
156 DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
157
158 /* setting information is not permitted on client side */
159 if (Fcb->ServerCcb != Ccb)
160 {
162
163 Irp->IoStatus.Status = Status;
164 Irp->IoStatus.Information = 0;
165
167
168 return Status;
169 }
170
171 SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
172 BufferLength = IoStack->Parameters.QueryFile.Length;
173
174 DPRINT("FileInformationClass %d\n", FileInformationClass);
175 DPRINT("SystemBuffer %p\n", SystemBuffer);
176
177 switch (FileInformationClass)
178 {
181 SystemBuffer,
182 &BufferLength);
183 break;
184
185 default:
187 }
188
189 Irp->IoStatus.Status = Status;
190 Irp->IoStatus.Information = 0;
192
193 return Status;
194}
195
196/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR Message[]
Definition: register.c:74
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
@ FileMailslotSetInformation
Definition: from_kernel.h:88
@ FileMailslotQueryInformation
Definition: from_kernel.h:87
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
Status
Definition: gdiplustypes.h:25
struct _FILE_MAILSLOT_QUERY_INFORMATION FILE_MAILSLOT_QUERY_INFORMATION
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
static NTSTATUS MsfsQueryMailslotInformation(PMSFS_FCB Fcb, PFILE_MAILSLOT_QUERY_INFORMATION Buffer, PULONG BufferLength)
Definition: finfo.c:24
static NTSTATUS MsfsSetMailslotInformation(PMSFS_FCB Fcb, PFILE_MAILSLOT_SET_INFORMATION Buffer, PULONG BufferLength)
Definition: finfo.c:58
#define MAILSLOT_NO_MESSAGE
Definition: finfo.c:18
DRIVER_DISPATCH MsfsQueryInformation
Definition: msfs.h:86
#define DEFAULTAPI
Definition: msfs.h:15
DRIVER_DISPATCH MsfsSetInformation
Definition: msfs.h:89
struct _MSFS_FCB * PMSFS_FCB
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:73
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
union _IO_STACK_LOCATION::@1573 Parameters
struct _IO_STACK_LOCATION::@3991::@4000 QueryFile
Definition: msfs.h:55
Definition: msfs.h:25
uint32_t * PULONG
Definition: typedefs.h:59
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
#define IO_NO_INCREMENT
Definition: iotypes.h:598
* PFILE_OBJECT
Definition: iotypes.h:1998