ReactOS  0.4.14-dev-845-g8381e29
fileinfo.c File Reference
#include "npfs.h"
Include dependency graph for fileinfo.c:

Go to the source code of this file.

Macros

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_FILEINFO)
 

Functions

NTSTATUS NTAPI NpSetBasicInfo (IN PNP_CCB Ccb, IN PFILE_BASIC_INFORMATION Buffer)
 
NTSTATUS NTAPI NpSetPipeInfo (IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PFILE_PIPE_INFORMATION Buffer, IN ULONG NamedPipeEnd, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpCommonSetInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
 
NTSTATUS NTAPI NpFsdSetInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpQueryBasicInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
 
NTSTATUS NTAPI NpQueryStandardInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
 
NTSTATUS NTAPI NpQueryEaInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
 
NTSTATUS NTAPI NpQueryNameInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
 
NTSTATUS NTAPI NpQueryInternalInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
 
NTSTATUS NTAPI NpQueryPositionInfo (IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
 
NTSTATUS NTAPI NpQueryPipeLocalInfo (IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
 
NTSTATUS NTAPI NpQueryPipeInfo (IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
 
NTSTATUS NTAPI NpCommonQueryInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI NpFsdQueryInformation (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Macro Definition Documentation

◆ NPFS_BUGCHECK_FILE_ID

#define NPFS_BUGCHECK_FILE_ID   (NPFS_BUGCHECK_FILEINFO)

Definition at line 14 of file fileinfo.c.

Function Documentation

◆ NpCommonQueryInformation()

NTSTATUS NTAPI NpCommonQueryInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 370 of file fileinfo.c.

372 {
373  PIO_STACK_LOCATION IoStack;
374  NODE_TYPE_CODE NodeTypeCode;
375  ULONG NamedPipeEnd;
376  PNP_FCB Fcb;
377  PNP_CCB Ccb;
378  FILE_INFORMATION_CLASS InfoClass;
379  ULONG Length;
380  PVOID Buffer;
381  PFILE_ALL_INFORMATION AllInfo;
383  PAGED_CODE();
384 
386  NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
387  (PVOID*)&Fcb,
388  &Ccb,
389  &NamedPipeEnd);
390  if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
391 
392  Buffer = Irp->AssociatedIrp.SystemBuffer;
393  Length = IoStack->Parameters.QueryFile.Length;
394  InfoClass = IoStack->Parameters.QueryFile.FileInformationClass;
395 
396  if (NodeTypeCode != NPFS_NTC_CCB)
397  {
398  if (NodeTypeCode != NPFS_NTC_ROOT_DCB || InfoClass != FileNameInformation)
399  {
401  }
402  }
403 
404  switch (InfoClass)
405  {
406  case FileNameInformation:
408  break;
409 
411  Status = NpQueryPositionInfo(Ccb, Buffer, &Length, NamedPipeEnd);
412  break;
413 
414  case FilePipeInformation:
415  Status = NpQueryPipeInfo(Fcb, Ccb, Buffer, &Length, NamedPipeEnd);
416  break;
417 
419  Status = NpQueryPipeLocalInfo(Fcb, Ccb, Buffer, &Length, NamedPipeEnd);
420  break;
421 
424  break;
425 
427  Status = NpQueryStandardInfo(Ccb, Buffer, &Length, NamedPipeEnd);
428  break;
429 
432  break;
433 
434  case FileAllInformation:
435 
436  Length -= 12;
437  AllInfo = (PFILE_ALL_INFORMATION)Buffer;
439  NpQueryStandardInfo(Ccb, &AllInfo->StandardInformation, &Length, NamedPipeEnd);
441  NpQueryEaInfo(Ccb, &AllInfo->EaInformation, &Length);
442  NpQueryPositionInfo(Ccb, &AllInfo->PositionInformation, &Length, NamedPipeEnd);
444  Length += 96;
445  break;
446 
447  case FileEaInformation:
449  break;
450 
451  default:
453  break;
454  }
455 
456  Irp->IoStatus.Information = IoStack->Parameters.Read.Length - Length;
457  return Status;
458 }
NTSTATUS NTAPI NpQueryInternalInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
Definition: fileinfo.c:256
FILE_POSITION_INFORMATION PositionInformation
Definition: winternl.h:801
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpQueryNameInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
Definition: fileinfo.c:215
Definition: npfs.h:228
Definition: npfs.h:258
NTSTATUS NTAPI NpQueryStandardInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
Definition: fileinfo.c:159
Definition: bufpool.h:45
NTSTATUS NTAPI NpQueryPipeLocalInfo(IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
Definition: fileinfo.c:303
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
NTSTATUS NTAPI NpQueryEaInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
Definition: fileinfo.c:200
struct _FILE_ALL_INFORMATION * PFILE_ALL_INFORMATION
NTSTATUS NTAPI NpQueryBasicInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length)
Definition: fileinfo.c:143
NTSTATUS NTAPI NpQueryPipeInfo(IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
Definition: fileinfo.c:350
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
FILE_EA_INFORMATION EaInformation
Definition: winternl.h:799
FILE_NAME_INFORMATION NameInformation
Definition: winternl.h:804
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
NTSTATUS NTAPI NpQueryPositionInfo(IN PNP_CCB Ccb, IN PVOID Buffer, IN OUT PULONG Length, IN ULONG NamedPipeEnd)
Definition: fileinfo.c:271
#define FileStandardInformation
Definition: propsheet.cpp:61
unsigned int ULONG
Definition: retypes.h:1
FILE_BASIC_INFORMATION BasicInformation
Definition: winternl.h:796
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
Definition: fileobsup.c:20
FILE_INTERNAL_INFORMATION InternalInformation
Definition: winternl.h:798
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
FILE_STANDARD_INFORMATION StandardInformation
Definition: winternl.h:797

Referenced by NpFsdQueryInformation().

◆ NpCommonSetInformation()

NTSTATUS NTAPI NpCommonSetInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PLIST_ENTRY  List 
)

Definition at line 80 of file fileinfo.c.

83 {
84  NODE_TYPE_CODE NodeTypeCode;
85  PIO_STACK_LOCATION IoStack;
86  ULONG InfoClass;
87  PVOID Buffer;
88  PNP_FCB Fcb;
89  PNP_CCB Ccb;
90  ULONG NamedPipeEnd;
91  PAGED_CODE();
92 
94 
95  NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
96  (PVOID*)&Fcb,
97  &Ccb,
98  &NamedPipeEnd);
99  if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
100  if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_INVALID_PARAMETER;
101 
102  InfoClass = IoStack->Parameters.QueryFile.FileInformationClass;
103  Buffer = Irp->AssociatedIrp.SystemBuffer;
104 
105  if (InfoClass == FileBasicInformation) return NpSetBasicInfo(Ccb, Buffer);
106 
107  if (InfoClass != FilePipeInformation) return STATUS_INVALID_PARAMETER;
108 
109  return NpSetPipeInfo(Fcb, Ccb, Buffer, NamedPipeEnd, List);
110 }
NTSTATUS NTAPI NpSetPipeInfo(IN PNP_FCB Fcb, IN PNP_CCB Ccb, IN PFILE_PIPE_INFORMATION Buffer, IN ULONG NamedPipeEnd, IN PLIST_ENTRY List)
Definition: fileinfo.c:29
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:398
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define PAGED_CODE()
Definition: video.h:57
Definition: npfs.h:228
Definition: npfs.h:258
Definition: bufpool.h:45
LIST_ENTRY List
Definition: psmgr.c:57
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
unsigned int ULONG
Definition: retypes.h:1
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
Definition: fileobsup.c:20
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
NTSTATUS NTAPI NpSetBasicInfo(IN PNP_CCB Ccb, IN PFILE_BASIC_INFORMATION Buffer)
Definition: fileinfo.c:20
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by NpFsdSetInformation().

◆ NpFsdQueryInformation()

NTSTATUS NTAPI NpFsdQueryInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 462 of file fileinfo.c.

464 {
466  PAGED_CODE();
467 
470 
472 
473  NpReleaseVcb();
475 
476  if (Status != STATUS_PENDING)
477  {
478  Irp->IoStatus.Status = Status;
480  }
481 
482  return Status;
483 }
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
NTSTATUS NTAPI NpCommonQueryInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fileinfo.c:370

Referenced by DriverEntry().

◆ NpFsdSetInformation()

NTSTATUS NTAPI NpFsdSetInformation ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 114 of file fileinfo.c.

116 {
118  LIST_ENTRY DeferredList;
119  PAGED_CODE();
120 
121  InitializeListHead(&DeferredList);
122 
125 
126  Status = NpCommonSetInformation(DeviceObject, Irp, &DeferredList);
127 
128  NpReleaseVcb();
129  NpCompleteDeferredIrps(&DeferredList);
131 
132  if (Status != STATUS_PENDING)
133  {
134  Irp->IoStatus.Status = Status;
136  }
137 
138  return Status;
139 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI NpCommonSetInformation(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fileinfo.c:80
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:572
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356

Referenced by DriverEntry().

◆ NpQueryBasicInfo()

NTSTATUS NTAPI NpQueryBasicInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length 
)

Definition at line 143 of file fileinfo.c.

146 {
147  PFILE_BASIC_INFORMATION InfoBuffer = Buffer;
148 
149  *Length -= sizeof(*InfoBuffer);
150 
151  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
153 
154  return STATUS_SUCCESS;
155 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryEaInfo()

NTSTATUS NTAPI NpQueryEaInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length 
)

Definition at line 200 of file fileinfo.c.

203 {
204  PFILE_EA_INFORMATION InfoBuffer = Buffer;
205 
206  *Length -= sizeof(*InfoBuffer);
207 
208  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
209 
210  return STATUS_SUCCESS;
211 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryInternalInfo()

NTSTATUS NTAPI NpQueryInternalInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length 
)

Definition at line 256 of file fileinfo.c.

259 {
260  PFILE_INTERNAL_INFORMATION InfoBuffer = Buffer;
261 
262  *Length -= sizeof(*InfoBuffer);
263 
264  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
265 
266  return STATUS_SUCCESS;
267 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryNameInfo()

NTSTATUS NTAPI NpQueryNameInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length 
)

Definition at line 215 of file fileinfo.c.

218 {
219  PFILE_NAME_INFORMATION InfoBuffer = Buffer;
220  USHORT NameLength;
222  PWCHAR Name;
223 
224  *Length -= sizeof(*InfoBuffer);
225 
226  if (Ccb->NodeType == NPFS_NTC_ROOT_DCB_CCB)
227  {
228  NameLength = NpVcb->RootDcb->FullName.Length;
229  Name = NpVcb->RootDcb->FullName.Buffer;
230  }
231  else
232  {
233  NameLength = Ccb->Fcb->FullName.Length;
234  Name = Ccb->Fcb->FullName.Buffer;
235  }
236 
237  if (*Length < NameLength)
238  {
240  NameLength = (USHORT)*Length;
241  }
242  else
243  {
245  }
246 
247  RtlCopyMemory(InfoBuffer->FileName, Name, NameLength);
248  InfoBuffer->FileNameLength = NameLength;
249 
250  *Length -= NameLength;
251  return Status;
252 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _FCB::@710::@713 Fcb
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
struct NameRec_ * Name
Definition: cdprocs.h:464
#define NPFS_NTC_ROOT_DCB_CCB
Definition: npfs.h:117
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PNP_VCB NpVcb
Definition: strucsup.c:19
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned short USHORT
Definition: pedump.c:61
PNP_DCB RootDcb
Definition: npfs.h:281
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryPipeInfo()

NTSTATUS NTAPI NpQueryPipeInfo ( IN PNP_FCB  Fcb,
IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length,
IN ULONG  NamedPipeEnd 
)

Definition at line 350 of file fileinfo.c.

355 {
356  PFILE_PIPE_INFORMATION InfoBuffer = Buffer;
357 
358  *Length -= sizeof(*InfoBuffer);
359 
360  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
361 
362  InfoBuffer->ReadMode = Ccb->ReadMode[NamedPipeEnd];
363  InfoBuffer->CompletionMode = Ccb->CompletionMode[NamedPipeEnd];
364 
365  return STATUS_SUCCESS;
366 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryPipeLocalInfo()

NTSTATUS NTAPI NpQueryPipeLocalInfo ( IN PNP_FCB  Fcb,
IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length,
IN ULONG  NamedPipeEnd 
)

Definition at line 303 of file fileinfo.c.

308 {
310  PNP_DATA_QUEUE InQueue, OutQueue;
311 
312  *Length -= sizeof(*InfoBuffer);
313 
314  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
315 
316  InQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
317  OutQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
318 
319  InfoBuffer->NamedPipeType = Fcb->NamedPipeType;
320  InfoBuffer->NamedPipeConfiguration = Fcb->NamedPipeConfiguration;
321  InfoBuffer->MaximumInstances = Fcb->MaximumInstances;
322  InfoBuffer->CurrentInstances = Fcb->CurrentInstances;
323  InfoBuffer->InboundQuota = InQueue->Quota;
324  InfoBuffer->OutboundQuota = OutQueue->Quota;
325  InfoBuffer->NamedPipeState = Ccb->NamedPipeState;
326  InfoBuffer->NamedPipeEnd = NamedPipeEnd;
327 
328  if (NamedPipeEnd == FILE_PIPE_SERVER_END)
329  {
330  if (InQueue->QueueState == WriteEntries)
331  {
332  InfoBuffer->ReadDataAvailable = InQueue->BytesInQueue - InQueue->ByteOffset;
333  }
334  InfoBuffer->WriteQuotaAvailable = OutQueue->Quota - OutQueue->QuotaUsed;
335  }
336  else
337  {
338  if (OutQueue->QueueState == WriteEntries)
339  {
340  InfoBuffer->ReadDataAvailable = OutQueue->BytesInQueue - OutQueue->ByteOffset;
341  }
342  InfoBuffer->WriteQuotaAvailable = OutQueue->Quota - InQueue->QuotaUsed;
343  }
344 
345  return STATUS_SUCCESS;
346 }
ULONG Quota
Definition: npfs.h:144
ULONG QuotaUsed
Definition: npfs.h:142
ULONG QueueState
Definition: npfs.h:139
ULONG BytesInQueue
Definition: npfs.h:140
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG ByteOffset
Definition: npfs.h:143
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpQueryPositionInfo()

NTSTATUS NTAPI NpQueryPositionInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length,
IN ULONG  NamedPipeEnd 
)

Definition at line 271 of file fileinfo.c.

275 {
276  PNP_DATA_QUEUE DataQueue;
277  PFILE_POSITION_INFORMATION InfoBuffer = Buffer;
278 
279  *Length -= sizeof(*InfoBuffer);
280 
281  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
282 
283  if (NamedPipeEnd == FILE_PIPE_SERVER_END)
284  {
285  DataQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
286  }
287  else
288  {
289  DataQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
290  }
291 
292  if (DataQueue->QueueState == WriteEntries)
293  {
294  InfoBuffer->CurrentByteOffset.QuadPart = DataQueue->BytesInQueue -
295  DataQueue->ByteOffset;
296  }
297 
298  return STATUS_SUCCESS;
299 }
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
ULONG QueueState
Definition: npfs.h:139
ULONG BytesInQueue
Definition: npfs.h:140
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG ByteOffset
Definition: npfs.h:143
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by NpCommonQueryInformation().

◆ NpQueryStandardInfo()

NTSTATUS NTAPI NpQueryStandardInfo ( IN PNP_CCB  Ccb,
IN PVOID  Buffer,
IN OUT PULONG  Length,
IN ULONG  NamedPipeEnd 
)

Definition at line 159 of file fileinfo.c.

163 {
164  PNP_DATA_QUEUE DataQueue;
165  PFILE_STANDARD_INFORMATION InfoBuffer = Buffer;
166 
167  *Length -= sizeof(*InfoBuffer);
168 
169  RtlZeroMemory(InfoBuffer, sizeof(*InfoBuffer));
170 
171  if (NamedPipeEnd == FILE_PIPE_SERVER_END)
172  {
173  DataQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
174  }
175  else
176  {
177  DataQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
178  }
179 
180  InfoBuffer->AllocationSize.LowPart = Ccb->DataQueue[FILE_PIPE_INBOUND].Quota +
181  Ccb->DataQueue[FILE_PIPE_OUTBOUND].Quota;
182  InfoBuffer->AllocationSize.HighPart = 0;
183 
184  if (DataQueue->QueueState == WriteEntries)
185  {
186  InfoBuffer->EndOfFile.HighPart = 0;
187  InfoBuffer->EndOfFile.LowPart = DataQueue->BytesInQueue -
188  DataQueue->ByteOffset;
189  }
190 
191  InfoBuffer->Directory = FALSE;
192  InfoBuffer->NumberOfLinks = 1;
193  InfoBuffer->DeletePending = TRUE;
194 
195  return STATUS_SUCCESS;
196 }
#define TRUE
Definition: types.h:120
ULONG QueueState
Definition: npfs.h:139
ULONG BytesInQueue
Definition: npfs.h:140
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER AllocationSize
Definition: propsheet.cpp:54
ULONG ByteOffset
Definition: npfs.h:143
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
ULONG LowPart
Definition: typedefs.h:104
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonQueryInformation().

◆ NpSetBasicInfo()

NTSTATUS NTAPI NpSetBasicInfo ( IN PNP_CCB  Ccb,
IN PFILE_BASIC_INFORMATION  Buffer 
)

Definition at line 20 of file fileinfo.c.

22 {
23  PAGED_CODE();
24  return STATUS_SUCCESS;
25 }
#define PAGED_CODE()
Definition: video.h:57
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonSetInformation().

◆ NpSetPipeInfo()

NTSTATUS NTAPI NpSetPipeInfo ( IN PNP_FCB  Fcb,
IN PNP_CCB  Ccb,
IN PFILE_PIPE_INFORMATION  Buffer,
IN ULONG  NamedPipeEnd,
IN PLIST_ENTRY  List 
)

Definition at line 29 of file fileinfo.c.

34 {
36  PNP_DATA_QUEUE ReadQueue, WriteQueue;
37  PAGED_CODE();
38 
39  if (Buffer->ReadMode == FILE_PIPE_MESSAGE_MODE && Fcb->NamedPipeType == FILE_PIPE_BYTE_STREAM_TYPE)
40  {
42  }
43 
44  if (NamedPipeEnd != FILE_PIPE_CLIENT_END)
45  {
46  if (NamedPipeEnd != FILE_PIPE_SERVER_END)
47  {
48  NpBugCheck(NamedPipeEnd, 0, 0);
49  }
50  ReadQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
51  WriteQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
52  }
53  else
54  {
55  ReadQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
56  WriteQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
57  }
58 
59  if (Buffer->CompletionMode != FILE_PIPE_COMPLETE_OPERATION ||
60  Ccb->CompletionMode[NamedPipeEnd] == FILE_PIPE_COMPLETE_OPERATION ||
61  (ReadQueue->QueueState != ReadEntries &&
62  WriteQueue->QueueState != WriteEntries))
63  {
64  Ccb->ReadMode[NamedPipeEnd] = Buffer->ReadMode & 0xFF;
65  Ccb->CompletionMode[NamedPipeEnd] = Buffer->CompletionMode & 0xFF;
66 
69  }
70  else
71  {
73  }
74 
75  return Status;
76 }
#define FILE_PIPE_BYTE_STREAM_TYPE
Definition: iotypes.h:75
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_PIPE_CLIENT_END
Definition: iotypes.h:84
VOID NTAPI NpCheckForNotify(IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
Definition: create.c:20
struct _FCB * ParentDcb
Definition: fatstruc.h:835
#define PAGED_CODE()
Definition: video.h:57
Definition: bufpool.h:45
ULONG QueueState
Definition: npfs.h:139
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
LIST_ENTRY List
Definition: psmgr.c:57
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
#define FILE_PIPE_COMPLETE_OPERATION
Definition: iotypes.h:80
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Status
Definition: gdiplustypes.h:24
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define FILE_PIPE_MESSAGE_MODE
Definition: iotypes.h:78
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
#define STATUS_PIPE_BUSY
Definition: ntstatus.h:396
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by NpCommonSetInformation().