ReactOS  0.4.13-dev-99-g7e18b6d
create.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/create.c
5  * PURPOSE: Pipes Creation
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_CREATE)
15 
16 /* FUNCTIONS ******************************************************************/
17 
18 VOID
19 NTAPI
21  IN BOOLEAN SecondList,
23 {
24  PLIST_ENTRY NextEntry, ListHead;
25  PIRP Irp;
26  ULONG i;
27  PAGED_CODE();
28 
29  ListHead = &Dcb->NotifyList;
30  for (i = 0; i < 2; i++)
31  {
32  ASSERT(IsListEmpty(ListHead));
33  while (!IsListEmpty(ListHead))
34  {
35  NextEntry = RemoveHeadList(ListHead);
36 
37  Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
38 
40  {
41  Irp->IoStatus.Status = STATUS_SUCCESS;
42  InsertTailList(List, NextEntry);
43  }
44  else
45  {
46  InitializeListHead(NextEntry);
47  }
48  }
49 
50  if (!SecondList) break;
51  ListHead = &Dcb->NotifyList2;
52  }
53 }
54 
56 NTAPI
59 {
61  PAGED_CODE();
62  TRACE("Entered\n");
63 
66 
67  Status.Information = FILE_OPENED;
68  Status.Status = STATUS_SUCCESS;
69  TRACE("Leaving, Status.Status = %lx\n", Status.Status);
70  return Status;
71 }
72 
74 NTAPI
79 {
82  PAGED_CODE();
83  TRACE("Entered\n");
84 
85  IoStatus.Status = NpCreateRootDcbCcb(&Ccb);
86  if (NT_SUCCESS(IoStatus.Status))
87  {
89  ++Dcb->CurrentInstances;
90 
91  IoStatus.Information = FILE_OPENED;
92  IoStatus.Status = STATUS_SUCCESS;
93  }
94  else
95  {
96  IoStatus.Information = 0;
97  }
98 
99  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
100  return IoStatus;
101 }
102 
104 NTAPI
108  IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
113 {
120  USHORT NamedPipeConfiguration;
121  PLIST_ENTRY NextEntry, ListHead;
122  PNP_CCB Ccb = NULL;
123  TRACE("Entered\n");
124 
125  IoStatus.Information = 0;
126  Privileges = NULL;
127 
128  NamedPipeConfiguration = Fcb->NamedPipeConfiguration;
129 
130  SubjectSecurityContext = &AccessState->SubjectSecurityContext;
132 
133  AccessGranted = SeAccessCheck(Fcb->SecurityDescriptor,
135  TRUE,
136  DesiredAccess & ~4,
137  0,
138  &Privileges,
140  PreviousMode,
141  &GrantedAccess,
142  &IoStatus.Status);
143 
144  if (Privileges)
145  {
148  }
149 
150  if (AccessGranted)
151  {
152  AccessState->PreviouslyGrantedAccess |= GrantedAccess;
153  AccessState->RemainingDesiredAccess &= ~(GrantedAccess | MAXIMUM_ALLOWED);
154  }
155 
156  ObjectTypeName.Buffer = L"NamedPipe";
157  ObjectTypeName.Length = 18;
159  NULL,
161  Fcb->SecurityDescriptor,
162  AccessState,
163  FALSE,
165  PreviousMode,
166  &AccessState->GenerateOnClose);
168  if (!AccessGranted) return IoStatus;
169 
170  if (((GrantedAccess & FILE_READ_DATA) && (NamedPipeConfiguration == FILE_PIPE_INBOUND)) ||
171  ((GrantedAccess & FILE_WRITE_DATA) && (NamedPipeConfiguration == FILE_PIPE_OUTBOUND)))
172  {
174  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
175  return IoStatus;
176  }
177 
178  if (!(GrantedAccess & (FILE_READ_DATA | FILE_WRITE_DATA))) SecurityQos = NULL;
179 
180  ListHead = &Fcb->CcbList;
181  NextEntry = ListHead->Flink;
182  while (NextEntry != ListHead)
183  {
184  Ccb = CONTAINING_RECORD(NextEntry, NP_CCB, CcbEntry);
185  if (Ccb->NamedPipeState == FILE_PIPE_LISTENING_STATE) break;
186 
187  NextEntry = NextEntry->Flink;
188  }
189 
190  if (NextEntry == ListHead)
191  {
193  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
194  return IoStatus;
195  }
196 
197  IoStatus.Status = NpInitializeSecurity(Ccb, SecurityQos, Thread);
198  if (!NT_SUCCESS(IoStatus.Status)) return IoStatus;
199 
201  if (!NT_SUCCESS(IoStatus.Status))
202  {
204  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
205  return IoStatus;
206  }
207 
208  Ccb->ClientSession = NULL;
209  Ccb->Process = IoThreadToProcess(Thread);
210 
211  IoStatus.Information = FILE_OPENED;
212  IoStatus.Status = STATUS_SUCCESS;
213  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
214  return IoStatus;
215 }
216 
217 NTSTATUS
218 NTAPI
220  PUNICODE_STRING PipeName)
221 {
222  WCHAR UpcaseBuffer[MAX_INDEXED_LENGTH + 1];
223  UNICODE_STRING UpcaseString;
224  ULONG Length;
225  PNPFS_ALIAS CurrentAlias;
227  BOOLEAN BufferAllocated, BackSlash;
228  LONG Result;
229  PAGED_CODE();
230 
231  /* Get the pipe name length and check for empty string */
232  Length = PipeName->Length;
233  if (Length == 0)
234  {
235  return STATUS_SUCCESS;
236  }
237 
238  /* Check if the name starts with a path separator */
239  BackSlash = (PipeName->Buffer[0] == OBJ_NAME_PATH_SEPARATOR);
240  if (BackSlash)
241  {
242  /* We are only interested in the part after the backslash */
243  Length -= sizeof(WCHAR);
244  }
245 
246  /* Check if the length is within our indexed list bounds */
247  if ((Length >= MIN_INDEXED_LENGTH * sizeof(WCHAR)) &&
248  (Length <= MAX_INDEXED_LENGTH * sizeof(WCHAR)))
249  {
250  /* Length is within bounds, use the list by length */
251  CurrentAlias = NpAliasListByLength[(Length / sizeof(WCHAR)) - MIN_INDEXED_LENGTH];
252  }
253  else
254  {
255  /* We use the generic list, search for an entry of the right size */
256  CurrentAlias = NpAliasList;
257  while ((CurrentAlias != NULL) && (CurrentAlias->Name.Length != Length))
258  {
259  /* Check if we went past the desired length */
260  if (CurrentAlias->Name.Length > Length)
261  {
262  /* In this case there is no matching alias, return success */
263  return STATUS_SUCCESS;
264  }
265 
266  /* Go to the next alias in the list */
267  CurrentAlias = CurrentAlias->Next;
268  }
269  }
270 
271  /* Did we find any alias? */
272  if (CurrentAlias == NULL)
273  {
274  /* Nothing found, no matching alias */
275  return STATUS_SUCCESS;
276  }
277 
278  /* Check whether we can use our stack buffer */
279  if (Length <= MAX_INDEXED_LENGTH * sizeof(WCHAR))
280  {
281  /* Initialize the upcased string */
282  UpcaseString.Buffer = UpcaseBuffer;
283  UpcaseString.MaximumLength = sizeof(UpcaseBuffer);
284 
285  /* Upcase the pipe name */
286  Status = RtlUpcaseUnicodeString(&UpcaseString, PipeName, FALSE);
288  BufferAllocated = FALSE;
289  }
290  else
291  {
292  /* Upcase the pipe name, allocate the string buffer */
293  Status = RtlUpcaseUnicodeString(&UpcaseString, PipeName, TRUE);
294  if (!NT_SUCCESS(Status))
295  {
296  return Status;
297  }
298 
299  BufferAllocated = TRUE;
300  }
301 
302  /* Did the original name start with a backslash? */
303  if (BackSlash)
304  {
305  /* Skip it for the comparison */
306  UpcaseString.Buffer++;
307  UpcaseString.Length -= sizeof(WCHAR);
308  }
309 
310  /* Make sure the length matches the "raw" length */
311  NT_ASSERT(UpcaseString.Length == Length);
312  NT_ASSERT(CurrentAlias->Name.Length == Length);
313 
314  /* Loop while we have aliases */
315  do
316  {
317  /* Compare the names and check if they match */
318  Result = NpCompareAliasNames(&UpcaseString, &CurrentAlias->Name);
319  if (Result == 0)
320  {
321  /* The names match, use the target name */
322  *PipeName = *CurrentAlias->TargetName;
323 
324  /* Did the original name start with a backslash? */
325  if (!BackSlash)
326  {
327  /* It didn't, so skip it in the target name as well */
328  PipeName->Buffer++;
329  PipeName->Length -= sizeof(WCHAR);
330  }
331  break;
332  }
333 
334  /* Check if we went past all string candidates */
335  if (Result < 0)
336  {
337  /* Nothing found, we're done */
338  break;
339  }
340 
341  /* Go to the next alias */
342  CurrentAlias = CurrentAlias->Next;
343 
344  /* Keep looping while we have aliases of the right length */
345  } while ((CurrentAlias != NULL) && (CurrentAlias->Name.Length == Length));
346 
347  /* Did we allocate a buffer? */
348  if (BufferAllocated)
349  {
350  /* Free the allocated buffer */
351  ASSERT(UpcaseString.Buffer != UpcaseBuffer);
352  RtlFreeUnicodeString(&UpcaseString);
353  }
354 
355  return STATUS_SUCCESS;
356 }
357 
358 NTSTATUS
359 NTAPI
361  IN PIRP Irp)
362 {
364  PIO_STACK_LOCATION IoStack;
367  PFILE_OBJECT RelatedFileObject;
369  PNP_CCB Ccb;
370  PNP_FCB Fcb;
371  PNP_DCB Dcb;
373  LIST_ENTRY DeferredList;
375  TRACE("Entered\n");
376 
377  InitializeListHead(&DeferredList);
379  FileObject = IoStack->FileObject;
380  RelatedFileObject = FileObject->RelatedFileObject;
382  DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess;
383 
384  IoStatus.Information = 0;
385 
388 
389  if (RelatedFileObject)
390  {
391  Type = NpDecodeFileObject(RelatedFileObject, (PVOID*)&Fcb, &Ccb, FALSE);
392  }
393  else
394  {
395  Type = 0;
396  Fcb = NULL;
397  Ccb = NULL;
398  }
399 
400  if (FileName.Length)
401  {
402  if ((FileName.Length == sizeof(OBJ_NAME_PATH_SEPARATOR)) &&
403  (FileName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR) &&
404  !(RelatedFileObject))
405  {
407  FileObject,
409  &DeferredList);
410  goto Quickie;
411  }
412  }
413  else if (!(RelatedFileObject) || (Type == NPFS_NTC_VCB))
414  {
416  DesiredAccess);
417  goto Quickie;
418  }
419  else if (Type == NPFS_NTC_ROOT_DCB)
420  {
422  FileObject,
424  &DeferredList);
425  goto Quickie;
426  }
427 
429  if (!NT_SUCCESS(IoStatus.Status)) goto Quickie;
430 
431  if (RelatedFileObject)
432  {
433  if (Type == NPFS_NTC_ROOT_DCB)
434  {
435  Dcb = (PNP_DCB)Ccb;
437  &FileName,
438  1,
439  &Prefix,
440  &Fcb);
441  if (!NT_SUCCESS(IoStatus.Status))
442  {
443  goto Quickie;
444  }
445  }
446  else if ((Type != NPFS_NTC_CCB) || (FileName.Length))
447  {
449  goto Quickie;
450  }
451  else
452  {
453  Prefix.Length = 0;
454  }
455  }
456  else
457  {
458  if ((FileName.Length <= sizeof(OBJ_NAME_PATH_SEPARATOR)) ||
459  (FileName.Buffer[0] != OBJ_NAME_PATH_SEPARATOR))
460  {
462  goto Quickie;
463  }
464 
465  Fcb = NpFindPrefix(&FileName, 1, &Prefix);
466  }
467 
468  if (Prefix.Length)
469  {
470  IoStatus.Status = Fcb->NodeType != NPFS_NTC_FCB ?
473  goto Quickie;
474  }
475 
476  if (Fcb->NodeType != NPFS_NTC_FCB)
477  {
479  goto Quickie;
480  }
481 
482  if (!Fcb->ServerOpenCount)
483  {
485  goto Quickie;
486  }
487 
489  FileObject,
491  IoStack->Parameters.CreatePipe.
492  SecurityContext->SecurityQos,
493  IoStack->Parameters.CreatePipe.
494  SecurityContext->AccessState,
495  IoStack->Flags &
497  UserMode : Irp->RequestorMode,
498  Irp->Tail.Overlay.Thread,
499  &DeferredList);
500 
501 Quickie:
502  NpReleaseVcb();
503  NpCompleteDeferredIrps(&DeferredList);
505 
506  Irp->IoStatus = IoStatus;
508  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
509  return IoStatus.Status;
510 }
511 
513 NTAPI
524 {
529  PNP_CCB Ccb;
531  USHORT NamedPipeConfiguration, CheckShareAccess;
533  PAGED_CODE();
534  TRACE("Entered\n");
535 
536  Privileges = NULL;
537 
538  NamedPipeConfiguration = Fcb->NamedPipeConfiguration;
539 
540  SubjectSecurityContext = &AccessState->SubjectSecurityContext;
542 
543  IoStatus.Information = 0;
544 
545  AccessGranted = SeAccessCheck(Fcb->SecurityDescriptor,
547  TRUE,
548  DesiredAccess | 4,
549  0,
550  &Privileges,
552  PreviousMode,
553  &GrantedAccess,
554  &IoStatus.Status);
555 
556  if (Privileges)
557  {
560  }
561 
562  if (AccessGranted)
563  {
564  AccessState->PreviouslyGrantedAccess |= GrantedAccess;
565  AccessState->RemainingDesiredAccess &= ~(GrantedAccess | MAXIMUM_ALLOWED);
566  }
567 
568  ObjectTypeName.Buffer = L"NamedPipe";
569  ObjectTypeName.Length = 18;
571  NULL,
573  Fcb->SecurityDescriptor,
574  AccessState,
575  FALSE,
577  PreviousMode,
578  &AccessState->GenerateOnClose);
579 
581  if (!AccessGranted)
582  {
583  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
584  return IoStatus;
585  }
586 
587  if (Fcb->CurrentInstances >= Fcb->MaximumInstances)
588  {
590  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
591  return IoStatus;
592  }
593 
594  if (Disposition == FILE_CREATE)
595  {
597  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
598  return IoStatus;
599  }
600 
601  CheckShareAccess = 0;
602  if (NamedPipeConfiguration == FILE_PIPE_FULL_DUPLEX)
603  {
604  CheckShareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE;
605  }
606  else if (NamedPipeConfiguration == FILE_PIPE_OUTBOUND)
607  {
608  CheckShareAccess = FILE_SHARE_READ;
609  }
610  else if (NamedPipeConfiguration == FILE_PIPE_INBOUND)
611  {
612  CheckShareAccess = FILE_SHARE_WRITE;
613  }
614 
615  if (CheckShareAccess != ShareAccess)
616  {
618  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
619  return IoStatus;
620  }
621 
622  IoStatus.Status = NpCreateCcb(Fcb,
623  FileObject,
625  Parameters->ReadMode & 0xFF,
626  Parameters->CompletionMode & 0xFF,
627  Parameters->InboundQuota,
628  Parameters->OutboundQuota,
629  &Ccb);
630  if (!NT_SUCCESS(IoStatus.Status)) return IoStatus;
631 
633  &Fcb->FullName,
634  FALSE,
635  List);
636  if (!NT_SUCCESS(IoStatus.Status))
637  {
638  --Ccb->Fcb->CurrentInstances;
639  NpDeleteCcb(Ccb, List);
640  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
641  return IoStatus;
642  }
643 
644  NpSetFileObject(FileObject, Ccb, Ccb->NonPagedCcb, TRUE);
647 
648  IoStatus.Status = STATUS_SUCCESS;
649  IoStatus.Information = FILE_OPENED;
650  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
651  return IoStatus;
652 }
653 
654 NTSTATUS
655 NTAPI
658  IN UNICODE_STRING PipeName,
667 {
669  USHORT NamedPipeConfiguration;
670  PSECURITY_SUBJECT_CONTEXT SecurityContext;
671  PSECURITY_DESCRIPTOR SecurityDescriptor, CachedSecurityDescriptor;
672  PNP_CCB Ccb;
673  PNP_FCB Fcb;
674  PAGED_CODE();
675  TRACE("Entered\n");
676 
677  if (!(Parameters->TimeoutSpecified) ||
678  !(Parameters->MaximumInstances) ||
679  (Parameters->DefaultTimeout.QuadPart >= 0))
680  {
682  goto Quickie;
683  }
684 
685  if (Disposition == FILE_OPEN)
686  {
688  goto Quickie;
689  }
690 
692  {
693  NamedPipeConfiguration = FILE_PIPE_FULL_DUPLEX;
694  }
695  else if (ShareAccess == FILE_SHARE_READ)
696  {
697  NamedPipeConfiguration = FILE_PIPE_OUTBOUND;
698  }
699  else if (ShareAccess == FILE_SHARE_WRITE)
700  {
701  NamedPipeConfiguration = FILE_PIPE_INBOUND;
702  }
703  else
704  {
706  goto Quickie;
707  }
708 
709  if (Parameters->NamedPipeType == FILE_PIPE_BYTE_STREAM_TYPE &&
710  Parameters->ReadMode == FILE_PIPE_MESSAGE_MODE)
711  {
713  goto Quickie;
714  }
715 
717  &PipeName,
718  Parameters->MaximumInstances,
719  Parameters->DefaultTimeout,
720  NamedPipeConfiguration,
721  Parameters->NamedPipeType & 0xFFFF,
722  &Fcb);
723  if (!NT_SUCCESS(Status)) goto Quickie;
724 
726  FileObject,
728  Parameters->ReadMode & 0xFF,
729  Parameters->CompletionMode & 0xFF,
730  Parameters->InboundQuota,
731  Parameters->OutboundQuota,
732  &Ccb);
733  if (!NT_SUCCESS(Status))
734  {
735  NpDeleteFcb(Fcb, List);
736  goto Quickie;
737  }
738 
739  SecurityContext = &AccessState->SubjectSecurityContext;
740  SeLockSubjectContext(SecurityContext);
741 
742  Status = SeAssignSecurity(NULL,
743  AccessState->SecurityDescriptor,
745  FALSE,
746  SecurityContext,
748  PagedPool);
749  SeUnlockSubjectContext(SecurityContext);
750  if (!NT_SUCCESS(Status))
751  {
752  NpDeleteCcb(Ccb, List);
753  NpDeleteFcb(Fcb, List);
754  goto Quickie;
755  }
756 
758  &CachedSecurityDescriptor,
759  1);
761 
762  if (!NT_SUCCESS(Status))
763  {
764  NpDeleteCcb(Ccb, List);
765  NpDeleteFcb(Fcb, List);
766  goto Quickie;
767  }
768 
769  Fcb->SecurityDescriptor = CachedSecurityDescriptor;
770 
771  NpSetFileObject(FileObject, Ccb, Ccb->NonPagedCcb, TRUE);
773 
775 
776  IoStatus->Status = STATUS_SUCCESS;
777  IoStatus->Information = FILE_CREATED;
778 
779  TRACE("Leaving, STATUS_SUCCESS\n");
780  return STATUS_SUCCESS;
781 
782 Quickie:
783  TRACE("Leaving, Status = %lx\n", Status);
784  IoStatus->Information = 0;
785  IoStatus->Status = Status;
786  return Status;
787 }
788 
789 NTSTATUS
790 NTAPI
792  IN PIRP Irp)
793 {
794  PIO_STACK_LOCATION IoStack;
796  PFILE_OBJECT RelatedFileObject;
799  LIST_ENTRY DeferredList;
801  PNP_FCB Fcb;
805  TRACE("Entered\n");
806 
807  InitializeListHead(&DeferredList);
809 
811  FileObject = IoStack->FileObject;
812  RelatedFileObject = FileObject->RelatedFileObject;
813 
814  Disposition = (IoStack->Parameters.CreatePipe.Options >> 24) & 0xFF;
815  ShareAccess = IoStack->Parameters.CreatePipe.ShareAccess & 0xFFFF;
816  Parameters = IoStack->Parameters.CreatePipe.Parameters;
817 
819 
820  IoStatus.Information = 0;
821 
824 
825  if (RelatedFileObject)
826  {
827  Fcb = (PNP_FCB)((ULONG_PTR)RelatedFileObject->FsContext & ~1);
828  if (!(Fcb) ||
829  (Fcb->NodeType != NPFS_NTC_ROOT_DCB) ||
830  (FileName.Length < sizeof(WCHAR)) ||
831  (FileName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR))
832  {
834  goto Quickie;
835  }
836 
837  IoStatus.Status = NpFindRelativePrefix(RelatedFileObject->FsContext,
838  &FileName,
839  TRUE,
840  &Prefix,
841  &Fcb);
842  if (!NT_SUCCESS(IoStatus.Status))
843  {
844  goto Quickie;
845  }
846  }
847  else
848  {
849  if (FileName.Length <= sizeof(OBJ_NAME_PATH_SEPARATOR) ||
850  FileName.Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
851  {
853  goto Quickie;
854  }
855 
856  Fcb = NpFindPrefix(&FileName, 1, &Prefix);
857  }
858 
859  if (Prefix.Length)
860  {
861  if (Fcb->NodeType == NPFS_NTC_ROOT_DCB)
862  {
864  FileObject,
865  FileName,
866  IoStack->Parameters.CreatePipe.
867  SecurityContext->DesiredAccess,
868  IoStack->Parameters.CreatePipe.
869  SecurityContext->AccessState,
870  Disposition,
871  ShareAccess,
872  Parameters,
873  Process,
874  &DeferredList,
875  &IoStatus);
876  goto Quickie;
877  }
878  else
879  {
881  goto Quickie;
882  }
883  }
884 
885  if (Fcb->NodeType != NPFS_NTC_FCB)
886  {
888  goto Quickie;
889  }
890 
892  FileObject,
893  IoStack->Parameters.CreatePipe.
894  SecurityContext->DesiredAccess,
895  IoStack->Parameters.CreatePipe.
896  SecurityContext->AccessState,
897  IoStack->Flags &
899  UserMode : Irp->RequestorMode,
900  Disposition,
901  ShareAccess,
902  Parameters,
903  Process,
904  &DeferredList);
905 
906 Quickie:
907  NpReleaseVcb();
908  NpCompleteDeferredIrps(&DeferredList);
910 
911  TRACE("Leaving, IoStatus.Status = %lx\n", IoStatus.Status);
912  Irp->IoStatus = IoStatus;
914  return IoStatus.Status;
915 }
916 
917 /* EOF */
#define FILE_PIPE_BYTE_STREAM_TYPE
Definition: iotypes.h:75
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
Definition: file.c:3266
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR ObjectTypeName
Definition: security.c:77
VOID NTAPI NpDeleteFcb(IN PNP_FCB Fcb, IN PLIST_ENTRY ListEntry)
Definition: strucsup.c:63
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define STATUS_INSTANCE_NOT_AVAILABLE
Definition: ntstatus.h:393
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
Definition: irp.c:1782
BOOLEAN NTAPI SeAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, IN BOOLEAN SubjectContextLocked, IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK PreviouslyGrantedAccess, OUT PPRIVILEGE_SET *Privileges, IN PGENERIC_MAPPING GenericMapping, IN KPROCESSOR_MODE AccessMode, OUT PACCESS_MASK GrantedAccess, OUT PNTSTATUS AccessStatus)
Definition: accesschk.c:340
#define IN
Definition: typedefs.h:38
IO_STATUS_BLOCK NTAPI NpCreateClientEnd(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE PreviousMode, IN PETHREAD Thread, IN PLIST_ENTRY List)
Definition: create.c:105
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
#define FsRtlEnterFileSystem
NP_WAIT_QUEUE WaitQueue
Definition: npfs.h:285
VOID NTAPI SeUnlockSubjectContext(IN PSECURITY_SUBJECT_CONTEXT SubjectContext)
Definition: access.c:336
Type
Definition: Type.h:6
NTSTATUS NTAPI NpTranslateAlias(PUNICODE_STRING PipeName)
Definition: create.c:219
PNPFS_ALIAS NpAliasList
Definition: main.c:20
#define FsRtlExitFileSystem
USHORT MaximumLength
Definition: env_spec_w32.h:370
PFILE_OBJECT FileObject
Definition: ntfs.h:504
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
Iosb Status
Definition: create.c:4311
_In_ PIRP Irp
Definition: csq.h:116
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PNPFS_ALIAS NpAliasListByLength[MAX_INDEXED_LENGTH+1 - MIN_INDEXED_LENGTH]
Definition: main.c:21
#define MAX_INDEXED_LENGTH
Definition: npfs.h:33
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OPENED
Definition: nt_native.h:769
VOID NTAPI SeLockSubjectContext(IN PSECURITY_SUBJECT_CONTEXT SubjectContext)
Definition: access.c:314
NTSTATUS NTAPI NpCreateRootDcbCcb(IN PNP_ROOT_DCB_FCB *NewRootCcb)
Definition: strucsup.c:149
NTSTATUS NTAPI NpSetConnectedPipeState(IN PNP_CCB Ccb, IN PFILE_OBJECT FileObject, IN PLIST_ENTRY List)
Definition: statesup.c:39
unsigned short Length
Definition: sprintf.c:451
PNP_FCB NTAPI NpFindPrefix(IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix)
Definition: prefxsup.c:20
#define NPFS_NTC_CCB
Definition: npfs.h:115
IRP
Definition: iotypes.h:2462
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
VOID NTAPI NpCheckForNotify(IN PNP_DCB Dcb, IN BOOLEAN SecondList, IN PLIST_ENTRY List)
Definition: create.c:20
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
NTSTATUS NTAPI NpFsdCreateNamedPipe(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: create.c:791
struct _FCB * ParentDcb
Definition: fatstruc.h:832
#define SL_FORCE_ACCESS_CHECK
Definition: iotypes.h:1772
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4157
struct _NP_DCB * PNP_DCB
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
#define FILE_SHARE_READ
Definition: compat.h:125
uint32_t ULONG_PTR
Definition: typedefs.h:63
IO_STATUS_BLOCK NTAPI NpOpenNamedPipeRootDirectory(IN PNP_DCB Dcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PLIST_ENTRY List)
Definition: create.c:75
PEPROCESS NTAPI IoThreadToProcess(IN PETHREAD Thread)
Definition: util.c:161
Definition: npfs.h:210
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: npfs.h:228
Definition: npfs.h:258
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
struct _FCB::@684::@687 Fcb
#define FILE_READ_DATA
Definition: nt_native.h:628
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT FileObject
Definition: create.c:4157
IO_STATUS_BLOCK NTAPI NpOpenNamedPipeFileSystem(IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess)
Definition: create.c:57
NTSTATUS NTAPI NpFindRelativePrefix(IN PNP_DCB Dcb, IN PUNICODE_STRING Name, IN ULONG CaseInsensitiveIndex, IN PUNICODE_STRING Prefix, OUT PNP_FCB *FoundFcb)
Definition: prefxsup.c:51
NTSTATUS NTAPI SeAppendPrivileges(IN OUT PACCESS_STATE AccessState, IN PPRIVILEGE_SET Privileges)
Definition: priv.c:407
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
ULONG ReferenceCount
Definition: npfs.h:280
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define IoCompleteRequest
Definition: irp.c:1240
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
#define FILE_WRITE_DATA
Definition: nt_native.h:631
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define FILE_PIPE_LISTENING_STATE
Definition: winternl.h:791
PAGED_CODE()
LONG NTAPI NpCompareAliasNames(_In_ PCUNICODE_STRING String1, _In_ PCUNICODE_STRING String2)
Definition: main.c:152
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define TRACE(s)
Definition: solgame.cpp:4
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
* PFILE_OBJECT
Definition: iotypes.h:1954
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:13
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
PNP_VCB NpVcb
Definition: strucsup.c:19
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:571
struct _NPFS_ALIAS * Next
Definition: npfs.h:293
NTSTATUS NTAPI NpCreateFcb(IN PNP_DCB Dcb, IN PUNICODE_STRING PipeName, IN ULONG MaximumInstances, IN LARGE_INTEGER Timeout, IN USHORT NamedPipeConfiguration, IN USHORT NamedPipeType, OUT PNP_FCB *NewFcb)
Definition: strucsup.c:210
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:414
NTSTATUS NTAPI ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor, OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor, IN ULONG RefBias)
Definition: obsdcach.c:364
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:871
static const WCHAR L[]
Definition: oid.c:1250
PUNICODE_STRING FileName
Definition: iotypes.h:2792
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
VOID NTAPI SeOpenObjectAuditAlarm(IN PUNICODE_STRING ObjectTypeName, IN PVOID Object OPTIONAL, IN PUNICODE_STRING AbsoluteObjectName OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN PACCESS_STATE AccessState, IN BOOLEAN ObjectCreated, IN BOOLEAN AccessGranted, IN KPROCESSOR_MODE AccessMode, OUT PBOOLEAN GenerateOnClose)
Definition: audit.c:803
Definition: typedefs.h:117
UNICODE_STRING Name
Definition: npfs.h:295
#define NPFS_NTC_ROOT_DCB
Definition: npfs.h:113
VOID NTAPI NpUninitializeSecurity(IN PNP_CCB Ccb)
Definition: secursup.c:72
NTSTATUS NTAPI NpCreateCcb(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN UCHAR State, IN UCHAR ReadMode, IN UCHAR CompletionMode, IN ULONG InQuota, IN ULONG OutQuota, OUT PNP_CCB *NewCcb)
Definition: strucsup.c:304
NTSTATUS NTAPI NpInitializeSecurity(IN PNP_CCB Ccb, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN PETHREAD Thread)
Definition: secursup.c:82
Status
Definition: gdiplustypes.h:24
#define FILE_OPEN
Definition: from_kernel.h:54
VOID NTAPI NpSetFileObject(IN PFILE_OBJECT FileObject, IN PVOID PrimaryContext, IN PVOID Ccb, IN ULONG NamedPipeEnd)
Definition: fileobsup.c:62
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
struct _FileName FileName
Definition: fatprocs.h:884
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
VOID NTAPI SeFreePrivileges(IN PPRIVILEGE_SET Privileges)
Definition: priv.c:480
VOID NTAPI NpDeleteCcb(IN PNP_CCB Ccb, IN PLIST_ENTRY ListEntry)
Definition: strucsup.c:92
unsigned short USHORT
Definition: pedump.c:61
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define MIN_INDEXED_LENGTH
Definition: npfs.h:32
#define FILE_PIPE_MESSAGE_MODE
Definition: iotypes.h:78
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE _In_ BOOLEAN _In_ BOOLEAN AccessGranted
Definition: sefuncs.h:414
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
PUNICODE_STRING TargetName
Definition: npfs.h:294
#define FILE_CREATED
Definition: nt_native.h:770
IO_STATUS_BLOCK NTAPI NpCreateExistingNamedPipe(IN PNP_FCB Fcb, IN PFILE_OBJECT FileObject, IN ACCESS_MASK DesiredAccess, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE PreviousMode, IN ULONG Disposition, IN ULONG ShareAccess, IN PNAMED_PIPE_CREATE_PARAMETERS Parameters, IN PEPROCESS Process, OUT PLIST_ENTRY List)
Definition: create.c:514
NTSTATUS NTAPI NpFsdCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: create.c:360
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
PNP_DCB RootDcb
Definition: npfs.h:281
#define OUT
Definition: typedefs.h:39
#define NPFS_NTC_FCB
Definition: npfs.h:114
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
NTSTATUS NTAPI NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue, IN PUNICODE_STRING PipeName, IN NTSTATUS Status, IN PLIST_ENTRY ListEntry)
Definition: waitsup.c:120
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 FILE_PIPE_INBOUND
Definition: iotypes.h:81
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
#define FILE_PIPE_FULL_DUPLEX
Definition: iotypes.h:83
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13
static const WCHAR BackSlash[]
Definition: devclass.c:29
return STATUS_SUCCESS
Definition: btrfs.c:2725
struct _NP_FCB * PNP_FCB
#define STATUS_PIPE_NOT_AVAILABLE
Definition: ntstatus.h:394
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
FORCEINLINE VOID NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
Definition: npfs.h:356
#define NPFS_NTC_VCB
Definition: npfs.h:112
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSTATUS NTAPI NpCreateNewNamedPipe(IN PNP_DCB Dcb, IN PFILE_OBJECT FileObject, IN UNICODE_STRING PipeName, IN ACCESS_MASK DesiredAccess, IN PACCESS_STATE AccessState, IN USHORT Disposition, IN USHORT ShareAccess, IN PNAMED_PIPE_CREATE_PARAMETERS Parameters, IN PEPROCESS Process, IN PLIST_ENTRY List, OUT PIO_STATUS_BLOCK IoStatus)
Definition: create.c:656
_In_ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext
Definition: sefuncs.h:13
#define NT_ASSERT
Definition: rtlfuncs.h:3312