ReactOS 0.4.16-dev-287-g2d3f3a1
fsctrl.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/fsctrl.c
5 * PURPOSE: Named Pipe FileSystem I/O Controls
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_FSCTRL)
15
16/* GLOBALS ********************************************************************/
17
19
20/* FUNCTIONS ******************************************************************/
21
25 IN PIRP Irp,
27{
30}
31
35 IN PIRP Irp,
36 IN BOOLEAN Overflow,
38{
41}
42
46 IN PIRP Irp,
48{
51}
52
56 IN PIRP Irp)
57{
58 PIO_STACK_LOCATION IoStackLocation;
59 NODE_TYPE_CODE NodeTypeCode;
61 PNP_CLIENT_PROCESS ClientSession, QueryBuffer;
63 PAGED_CODE();
64
65 /* Get the current stack location */
66 IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
67
68 /* Decode the file object and check the node type */
69 NodeTypeCode = NpDecodeFileObject(IoStackLocation->FileObject, 0, &Ccb, 0);
70 if (NodeTypeCode != NPFS_NTC_CCB)
71 {
73 }
74
75 /* Get the length of the query buffer */
76 Length = IoStackLocation->Parameters.QueryFile.Length;
77 if (Length < 8)
78 {
80 }
81
82 QueryBuffer = Irp->AssociatedIrp.SystemBuffer;
83
84 /* Lock the Ccb */
85 ExAcquireResourceExclusiveLite(&Ccb->NonPagedCcb->Lock, TRUE);
86
87 /* Get the CCBs client session and check if it's set */
88 ClientSession = Ccb->ClientSession;
89 if (ClientSession != NULL)
90 {
91 /* Copy first 2 fields */
92 QueryBuffer->Unknown = ClientSession->Unknown;
93 QueryBuffer->Process = ClientSession->Process;
94 }
95 else
96 {
97 /* Copy the process from the CCB */
98 QueryBuffer->Unknown = NULL;
99 QueryBuffer->Process = Ccb->Process;
100 }
101
102 /* Does the caller provide a large enough buffer for the full data? */
103 if (Length >= sizeof(NP_CLIENT_PROCESS))
104 {
105 Irp->IoStatus.Information = sizeof(NP_CLIENT_PROCESS);
106
107 /* Do we have a ClientSession structure? */
108 if (ClientSession != NULL)
109 {
110 /* Copy length and the data */
111 QueryBuffer->DataLength = ClientSession->DataLength;
112 RtlCopyMemory(QueryBuffer->Buffer,
113 ClientSession->Buffer,
114 ClientSession->DataLength);
115
116 /* NULL terminate the buffer */
117 NT_ASSERT(QueryBuffer->DataLength <= 30);
118 QueryBuffer->Buffer[QueryBuffer->DataLength / sizeof(WCHAR)] = 0;
119 }
120 else
121 {
122 /* No data */
123 QueryBuffer->DataLength = 0;
124 QueryBuffer->Buffer[0] = 0;
125 }
126 }
127 else
128 {
129 Irp->IoStatus.Information = FIELD_OFFSET(NP_CLIENT_PROCESS, DataLength);
130 }
131
132 /* Unlock the Ccb */
133 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
134
135 return STATUS_SUCCESS;
136}
137
139NTAPI
141 IN PIRP Irp)
142{
143 PIO_STACK_LOCATION IoStackLocation;
144 NODE_TYPE_CODE NodeTypeCode;
145 PNP_CCB Ccb;
147 PNP_CLIENT_PROCESS InputBuffer, ClientSession, OldClientSession;
148 PAGED_CODE();
149
150 /* Get the current stack location */
151 IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
152
153 /* Only kernel calls are allowed! */
154 if (IoStackLocation->MinorFunction != IRP_MN_KERNEL_CALL)
155 {
157 }
158
159 /* Decode the file object and check the node type */
160 NodeTypeCode = NpDecodeFileObject(IoStackLocation->FileObject, 0, &Ccb, 0);
161 if (NodeTypeCode != NPFS_NTC_CCB)
162 {
164 }
165
166 /* Get the length of the query buffer and check if it's valid */
167 Length = IoStackLocation->Parameters.QueryFile.Length;
168 if (Length != sizeof(NP_CLIENT_PROCESS))
169 {
171 }
172
173 /* Get the buffer and check if the data Length is valid */
174 InputBuffer = Irp->AssociatedIrp.SystemBuffer;
175 if (InputBuffer->DataLength > 30)
176 {
178 }
179
180 /* Allocate a new structure */
182 sizeof(NP_CLIENT_PROCESS),
183 'iFpN');
184
185 /* Copy the full input buffer */
186 RtlCopyMemory(ClientSession, InputBuffer, sizeof(NP_CLIENT_PROCESS));
187
188 /* Lock the Ccb */
189 ExAcquireResourceExclusiveLite(&Ccb->NonPagedCcb->Lock, TRUE);
190
191 /* Get the old ClientSession and set the new */
192 OldClientSession = Ccb->ClientSession;
193 Ccb->ClientSession = ClientSession;
194
195 /* Copy the process to the CCB */
196 Ccb->Process = ClientSession->Process;
197
198 /* Unlock the Ccb */
199 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
200
201 /* Check if there was already a ClientSession */
202 if (OldClientSession != NULL)
203 {
204 /* Free it */
205 ExFreePoolWithTag(OldClientSession, 'iFpN');
206 }
207
208 return STATUS_SUCCESS;
209}
210
212NTAPI
214 IN PIRP Irp)
215{
218}
219
221NTAPI
223 IN PIRP Irp)
224{
227}
228
230NTAPI
232 IN PIRP Irp)
233{
234 ULONG NamedPipeEnd;
235 PNP_CCB Ccb;
237 NODE_TYPE_CODE NodeTypeCode;
238 PIO_STACK_LOCATION IoStack;
239 PAGED_CODE();
240
242
243 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd);
244 if (NodeTypeCode == NPFS_NTC_CCB && NamedPipeEnd == FILE_PIPE_SERVER_END)
245 {
247 }
248 else
249 {
251 }
252
253 return Status;
254}
255
257NTAPI
259 IN PIRP Irp,
261{
262 ULONG NamedPipeEnd;
263 PNP_CCB Ccb;
265 NODE_TYPE_CODE NodeTypeCode;
266 PIO_STACK_LOCATION IoStack;
267 PAGED_CODE();
268
270
271 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd);
272 if (NodeTypeCode == NPFS_NTC_CCB)
273 {
274 if (NamedPipeEnd == FILE_PIPE_SERVER_END)
275 {
276 ExAcquireResourceExclusiveLite(&Ccb->NonPagedCcb->Lock, TRUE);
277
279
281
282 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
283 }
284 else
285 {
287 }
288 }
289 else
290 {
292 }
293
294 return Status;
295}
296
298NTAPI
300 IN PIRP Irp,
302{
303 ULONG NamedPipeEnd;
304 PNP_CCB Ccb;
306 NODE_TYPE_CODE NodeTypeCode;
307 PIO_STACK_LOCATION IoStack;
308 PAGED_CODE();
309
311
312 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd);
313 if (NodeTypeCode == NPFS_NTC_CCB)
314 {
315 if (NamedPipeEnd == FILE_PIPE_SERVER_END)
316 {
317 ExAcquireResourceExclusiveLite(&Ccb->NonPagedCcb->Lock, TRUE);
318
320
322
323 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
324 }
325 else
326 {
328 }
329 }
330 else
331 {
333 }
334
335 return Status;
336}
337
339NTAPI
341 IN PIRP Irp,
343{
344 PIO_STACK_LOCATION IoStack;
346 ULONG OutputLength;
347 ULONG NamedPipeEnd;
348 PNP_CCB Ccb;
349 PFILE_PIPE_PEEK_BUFFER PeekBuffer;
350 PNP_DATA_QUEUE DataQueue;
351 ULONG_PTR BytesPeeked;
354 PNP_DATA_QUEUE_ENTRY DataEntry;
355 PAGED_CODE();
356
358 OutputLength = IoStack->Parameters.FileSystemControl.OutputBufferLength;
359 Type = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd);
360
361 if (!Type)
362 {
364 }
365
366 if ((Type != NPFS_NTC_CCB) &&
367 (OutputLength < FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data)))
368 {
370 }
371
372 PeekBuffer = Irp->AssociatedIrp.SystemBuffer;
373 if (NamedPipeEnd != FILE_PIPE_CLIENT_END)
374 {
375 if (NamedPipeEnd != FILE_PIPE_SERVER_END)
376 {
377 NpBugCheck(NamedPipeEnd, 0, 0);
378 }
379
380 DataQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
381 }
382 else
383 {
384 DataQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
385 }
386
387 if (Ccb->NamedPipeState != FILE_PIPE_CONNECTED_STATE)
388 {
389 if (Ccb->NamedPipeState != FILE_PIPE_CLOSING_STATE)
390 {
392 }
393
394 if (DataQueue->QueueState != WriteEntries)
395 {
396 return STATUS_PIPE_BROKEN;
397 }
398 }
399
400 PeekBuffer->NamedPipeState = 0;
401 PeekBuffer->ReadDataAvailable = 0;
402 PeekBuffer->NumberOfMessages = 0;
403 PeekBuffer->MessageLength = 0;
404 PeekBuffer->NamedPipeState = Ccb->NamedPipeState;
406
407 if (DataQueue->QueueState == WriteEntries)
408 {
409 DataEntry = CONTAINING_RECORD(DataQueue->Queue.Flink,
411 QueueEntry);
412 ASSERT((DataEntry->DataEntryType == Buffered) || (DataEntry->DataEntryType == Unbuffered));
413
414 PeekBuffer->ReadDataAvailable = DataQueue->BytesInQueue - DataQueue->ByteOffset;
415 if (Ccb->Fcb->NamedPipeType == FILE_PIPE_MESSAGE_TYPE)
416 {
417 PeekBuffer->NumberOfMessages = DataQueue->EntriesInQueue;
418 PeekBuffer->MessageLength = DataEntry->DataSize - DataQueue->ByteOffset;
419 }
420
421 if (OutputLength == FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data))
422 {
424 }
425 else
426 {
427 IoStatus = NpReadDataQueue(DataQueue,
428 TRUE,
429 FALSE,
430 PeekBuffer->Data,
431 OutputLength - FIELD_OFFSET(FILE_PIPE_PEEK_BUFFER, Data),
432 Ccb->Fcb->NamedPipeType == FILE_PIPE_MESSAGE_TYPE,
433 Ccb,
434 List);
435 Status = IoStatus.Status;
436 BytesPeeked += IoStatus.Information;
437 }
438 }
439 else
440 {
442 }
443
444 Irp->IoStatus.Information = BytesPeeked;
445 return Status;
446}
447
449NTAPI
451 IN PIRP Irp,
453{
454 PAGED_CODE();
455
456 if (Irp->AssociatedIrp.SystemBuffer)
457 {
458 ExFreePool(Irp->AssociatedIrp.SystemBuffer);
459 }
460
461 IoFreeIrp(Irp);
463}
464
466NTAPI
468 IN PIRP Irp,
470{
471 PIO_STACK_LOCATION IoStack;
472 PVOID InBuffer, OutBuffer;
473 ULONG InLength, OutLength, BytesWritten;
474 NODE_TYPE_CODE NodeTypeCode;
475 PNP_CCB Ccb;
476 ULONG NamedPipeEnd;
477 PNP_NONPAGED_CCB NonPagedCcb;
478 PNP_DATA_QUEUE ReadQueue, WriteQueue;
479 PNP_EVENT_BUFFER EventBuffer;
481 PIRP NewIrp;
482 PAGED_CODE();
483
485 InLength = IoStack->Parameters.FileSystemControl.InputBufferLength;
486 InBuffer = IoStack->Parameters.FileSystemControl.Type3InputBuffer;
487 OutLength = IoStack->Parameters.FileSystemControl.OutputBufferLength;
488 OutBuffer = Irp->UserBuffer;
489
490 if (Irp->RequestorMode == UserMode)
491 {
493 {
494 ProbeForRead(InBuffer, InLength, sizeof(CHAR));
495 ProbeForWrite(OutBuffer, OutLength, sizeof(CHAR));
496 }
498 {
500 }
501 _SEH2_END;
502 }
503
504 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd);
505 if (NodeTypeCode != NPFS_NTC_CCB)
506 {
508 }
509
510 NonPagedCcb = Ccb->NonPagedCcb;
512
513 if (Ccb->NamedPipeState != FILE_PIPE_CONNECTED_STATE)
514 {
516 goto Quickie;
517 }
518
519 if (NamedPipeEnd != FILE_PIPE_CLIENT_END)
520 {
521 if (NamedPipeEnd != FILE_PIPE_SERVER_END)
522 {
523 NpBugCheck(NamedPipeEnd, 0, 0);
524 }
525 ReadQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
526 WriteQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
527 }
528 else
529 {
530 ReadQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
531 WriteQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
532 }
533
534 EventBuffer = NonPagedCcb->EventBuffer[NamedPipeEnd];
535
536 if (Ccb->Fcb->NamedPipeConfiguration != FILE_PIPE_FULL_DUPLEX ||
537 Ccb->ReadMode[NamedPipeEnd] != FILE_PIPE_MESSAGE_MODE)
538 {
540 goto Quickie;
541 }
542
543 if (ReadQueue->QueueState != Empty)
544 {
546 goto Quickie;
547 }
548
549 Status = NpWriteDataQueue(WriteQueue,
551 InBuffer,
552 InLength,
553 Ccb->Fcb->NamedPipeType,
555 Ccb,
556 NamedPipeEnd,
557 Irp->Tail.Overlay.Thread,
558 List);
560 {
561 ASSERT(WriteQueue->QueueState != ReadEntries);
562 NewIrp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
563 if (!NewIrp)
564 {
566 goto Quickie;
567 }
568
570
571 if (BytesWritten)
572 {
576 if (!NewIrp->AssociatedIrp.SystemBuffer)
577 {
578 IoFreeIrp(NewIrp);
580 goto Quickie;
581 }
582
584 {
586 (PVOID)((ULONG_PTR)InBuffer + InLength - BytesWritten),
588 }
590 {
592 _SEH2_YIELD(goto Quickie);
593 }
594 _SEH2_END;
595 }
596 else
597 {
599 }
600
601 IoStack = IoGetNextIrpStackLocation(NewIrp);
603
604 NewIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread;
606
607 IoStack->Parameters.Write.Length = BytesWritten;
608 IoStack->MajorFunction = IRP_MJ_WRITE;
609
610 if (BytesWritten > 0) NewIrp->Flags = IRP_DEALLOCATE_BUFFER | IRP_BUFFERED_IO;
611 NewIrp->UserIosb = &NpUserIoStatusBlock;
612
613 Status = NpAddDataQueueEntry(NamedPipeEnd,
614 Ccb,
615 WriteQueue,
619 NewIrp,
620 NULL,
621 0);
622 if (Status != STATUS_PENDING)
623 {
624 NewIrp->IoStatus.Status = Status;
625 InsertTailList(List, &NewIrp->Tail.Overlay.ListEntry);
626 }
627 }
628
629 if (!NT_SUCCESS(Status)) goto Quickie;
630
631 if (EventBuffer) KeSetEvent(EventBuffer->Event, IO_NO_INCREMENT, FALSE);
632 ASSERT(ReadQueue->QueueState == Empty);
633 Status = NpAddDataQueueEntry(NamedPipeEnd,
634 Ccb,
635 ReadQueue,
637 Buffered,
638 OutLength,
639 Irp,
640 NULL,
641 0);
642 if (NT_SUCCESS(Status))
643 {
644 if (EventBuffer) KeSetEvent(EventBuffer->Event, IO_NO_INCREMENT, FALSE);
645 }
646
647Quickie:
648 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
649 return Status;
650}
651
653NTAPI
655 IN PIRP Irp)
656{
657 PIO_STACK_LOCATION IoStack;
658 ULONG InLength, NameLength;
660 ULONG NamedPipeEnd;
661 PNP_CCB Ccb;
664 NODE_TYPE_CODE NodeTypeCode;
665 PLIST_ENTRY NextEntry;
666 PNP_FCB Fcb;
667 PWCHAR OriginalBuffer;
668 PAGED_CODE();
669
671 InLength = IoStack->Parameters.FileSystemControl.InputBufferLength;
672
674
675 if (NpDecodeFileObject(IoStack->FileObject,
676 NULL,
677 &Ccb,
678 &NamedPipeEnd) != NPFS_NTC_ROOT_DCB)
679 {
681 goto Quickie;
682 }
683
684 Buffer = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer;
685 if (InLength < sizeof(*Buffer))
686 {
688 goto Quickie;
689 }
690
691 NameLength = Buffer->NameLength;
692 if ((NameLength > (0xFFFF - sizeof(UNICODE_NULL))) ||
693 ((NameLength + FIELD_OFFSET(FILE_PIPE_WAIT_FOR_BUFFER, Name)) > InLength))
694 {
696 goto Quickie;
697 }
698
699 SourceString.Length = (USHORT)NameLength + sizeof(OBJ_NAME_PATH_SEPARATOR);
703 if (!SourceString.Buffer)
704 {
706 goto Quickie;
707 }
708
710 RtlCopyMemory(&SourceString.Buffer[1], Buffer->Name, Buffer->NameLength);
711
713 OriginalBuffer = SourceString.Buffer;
714 //Status = NpTranslateAlias(&SourceString);
715 if (!NT_SUCCESS(Status)) goto Quickie;
716
718 Fcb = (PNP_FCB)((ULONG_PTR)Fcb & ~1);
719
720 NodeTypeCode = Fcb ? Fcb->NodeType : 0;
721 if (NodeTypeCode != NPFS_NTC_FCB)
722 {
724 goto Quickie;
725 }
726
727 for (NextEntry = Fcb->CcbList.Flink;
728 NextEntry != &Fcb->CcbList;
729 NextEntry = NextEntry->Flink)
730 {
731 Ccb = CONTAINING_RECORD(NextEntry, NP_CCB, CcbEntry);
732 if (Ccb->NamedPipeState == FILE_PIPE_LISTENING_STATE) break;
733 }
734
735 if (NextEntry != &Fcb->CcbList)
736 {
738 }
739 else
740 {
742 Fcb->Timeout,
743 Irp,
744 OriginalBuffer == SourceString.Buffer ?
745 NULL : &SourceString);
746 }
747
748Quickie:
750 return Status;
751}
752
754NTAPI
756 IN PIRP Irp)
757{
758 ULONG Fsctl;
759 BOOLEAN Overflow = FALSE;
760 LIST_ENTRY DeferredList;
762 PAGED_CODE();
763
764 InitializeListHead(&DeferredList);
766
767 switch (Fsctl)
768 {
769 case FSCTL_PIPE_PEEK:
771 Status = NpPeek(DeviceObject, Irp, &DeferredList);
772 break;
773
776 Status = NpInternalWrite(DeviceObject, Irp, &DeferredList);
777 break;
778
781 Status = NpTransceive(DeviceObject, Irp, &DeferredList);
782 break;
783
786 Status = NpInternalTransceive(DeviceObject, Irp, &DeferredList);
787 break;
788
790 Overflow = TRUE;
791 // on purpose
792
795 Status = NpInternalRead(DeviceObject, Irp, Overflow, &DeferredList);
796 break;
797
799
802 break;
803
805
808 break;
809
811
813 Status = NpDisconnect(DeviceObject, Irp, &DeferredList);
814 break;
815
817
819 Status = NpListen(DeviceObject, Irp, &DeferredList);
820 break;
821
823
826 break;
827
828 case FSCTL_PIPE_WAIT:
829
832 break;
833
835
838 break;
839
843 break;
844
845 default:
847 }
848
849 NpReleaseVcb();
850 NpCompleteDeferredIrps(&DeferredList);
851
852 return Status;
853}
854
856NTAPI
858 IN PIRP Irp)
859{
861 PAGED_CODE();
862
864
866
868
869 if (Status != STATUS_PENDING)
870 {
871 Irp->IoStatus.Status = Status;
873 }
874
875 return Status;
876}
877
878/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
unsigned char BOOLEAN
Type
Definition: Type.h:7
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
NTSTATUS NTAPI NpAddDataQueueEntry(IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PNP_DATA_QUEUE DataQueue, IN ULONG Who, IN ULONG Type, IN ULONG DataSize, IN PIRP Irp, IN PVOID Buffer, IN ULONG ByteOffset)
Definition: datasup.c:295
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
IO_STATUS_BLOCK NTAPI NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue, IN BOOLEAN Peek, IN BOOLEAN ReadOverflowOperation, IN PVOID Buffer, IN ULONG BufferSize, IN ULONG Mode, IN PNP_CCB Ccb, IN PLIST_ENTRY List)
Definition: readsup.c:20
@ Buffered
Definition: npfs.h:131
@ Unbuffered
Definition: npfs.h:132
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
PNP_VCB NpVcb
Definition: strucsup.c:19
NTSTATUS NTAPI NpSetDisconnectedPipeState(IN PNP_CCB Ccb, IN PLIST_ENTRY List)
Definition: statesup.c:77
struct _NP_CLIENT_PROCESS NP_CLIENT_PROCESS
struct _NP_FCB * PNP_FCB
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
@ ReadEntries
Definition: npfs.h:123
@ Empty
Definition: npfs.h:125
@ WriteEntries
Definition: npfs.h:124
#define NpBugCheck(p1, p2, p3)
Definition: npfs.h:106
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356
NTSTATUS NTAPI NpAddWaiter(IN PNP_WAIT_QUEUE WaitQueue, IN LARGE_INTEGER WaitTime, IN PIRP Irp, IN PUNICODE_STRING AliasName)
Definition: waitsup.c:221
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
Definition: prefxsup.c:20
#define NPFS_WRITE_BLOCK_TAG
Definition: npfs.h:64
#define NPFS_NTC_FCB
Definition: npfs.h:114
NTSTATUS NTAPI NpSetListeningPipeState(IN PNP_CCB Ccb, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: statesup.c:188
NTSTATUS NTAPI NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue, IN ULONG Mode, IN PVOID OutBuffer, IN ULONG OutBufferSize, IN ULONG PipeType, OUT PULONG BytesWritten, IN PNP_CCB Ccb, IN ULONG NamedPipeEnd, IN PETHREAD Thread, IN PLIST_ENTRY List)
Definition: writesup.c:20
#define NPFS_NTC_CCB
Definition: npfs.h:115
VOID NTAPI NpUninitializeSecurity(IN PNP_CCB Ccb)
Definition: secursup.c:72
NTSTATUS NTAPI NpImpersonateClientContext(IN PNP_CCB Ccb)
Definition: secursup.c:20
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
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
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define FILE_PIPE_LISTENING_STATE
Definition: winternl.h:791
#define FILE_PIPE_CONNECTED_STATE
Definition: winternl.h:792
#define FILE_PIPE_CLOSING_STATE
Definition: winternl.h:793
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define FSCTL_PIPE_LISTEN
Definition: pipe.c:63
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define UserMode
Definition: asm.h:35
#define FILE_PIPE_FULL_DUPLEX
Definition: iotypes.h:83
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define FILE_PIPE_MESSAGE_TYPE
Definition: iotypes.h:76
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
#define FILE_PIPE_CLIENT_END
Definition: iotypes.h:84
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
#define FILE_PIPE_MESSAGE_MODE
Definition: iotypes.h:78
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1922
NTSTATUS NTAPI NpImpersonate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:231
NTSTATUS NTAPI NpWaitForNamedPipe(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:654
IO_STATUS_BLOCK NpUserIoStatusBlock
Definition: fsctrl.c:18
NTSTATUS NTAPI NpInternalWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:45
NTSTATUS NTAPI NpSetClientProcess(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:140
NTSTATUS NTAPI NpDisconnect(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:258
NTSTATUS NTAPI NpQueryClientProcess(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:55
NTSTATUS NTAPI NpCompleteTransceiveIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: fsctrl.c:450
NTSTATUS NTAPI NpFsdFileSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:857
NTSTATUS NTAPI NpListen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:299
NTSTATUS NTAPI NpCommonFileSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:755
NTSTATUS NTAPI NpQueryEvent(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:222
NTSTATUS NTAPI NpInternalRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN BOOLEAN Overflow, IN PLIST_ENTRY List)
Definition: fsctrl.c:34
NTSTATUS NTAPI NpTransceive(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:467
NTSTATUS NTAPI NpInternalTransceive(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:24
NTSTATUS NTAPI NpAssignEvent(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fsctrl.c:213
NTSTATUS NTAPI NpPeek(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PLIST_ENTRY List)
Definition: fsctrl.c:340
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define IoCompleteRequest
Definition: irp.c:1240
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define STATUS_INVALID_PIPE_STATE
Definition: ntstatus.h:409
#define STATUS_PIPE_BROKEN
Definition: ntstatus.h:567
#define STATUS_PIPE_BUSY
Definition: ntstatus.h:410
#define STATUS_ILLEGAL_FUNCTION
Definition: ntstatus.h:411
unsigned short USHORT
Definition: pedump.c:61
#define FSCTL_PIPE_IMPERSONATE
Definition: winioctl.h:734
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define FSCTL_PIPE_WAIT
Definition: winioctl.h:199
struct _FILE_PIPE_WAIT_FOR_BUFFER * PFILE_PIPE_WAIT_FOR_BUFFER
#define FSCTL_PIPE_SET_CLIENT_PROCESS
Definition: winioctl.h:201
#define FSCTL_PIPE_ASSIGN_EVENT
Definition: winioctl.h:193
#define FSCTL_PIPE_INTERNAL_READ_OVFLOW
Definition: winioctl.h:206
#define FSCTL_PIPE_TRANSCEIVE
Definition: winioctl.h:198
#define FSCTL_PIPE_PEEK
Definition: winioctl.h:196
#define FSCTL_PIPE_QUERY_EVENT
Definition: winioctl.h:197
#define FSCTL_PIPE_DISCONNECT
Definition: winioctl.h:194
#define FSCTL_PIPE_INTERNAL_TRANSCEIVE
Definition: winioctl.h:205
#define FSCTL_PIPE_INTERNAL_WRITE
Definition: winioctl.h:204
#define FSCTL_PIPE_QUERY_CLIENT_PROCESS
Definition: winioctl.h:202
#define FSCTL_PIPE_INTERNAL_READ
Definition: winioctl.h:203
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _FCB::@729::@732 Fcb
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
union _IO_STACK_LOCATION::@1579 Parameters
struct _IO_STACK_LOCATION::@3978::@3983 Write
struct _IO_STACK_LOCATION::@3978::@3987 QueryFile
struct _IO_STACK_LOCATION::@3978::@3993 FileSystemControl
PVOID SystemBuffer
union _IRP::@1581 AssociatedIrp
IO_STATUS_BLOCK IoStatus
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: npfs.h:259
PVOID Unknown
Definition: npfs.h:316
PVOID Process
Definition: npfs.h:317
USHORT DataLength
Definition: npfs.h:318
WCHAR Buffer[17]
Definition: npfs.h:319
Definition: npfs.h:149
ULONG DataSize
Definition: npfs.h:155
ULONG DataEntryType
Definition: npfs.h:151
ULONG EntriesInQueue
Definition: npfs.h:141
LIST_ENTRY Queue
Definition: npfs.h:138
ULONG QueueState
Definition: npfs.h:139
ULONG BytesInQueue
Definition: npfs.h:140
ULONG ByteOffset
Definition: npfs.h:143
PKEVENT Event
Definition: npfs.h:179
Definition: npfs.h:229
ERESOURCE Lock
Definition: npfs.h:254
PNP_EVENT_BUFFER EventBuffer[2]
Definition: npfs.h:253
NP_WAIT_QUEUE WaitQueue
Definition: npfs.h:285
unsigned short Length
Definition: sprintf.c:451
void * Buffer
Definition: sprintf.c:453
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#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
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define ExAllocatePoolWithQuotaTag(a, b, c)
Definition: exfuncs.h:530
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680
#define IRP_DEALLOCATE_BUFFER
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
#define IRP_MN_KERNEL_CALL
Definition: iotypes.h:4408
#define IRP_BUFFERED_IO
#define NT_ASSERT
Definition: rtlfuncs.h:3327
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1647
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175