ReactOS 0.4.16-dev-91-g764881a
finfo.c File Reference
#include "msfs.h"
#include <debug.h>
Include dependency graph for finfo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define MAILSLOT_NO_MESSAGE   MAXULONG
 
#define MAILSLOT_WAIT_FOREVER   MAXULONG
 

Functions

static NTSTATUS MsfsQueryMailslotInformation (PMSFS_FCB Fcb, PFILE_MAILSLOT_QUERY_INFORMATION Buffer, PULONG BufferLength)
 
static NTSTATUS MsfsSetMailslotInformation (PMSFS_FCB Fcb, PFILE_MAILSLOT_SET_INFORMATION Buffer, PULONG BufferLength)
 
NTSTATUS DEFAULTAPI MsfsQueryInformation (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS DEFAULTAPI MsfsSetInformation (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 

Macro Definition Documentation

◆ MAILSLOT_NO_MESSAGE

#define MAILSLOT_NO_MESSAGE   MAXULONG

Definition at line 18 of file finfo.c.

◆ MAILSLOT_WAIT_FOREVER

#define MAILSLOT_WAIT_FOREVER   MAXULONG

Definition at line 19 of file finfo.c.

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file finfo.c.

Function Documentation

◆ MsfsQueryInformation()

NTSTATUS DEFAULTAPI MsfsQueryInformation ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 72 of file finfo.c.

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}
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
_In_ PIRP Irp
Definition: csq.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
@ FileMailslotQueryInformation
Definition: from_kernel.h:87
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
Status
Definition: gdiplustypes.h:25
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
struct _MSFS_FCB * PMSFS_FCB
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define DPRINT
Definition: sndvol32.h:73
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _IO_STACK_LOCATION::@3974::@3983 QueryFile
union _IO_STACK_LOCATION::@1575 Parameters
Definition: msfs.h:55
Definition: msfs.h:25
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

◆ MsfsQueryMailslotInformation()

static NTSTATUS MsfsQueryMailslotInformation ( PMSFS_FCB  Fcb,
PFILE_MAILSLOT_QUERY_INFORMATION  Buffer,
PULONG  BufferLength 
)
static

Definition at line 24 of file finfo.c.

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}
Definition: bufpool.h:45
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
struct _FILE_MAILSLOT_QUERY_INFORMATION FILE_MAILSLOT_QUERY_INFORMATION
#define MAILSLOT_NO_MESSAGE
Definition: finfo.c:18
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by MsfsQueryInformation().

◆ MsfsSetInformation()

NTSTATUS DEFAULTAPI MsfsSetInformation ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 136 of file finfo.c.

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}
@ FileMailslotSetInformation
Definition: from_kernel.h:88
static NTSTATUS MsfsSetMailslotInformation(PMSFS_FCB Fcb, PFILE_MAILSLOT_SET_INFORMATION Buffer, PULONG BufferLength)
Definition: finfo.c:58

◆ MsfsSetMailslotInformation()

static NTSTATUS MsfsSetMailslotInformation ( PMSFS_FCB  Fcb,
PFILE_MAILSLOT_SET_INFORMATION  Buffer,
PULONG  BufferLength 
)
static

Definition at line 58 of file finfo.c.

61{
64
65 Fcb->TimeOut = *Buffer->ReadTimeout;
66
67 return STATUS_SUCCESS;
68}

Referenced by MsfsSetInformation().