ReactOS 0.4.16-dev-199-g898cc56
irp.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel Streaming
4 * FILE: drivers/ksfilter/ks/factory.c
5 * PURPOSE: KS Allocator functions
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9#include "precomp.h"
10
11#include <ntifs.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/*
17 @implemented
18*/
24 IN PIRP Irp)
25{
26 PKSOBJECT_CREATE_ITEM CreateItem;
27 PIO_STACK_LOCATION IoStack;
30
31 /* get current irp stack */
33
34 /* get create item */
35 CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
36
37 if (!CreateItem || !CreateItem->SecurityDescriptor)
38 {
39 /* no create item */
40 Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
43 }
44
45
46 /* get input length */
47 Length = IoStack->Parameters.QuerySecurity.Length;
48
49 /* clone the security descriptor */
50 Status = SeQuerySecurityDescriptorInfo(&IoStack->Parameters.QuerySecurity.SecurityInformation, (PSECURITY_DESCRIPTOR)Irp->UserBuffer, &Length, &CreateItem->SecurityDescriptor);
51
52 DPRINT("SeQuerySecurityDescriptorInfo Status %x\n", Status);
53 /* store result */
54 Irp->IoStatus.Status = Status;
55 Irp->IoStatus.Information = Length;
56
58 return Status;
59}
60
61/*
62 @implemented
63*/
69 IN PIRP Irp)
70{
71 PKSOBJECT_CREATE_ITEM CreateItem;
72 PIO_STACK_LOCATION IoStack;
76
77 /* get current irp stack */
79
80 /* get create item */
81 CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
82
83 if (!CreateItem || !CreateItem->SecurityDescriptor)
84 {
85 /* no create item */
86 Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
89 }
90
91 /* backup old descriptor */
92 Descriptor = CreateItem->SecurityDescriptor;
93
94 /* get generic mapping */
96
97 /* change security descriptor */
99 &IoStack->Parameters.SetSecurity.SecurityInformation,
100 IoStack->Parameters.SetSecurity.SecurityDescriptor,
101 &CreateItem->SecurityDescriptor,
103 Mapping);
104
105 if (NT_SUCCESS(Status))
106 {
107 /* free old descriptor */
109
110 /* mark create item as changed */
111 CreateItem->Flags |= KSCREATE_ITEM_SECURITYCHANGED;
112 }
113
114 /* store result */
115 Irp->IoStatus.Status = Status;
117
118 return Status;
119}
120
121/*
122 @unimplemented
123*/
126NTAPI
128 IN PIRP Irp,
129 IN PFNKSHANDLER Handler)
130{
132 return STATUS_UNSUCCESSFUL;
133}
134
135
136/*
137 @implemented
138*/
141NTAPI
145 IN PVOID PortContext OPTIONAL,
150 IN KPROCESSOR_MODE RequestorMode)
151{
153 PIO_STACK_LOCATION IoStack;
154 PIRP Irp;
157 KEVENT LocalEvent;
158
159 if (Event)
160 {
161 /* make sure event is reset */
163 }
164
165 if (RequestorMode == UserMode)
166 {
167 /* probe the user buffer */
169 {
170 ProbeForWrite(Buffer, Length, sizeof(UCHAR));
172 }
174 {
175 /* Exception, get the error code */
177 }
178 _SEH2_END;
179
180 if (!NT_SUCCESS(Status))
181 {
182 DPRINT1("Invalid user buffer provided\n");
183 return Status;
184 }
185 }
186
187 /* get corresponding device object */
189
190 /* fast-io read is only available for kernel mode clients */
191 if (RequestorMode == KernelMode && ExGetPreviousMode() == KernelMode &&
192 DeviceObject->DriverObject->FastIoDispatch->FastIoRead)
193 {
194 /* call fast io write */
195 Result = DeviceObject->DriverObject->FastIoDispatch->FastIoRead(FileObject, &FileObject->CurrentByteOffset, Length, TRUE, Key, Buffer, IoStatusBlock, DeviceObject);
196
198 {
199 /* request was handled and succeeded */
200 return STATUS_SUCCESS;
201 }
202 }
203
204 /* do the slow way */
205 if (!Event)
206 {
207 /* initialize temp event */
209 Event = &LocalEvent;
210 }
211
212 /* build the irp packet */
214 if (!Irp)
215 {
216 /* not enough resources */
218 }
219
220 /* setup the rest of irp */
221 Irp->RequestorMode = RequestorMode;
222 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
223 Irp->Tail.Overlay.OriginalFileObject = FileObject;
224
225 /* setup irp stack */
227 IoStack->FileObject = FileObject;
228 IoStack->Parameters.Read.Key = Key;
229
230 /* send the packet */
232
233 if (Status == STATUS_PENDING)
234 {
235 /* operation is pending, is sync file object */
236 if (FileObject->Flags & FO_SYNCHRONOUS_IO)
237 {
238 /* it is so wait */
241 }
242 }
243 /* return result */
244 return Status;
245}
246
247/*
248 @implemented
249*/
252NTAPI
256 IN PVOID PortContext OPTIONAL,
261 IN KPROCESSOR_MODE RequestorMode)
262{
264 PIO_STACK_LOCATION IoStack;
265 PIRP Irp;
268 KEVENT LocalEvent;
269
270 if (Event)
271 {
272 /* make sure event is reset */
274 }
275
276 if (RequestorMode == UserMode)
277 {
278 /* probe the user buffer */
280 {
281 ProbeForRead(Buffer, Length, sizeof(UCHAR));
283 }
285 {
286 /* Exception, get the error code */
288 }
289 _SEH2_END;
290
291 if (!NT_SUCCESS(Status))
292 {
293 DPRINT1("Invalid user buffer provided\n");
294 return Status;
295 }
296 }
297
298 /* get corresponding device object */
300
301 /* fast-io write is only available for kernel mode clients */
302 if (RequestorMode == KernelMode && ExGetPreviousMode() == KernelMode &&
303 DeviceObject->DriverObject->FastIoDispatch->FastIoWrite)
304 {
305 /* call fast io write */
306 Result = DeviceObject->DriverObject->FastIoDispatch->FastIoWrite(FileObject, &FileObject->CurrentByteOffset, Length, TRUE, Key, Buffer, IoStatusBlock, DeviceObject);
307
309 {
310 /* request was handled and succeeded */
311 return STATUS_SUCCESS;
312 }
313 }
314
315 /* do the slow way */
316 if (!Event)
317 {
318 /* initialize temp event */
320 Event = &LocalEvent;
321 }
322
323 /* build the irp packet */
325 if (!Irp)
326 {
327 /* not enough resources */
329 }
330
331 /* setup the rest of irp */
332 Irp->RequestorMode = RequestorMode;
333 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
334 Irp->Tail.Overlay.OriginalFileObject = FileObject;
335
336 /* setup irp stack */
338 IoStack->FileObject = FileObject;
339 IoStack->Parameters.Write.Key = Key;
340
341 /* send the packet */
343
344 if (Status == STATUS_PENDING)
345 {
346 /* operation is pending, is sync file object */
347 if (FileObject->Flags & FO_SYNCHRONOUS_IO)
348 {
349 /* it is so wait */
352 }
353 }
354 /* return result */
355 return Status;
356}
357
358/*
359 @implemented
360*/
363NTAPI
369{
372 PIRP Irp;
373 PIO_STACK_LOCATION IoStack;
378
379 /* get related file object */
381
382 /* get fast i/o table */
383 FastIoDispatch = DeviceObject->DriverObject->FastIoDispatch;
384
385 /* is there a fast table */
386 if (FastIoDispatch)
387 {
388 /* check the class */
390 {
391 /* use FastIoQueryBasicInfo routine */
395 TRUE,
399 {
400 /* request was handled */
401 return IoStatusBlock.Status;
402 }
403 }
405 {
406 /* use FastIoQueryStandardInfo routine */
410 TRUE,
414 {
415 /* request was handled */
416 return IoStatusBlock.Status;
417 }
418 }
419 }
420
421 /* clear event */
422 KeClearEvent(&FileObject->Event);
423
424 /* initialize event */
426
427 /* set offset to zero */
428 Offset.QuadPart = 0L;
429
430 /* build the request */
432 if (!Irp)
434
435 /* get next stack location */
437
438 /* setup parameters */
439 IoStack->Parameters.QueryFile.FileInformationClass = FileInformationClass;
440 IoStack->Parameters.QueryFile.Length = Length;
441 Irp->AssociatedIrp.SystemBuffer = FileInformation;
442
443
444 /* call the driver */
446
447 if (Status == STATUS_PENDING)
448 {
449 /* wait for the operation to complete */
451
452 /* is object sync */
453 if (FileObject->Flags & FO_SYNCHRONOUS_IO)
454 Status = FileObject->FinalStatus;
455 else
457 }
458
459 /* done */
460 return Status;
461}
462
463/*
464 @implemented
465*/
468NTAPI
474{
475 PIO_STACK_LOCATION IoStack;
477 PIRP Irp;
483
484 /* get related device object */
486
487 /* copy file information */
489 if (!Buffer)
491
493 {
494 ProbeForRead(Buffer, Length, sizeof(UCHAR));
497 }
499 {
500 /* Exception, get the error code */
502 }
503 _SEH2_END;
504
505 if (!NT_SUCCESS(Status))
506 {
507 /* invalid user buffer */
509 return Status;
510 }
511
512 /* initialize the event */
514
515 /* zero offset */
516 Offset.QuadPart = 0LL;
517
518 /* build the irp */
520 if (!Irp)
521 {
522 /* failed to allocate irp */
525 }
526
527 /* get next stack location */
529
530 /* set irp parameters */
531 IoStack->Parameters.SetFile.FileInformationClass = FileInformationClass;
532 IoStack->Parameters.SetFile.Length = Length;
533 IoStack->Parameters.SetFile.FileObject = FileObject;
534 Irp->AssociatedIrp.SystemBuffer = Buffer;
535 Irp->UserBuffer = FileInformation;
536
537 /* dispatch the irp */
539
540 if (Status == STATUS_PENDING)
541 {
542 /* wait untill the operation has completed */
544 /* is a sync file object */
545 if (FileObject->Flags & FO_SYNCHRONOUS_IO)
546 Status = FileObject->FinalStatus;
547 else
548 Status = IoStatus.Status;
549 }
550 /* done */
551 return Status;
552}
553
554/*
555 @implemented
556*/
559NTAPI
563 IN PVOID PortContext OPTIONAL,
566 IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL,
568 IN OUT PVOID StreamHeaders,
570 IN ULONG Flags,
571 IN KPROCESSOR_MODE RequestorMode)
572{
573 PIRP Irp;
574 PIO_STACK_LOCATION IoStack;
578 PKSIOBJECT_HEADER ObjectHeader;
579 BOOLEAN Ret;
580
581 /* get related device object */
583 /* sanity check */
585
586 /* is there a event provided */
587 if (Event)
588 {
589 /* reset event */
591 }
592
593 if (RequestorMode || ExGetPreviousMode() == KernelMode)
594 {
595 /* requestor is from kernel land */
596 ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext2;
597
598 if (ObjectHeader)
599 {
600 /* there is a object header */
601 if (Flags == KSSTREAM_READ)
602 {
603 /* is fast read supported */
604 if (ObjectHeader->DispatchTable.FastRead)
605 {
606 /* call fast read dispatch routine */
607 Ret = ObjectHeader->DispatchTable.FastRead(FileObject, NULL, Length, FALSE, 0, StreamHeaders, IoStatusBlock, DeviceObject);
608
609 if (Ret)
610 {
611 /* the request was handled */
612 return IoStatusBlock->Status;
613 }
614 }
615 }
616 else if (Flags == KSSTREAM_WRITE)
617 {
618 /* is fast write supported */
619 if (ObjectHeader->DispatchTable.FastWrite)
620 {
621 /* call fast write dispatch routine */
622 Ret = ObjectHeader->DispatchTable.FastWrite(FileObject, NULL, Length, FALSE, 0, StreamHeaders, IoStatusBlock, DeviceObject);
623
624 if (Ret)
625 {
626 /* the request was handled */
627 return IoStatusBlock->Status;
628 }
629 }
630 }
631 }
632 }
633
634 /* clear file object event */
635 KeClearEvent(&FileObject->Event);
636
637 /* set the offset to zero */
638 Offset.QuadPart = 0LL;
639
640 /* now build the irp */
642 DeviceObject, (PVOID)StreamHeaders, Length, &Offset, Event, IoStatusBlock);
643 if (!Irp)
644 {
645 /* not enough memory */
647 }
648
649 /* setup irp parameters */
650 Irp->RequestorMode = RequestorMode;
651 Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
652 Irp->Tail.Overlay.OriginalFileObject = FileObject;
653 Irp->UserBuffer = StreamHeaders;
654
655 /* get next irp stack location */
657 /* setup stack parameters */
658 IoStack->FileObject = FileObject;
659 IoStack->Parameters.DeviceIoControl.OutputBufferLength = Length;
660 IoStack->Parameters.DeviceIoControl.IoControlCode = (Flags == KSSTREAM_READ ? IOCTL_KS_READ_STREAM : IOCTL_KS_WRITE_STREAM);
661
663 {
664 /* setup completion routine for async processing */
665 IoSetCompletionRoutine(Irp, CompletionRoutine, CompletionContext, (CompletionInvocationFlags & KsInvokeOnSuccess), (CompletionInvocationFlags & KsInvokeOnError), (CompletionInvocationFlags & KsInvokeOnCancel));
666 }
667
668 /* now call the driver */
670 /* done */
671 return Status;
672}
673
674/*
675 @implemented
676*/
679NTAPI
681 IN PIRP Irp,
682 IN ULONG ProbeFlags,
683 IN ULONG HeaderSize)
684{
685 PMDL Mdl;
689 PKSSTREAM_HEADER StreamHeader;
690 PIO_STACK_LOCATION IoStack;
692 //BOOLEAN AllocateMdl = FALSE;
693
694 /* get current irp stack */
696
697 Length = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
698
699 if (Irp->RequestorMode == KernelMode || Irp->AssociatedIrp.SystemBuffer)
700 {
701 if (Irp->RequestorMode == KernelMode)
702 {
703 /* no need to allocate stream header */
704 Irp->AssociatedIrp.SystemBuffer = Irp->UserBuffer;
705 }
706AllocMdl:
707 /* check if alloc mdl flag is passed */
708 if (!(ProbeFlags & KSPROBE_ALLOCATEMDL))
709 {
710 /* nothing more to do */
711 return STATUS_SUCCESS;
712 }
713 if (Irp->MdlAddress)
714 {
715ProbeMdl:
716 if (ProbeFlags & KSPROBE_PROBEANDLOCK)
717 {
718 if (Irp->MdlAddress->MdlFlags & (MDL_PAGES_LOCKED | MDL_SOURCE_IS_NONPAGED_POOL))
719 {
720 if (ProbeFlags & KSPROBE_SYSTEMADDRESS)
721 {
723 {
724 /* loop through all mdls and probe them */
725 Mdl = Irp->MdlAddress;
726 do
727 {
728 /* the mapping can fail */
729 Mdl->MdlFlags |= MDL_MAPPING_CAN_FAIL;
730
732 {
733 /* no need to probe these pages */
734 Buffer = Mdl->MappedSystemVa;
735 }
736 else
737 {
738 /* probe that mdl */
740 }
741
742 /* check if the mapping succeeded */
743 if (!Buffer)
744 {
745 /* raise exception we'll catch */
747 }
748
749 /* iterate to next mdl */
750 Mdl = Mdl->Next;
751
752 }while(Mdl);
753 }
755 {
756 /* Exception, get the error code */
758 } _SEH2_END;
759 }
760 }
761 else
762 {
764 {
765 /* loop through all mdls and probe them */
766 Mdl = Irp->MdlAddress;
767
768 /* determine operation */
769 if (!(ProbeFlags & KSPROBE_STREAMWRITE) || (ProbeFlags & KSPROBE_MODIFY))
770 {
771 /* operation is read / modify stream, need write access */
773 }
774 else
775 {
776 /* operation is write to device, so we need read access */
778 }
779
780 do
781 {
782 /* probe the pages */
783 MmProbeAndLockPages(Mdl, Irp->RequestorMode, Operation);
784
785 if (ProbeFlags & KSPROBE_SYSTEMADDRESS)
786 {
787 /* the mapping can fail */
788 Mdl->MdlFlags |= MDL_MAPPING_CAN_FAIL;
789
791 {
792 /* no need to probe these pages */
793 Buffer = Mdl->MappedSystemVa;
794 }
795 else
796 {
797 /* probe that mdl */
799 }
800
801 /* check if the mapping succeeded */
802 if (!Buffer)
803 {
804 /* raise exception we'll catch */
806 }
807 }
808
809 /* iterate to next mdl */
810 Mdl = Mdl->Next;
811
812 }while(Mdl);
813 }
815 {
816 /* Exception, get the error code */
818 } _SEH2_END;
819 }
820 }
821 return Status;
822 }
823
824 /* check all stream headers */
825 StreamHeader = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
826 ASSERT(StreamHeader);
828 {
829 do
830 {
831 if (HeaderSize)
832 {
833 /* does the supplied header size match stream header size and no type changed */
834 if (StreamHeader->Size != HeaderSize && !(StreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED))
835 {
836 /* invalid stream header */
838 }
839 }
840 else
841 {
842 /* stream must be at least of size KSSTREAM_HEADER and size must be 8-byte block aligned */
843 if (StreamHeader->Size < sizeof(KSSTREAM_HEADER) || (StreamHeader->Size & 7))
844 {
845 /* invalid stream header */
847 }
848 }
849
850 if (Length < StreamHeader->Size)
851 {
852 /* length is too short */
854 }
855
856 if (ProbeFlags & KSPROBE_STREAMWRITE)
857 {
858 if (StreamHeader->DataUsed > StreamHeader->FrameExtent)
859 {
860 /* frame extend can never be smaller */
862 }
863
864 /* is this stream change packet */
866 {
867 if (Length != sizeof(KSSTREAM_HEADER) || (PVOID)StreamHeader != Irp->AssociatedIrp.SystemBuffer)
868 {
869 /* stream changed - must be send in a single packet */
871 }
872
873 if (!(ProbeFlags & KSPROBE_ALLOWFORMATCHANGE))
874 {
875 /* caller does not permit format changes */
877 }
878
879 if (StreamHeader->FrameExtent)
880 {
881 /* allocate an mdl */
882 Mdl = IoAllocateMdl(StreamHeader->Data, StreamHeader->FrameExtent, FALSE, TRUE, Irp);
883
884 if (!Mdl)
885 {
886 /* not enough memory */
888 }
889
890 /* break-out to probe for the irp */
891 break;
892 }
893 }
894 }
895 else
896 {
897 if (StreamHeader->DataUsed)
898 {
899 /* DataUsed must be zero for stream read operation */
901 }
902
903 if (StreamHeader->OptionsFlags)
904 {
905 /* no flags supported for reading */
907 }
908 }
909
910 if (StreamHeader->FrameExtent)
911 {
912 /* allocate an mdl */
913 ASSERT(Irp->MdlAddress == NULL);
914 Mdl = IoAllocateMdl(StreamHeader->Data, StreamHeader->FrameExtent, FALSE, TRUE, Irp);
915 if (!Mdl)
916 {
917 /* not enough memory */
919 }
920 }
921
922 /* move to next stream header */
923 Length -= StreamHeader->Size;
924 StreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)StreamHeader + StreamHeader->Size);
925 }while(Length);
926 }
928 {
929 /* Exception, get the error code */
931 }_SEH2_END;
932
933 /* now probe the allocated mdl's */
934 if (!NT_SUCCESS(Status))
935 {
936 DPRINT("Status %x\n", Status);
937 return Status;
938 }
939 else
940 goto ProbeMdl;
941 }
942
943 /* probe user mode buffers */
944 if (Length && ( (!HeaderSize) || (Length % HeaderSize == 0) || ((ProbeFlags & KSPROBE_ALLOWFORMATCHANGE) && (Length == sizeof(KSSTREAM_HEADER))) ) )
945 {
946 /* allocate stream header buffer */
947 Irp->AssociatedIrp.SystemBuffer = AllocateItem(NonPagedPool, Length);
948
949 if (!Irp->AssociatedIrp.SystemBuffer)
950 {
951 /* no memory */
953 }
954
955 /* mark irp as buffered so that changes the stream headers are propagated back */
957
959 {
960 if (ProbeFlags & KSPROBE_STREAMWRITE)
961 {
962 if (ProbeFlags & KSPROBE_MODIFY)
963 ProbeForWrite(Irp->UserBuffer, Length, sizeof(UCHAR));
964 else
965 ProbeForRead(Irp->UserBuffer, Length, sizeof(UCHAR));
966 }
967 else
968 {
969 /* stream reads means writing */
970 ProbeForWrite(Irp->UserBuffer, Length, sizeof(UCHAR));
971
972 /* set input operation flags */
973 Irp->Flags |= IRP_INPUT_OPERATION;
974 }
975
976 /* copy stream buffer */
977 RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer, Irp->UserBuffer, Length);
978 }
980 {
981 /* Exception, get the error code */
983 }_SEH2_END;
984
985 if (!NT_SUCCESS(Status))
986 {
987 /* failed */
988 return Status;
989 }
990
991 if (ProbeFlags & KSPROBE_ALLOCATEMDL)
992 {
993 /* alloc mdls */
994 goto AllocMdl;
995 }
996
997 /* check all stream headers */
998 StreamHeader = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
999
1000 _SEH2_TRY
1001 {
1002 do
1003 {
1004 if (HeaderSize)
1005 {
1006 /* does the supplied header size match stream header size and no type changed */
1007 if (StreamHeader->Size != HeaderSize && !(StreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TYPECHANGED))
1008 {
1009 /* invalid stream header */
1011 }
1012 }
1013 else
1014 {
1015 /* stream must be at least of size KSSTREAM_HEADER and size must be 8-byte block aligned */
1016 if (StreamHeader->Size < sizeof(KSSTREAM_HEADER) || (StreamHeader->Size & 7))
1017 {
1018 /* invalid stream header */
1020 }
1021 }
1022
1023 if (Length < StreamHeader->Size)
1024 {
1025 /* length is too short */
1027 }
1028
1029 if (ProbeFlags & KSPROBE_STREAMWRITE)
1030 {
1031 if (StreamHeader->DataUsed > StreamHeader->FrameExtent)
1032 {
1033 /* frame extend can never be smaller */
1035 }
1036
1037 /* is this stream change packet */
1039 {
1040 if (Length != sizeof(KSSTREAM_HEADER) || (PVOID)StreamHeader != Irp->AssociatedIrp.SystemBuffer)
1041 {
1042 /* stream changed - must be send in a single packet */
1044 }
1045
1046 if (!(ProbeFlags & KSPROBE_ALLOWFORMATCHANGE))
1047 {
1048 /* caller does not permit format changes */
1050 }
1051
1052 if (StreamHeader->FrameExtent)
1053 {
1054 /* allocate an mdl */
1055 Mdl = IoAllocateMdl(StreamHeader->Data, StreamHeader->FrameExtent, FALSE, TRUE, Irp);
1056
1057 if (!Mdl)
1058 {
1059 /* not enough memory */
1061 }
1062
1063 /* break out to probe for the irp */
1064 //AllocateMdl = TRUE;
1065 break;
1066 }
1067 }
1068 }
1069 else
1070 {
1071 if (StreamHeader->DataUsed)
1072 {
1073 /* DataUsed must be zero for stream read operation */
1075 }
1076
1077 if (StreamHeader->OptionsFlags)
1078 {
1079 /* no flags supported for reading */
1081 }
1082 }
1083
1084 /* move to next stream header */
1085 Length -= StreamHeader->Size;
1086 StreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)StreamHeader + StreamHeader->Size);
1087 }while(Length);
1088
1090 {
1091 /* Exception, get the error code */
1093 }_SEH2_END;
1094
1095 /* now probe the allocated mdl's */
1096 if (NT_SUCCESS(Status))
1097 goto AllocMdl;
1098 else
1099 return Status;
1100 }
1101
1103}
1104
1105/*
1106 @implemented
1107*/
1110NTAPI
1112 IN PIRP Irp,
1113 IN ULONG ExtraSize,
1114 OUT PVOID* ExtraBuffer)
1115{
1116 PIO_STACK_LOCATION IoStack;
1117 ULONG Count, Index;
1118 PUCHAR Buffer, BufferOrg;
1121
1122 /* get current irp stack */
1124
1125 /* sanity check */
1126 ASSERT(IoStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(KSSTREAM_HEADER));
1127
1128 /* get total length */
1129 Count = IoStack->Parameters.DeviceIoControl.InputBufferLength / sizeof(KSSTREAM_HEADER);
1130
1131 /* allocate buffer */
1132 Buffer = BufferOrg = AllocateItem(NonPagedPool, Count * (sizeof(KSSTREAM_HEADER) + ExtraSize));
1133 if (!Buffer)
1135
1136 _SEH2_TRY
1137 {
1138 /* get input buffer */
1139 Header = (PKSSTREAM_HEADER)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
1140 for(Index = 0; Index < Count; Index++)
1141 {
1142 /* copy stream header */
1144
1145 /* move to next header */
1146 Header++;
1147 /* increment output buffer offset */
1148 Buffer += sizeof(KSSTREAM_HEADER) + ExtraSize;
1149 }
1150 }
1152 {
1153 /* Exception, get the error code */
1155 }
1156 _SEH2_END;
1157
1158 if (!NT_SUCCESS(Status))
1159 {
1160 /* free buffer on exception */
1162 return Status;
1163 }
1164
1165 /* store result */
1166 *ExtraBuffer = BufferOrg;
1167
1168 /* done */
1169 return STATUS_SUCCESS;
1170}
1171
1172/*
1173 @implemented
1174*/
1176VOID
1177NTAPI
1180{
1181}
1182
1183/*
1184 @implemented
1185*/
1188NTAPI
1191 IN PIRP Irp)
1192{
1193 Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
1195
1197}
1198
1199/*
1200 @implemented
1201*/
1204NTAPI
1207 IN PIRP Irp)
1208{
1209 PIO_STACK_LOCATION IoStack;
1211
1212 /* get current irp stack */
1214
1215 if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY &&
1216 IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_METHOD &&
1217 IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_ENABLE_EVENT &&
1218 IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_DISABLE_EVENT)
1219 {
1220 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
1221 {
1222 /* fake success */
1224 }
1225 else
1226 {
1227 /* request unsupported */
1229 }
1230 }
1231 else
1232 {
1233 /* property / method / event not found */
1235 }
1236
1237 /* complete request */
1238 Irp->IoStatus.Status = Status;
1240
1241
1242 return Status;
1243}
1244
1245/*
1246 @implemented
1247*/
1249BOOLEAN
1250NTAPI
1253 IN BOOLEAN Wait,
1261{
1262 return FALSE;
1263}
1264
1265/*
1266 @implemented
1267*/
1269BOOLEAN
1270NTAPI
1274 IN ULONG Length,
1275 IN BOOLEAN Wait,
1280{
1281 return FALSE;
1282}
1283
1284
1285/*
1286 @implemented
1287*/
1289VOID
1290NTAPI
1292 IN OUT PLIST_ENTRY QueueHead,
1294{
1295 PDRIVER_CANCEL OldDriverCancel;
1296 PIO_STACK_LOCATION IoStack;
1298 PLIST_ENTRY NextEntry;
1299 PIRP Irp;
1300 KIRQL OldLevel;
1301
1302 /* acquire spinlock */
1303 KeAcquireSpinLock(SpinLock, &OldLevel);
1304 /* point to first entry */
1305 Entry = QueueHead->Flink;
1306 /* loop all items */
1307 while(Entry != QueueHead)
1308 {
1309 /* get irp offset */
1310 Irp = (PIRP)CONTAINING_RECORD(Entry, IRP, Tail.Overlay.ListEntry);
1311
1312 /* get next entry */
1313 NextEntry = Entry->Flink;
1314
1315 /* set cancelled bit */
1316 Irp->Cancel = TRUE;
1317
1318 /* now set the cancel routine */
1319 OldDriverCancel = IoSetCancelRoutine(Irp, NULL);
1320 if (OldDriverCancel)
1321 {
1322 /* this irp hasnt been yet used, so free to cancel */
1323 KeReleaseSpinLock(SpinLock, OldLevel);
1324
1325 /* get current irp stack */
1327
1328 /* acquire cancel spinlock */
1329 IoAcquireCancelSpinLock(&Irp->CancelIrql);
1330
1331 /* call provided cancel routine */
1332 OldDriverCancel(IoStack->DeviceObject, Irp);
1333
1334 /* re-acquire spinlock */
1335 KeAcquireSpinLock(SpinLock, &OldLevel);
1336 }
1337
1338 /* move on to next entry */
1339 Entry = NextEntry;
1340 }
1341
1342 /* the irp has already been canceled */
1343 KeReleaseSpinLock(SpinLock, OldLevel);
1344
1345}
1346
1347/*
1348 @implemented
1349*/
1351VOID
1352NTAPI
1354 IN PIRP Irp,
1355 IN PDRIVER_CANCEL DriverCancel OPTIONAL)
1356{
1358 PDRIVER_CANCEL OldDriverCancel;
1359 PIO_STACK_LOCATION IoStack;
1360 KIRQL OldLevel;
1361
1362 /* check for required parameters */
1363 if (!Irp)
1364 return;
1365
1366 if (!DriverCancel)
1367 {
1368 /* default to KsCancelRoutine */
1369 DriverCancel = KsCancelRoutine;
1370 }
1371
1372 /* get current irp stack */
1374
1375 /* get internal queue lock */
1376 SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp);
1377
1378 /* acquire spinlock */
1379 KeAcquireSpinLock(SpinLock, &OldLevel);
1380
1381 /* now set the cancel routine */
1382 OldDriverCancel = IoSetCancelRoutine(Irp, DriverCancel);
1383
1384 if (Irp->Cancel && OldDriverCancel == NULL)
1385 {
1386 /* the irp has already been canceled */
1387 KeReleaseSpinLock(SpinLock, OldLevel);
1388
1389 /* cancel routine requires that cancel spinlock is held */
1390 IoAcquireCancelSpinLock(&Irp->CancelIrql);
1391
1392 /* cancel irp */
1393 DriverCancel(IoStack->DeviceObject, Irp);
1394 }
1395 else
1396 {
1397 /* done */
1398 KeReleaseSpinLock(SpinLock, OldLevel);
1399 }
1400}
1401
1402/*
1403 @implemented
1404*/
1406PIRP
1407NTAPI
1409 IN OUT PLIST_ENTRY QueueHead,
1411 IN KSLIST_ENTRY_LOCATION ListLocation,
1412 IN KSIRP_REMOVAL_OPERATION RemovalOperation)
1413{
1414 PIRP Irp;
1415 PLIST_ENTRY CurEntry;
1416 KIRQL OldIrql;
1417
1418 DPRINT("KsRemoveIrpFromCancelableQueue ListHead %p SpinLock %p ListLocation %x RemovalOperation %x\n", QueueHead, SpinLock, ListLocation, RemovalOperation);
1419
1420 /* check parameters */
1421 if (!QueueHead || !SpinLock)
1422 return NULL;
1423
1424 /* check if parameter ListLocation is valid */
1425 if (ListLocation != KsListEntryTail && ListLocation != KsListEntryHead)
1426 return NULL;
1427
1428 /* acquire list lock */
1430
1431 /* point to queue head */
1432 CurEntry = QueueHead;
1433
1434 do
1435 {
1436 /* reset irp to null */
1437 Irp = NULL;
1438
1439 /* iterate to next entry */
1440 if (ListLocation == KsListEntryHead)
1441 CurEntry = CurEntry->Flink;
1442 else
1443 CurEntry = CurEntry->Blink;
1444
1445 /* is the end of list reached */
1446 if (CurEntry == QueueHead)
1447 {
1448 /* reached end of list */
1449 break;
1450 }
1451
1452 /* get irp offset */
1453 Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
1454
1455 if (Irp->Cancel)
1456 {
1457 /* irp has been canceled */
1458 break;
1459 }
1460
1461 if (Irp->CancelRoutine)
1462 {
1463 /* remove cancel routine */
1464 Irp->CancelRoutine = NULL;
1465
1466 if (RemovalOperation == KsAcquireAndRemove || RemovalOperation == KsAcquireAndRemoveOnlySingleItem)
1467 {
1468 /* remove irp from list */
1469 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
1470 }
1471
1472 if (RemovalOperation == KsAcquireAndRemoveOnlySingleItem || RemovalOperation == KsAcquireOnlySingleItem)
1473 break;
1474 }
1475
1476 }while(TRUE);
1477
1478 /* release lock */
1480
1481 if (!Irp || Irp->CancelRoutine == NULL)
1482 {
1483 /* either an irp has been acquired or nothing found */
1484 return Irp;
1485 }
1486
1487 /* time to remove the canceled irp */
1489 /* acquire list lock */
1491
1492 if (RemovalOperation == KsAcquireAndRemove || RemovalOperation == KsAcquireAndRemoveOnlySingleItem)
1493 {
1494 /* remove it */
1495 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
1496 }
1497
1498 /* release list lock */
1500
1501 /* release cancel spinlock */
1503 /* no non canceled irp has been found */
1504 return NULL;
1505}
1506
1507/*
1508 @implemented
1509*/
1512NTAPI
1515 IN PKSPIN_LOCK SourceLock,
1516 IN OUT PLIST_ENTRY DestinationList,
1517 IN PKSPIN_LOCK DestinationLock OPTIONAL,
1518 IN KSLIST_ENTRY_LOCATION ListLocation,
1519 IN PFNKSIRPLISTCALLBACK ListCallback,
1521{
1522 KIRQL OldLevel;
1523 PLIST_ENTRY SrcEntry;
1524 PIRP Irp;
1526
1527 if (!DestinationLock)
1528 {
1529 /* no destination lock just acquire the source lock */
1530 KeAcquireSpinLock(SourceLock, &OldLevel);
1531 }
1532 else
1533 {
1534 /* acquire cancel spinlock */
1535 IoAcquireCancelSpinLock(&OldLevel);
1536
1537 /* now acquire source lock */
1538 KeAcquireSpinLockAtDpcLevel(SourceLock);
1539
1540 /* now acquire destination lock */
1541 KeAcquireSpinLockAtDpcLevel(DestinationLock);
1542 }
1543
1544 /* point to list head */
1545 SrcEntry = SourceList;
1546
1547 /* now move all irps */
1548 while(TRUE)
1549 {
1550 if (ListLocation == KsListEntryTail)
1551 {
1552 /* move queue downwards */
1553 SrcEntry = SrcEntry->Flink;
1554 }
1555 else
1556 {
1557 /* move queue upwards */
1558 SrcEntry = SrcEntry->Blink;
1559 }
1560
1561 if (SrcEntry == SourceList)
1562 {
1563 /* eof list reached */
1564 break;
1565 }
1566
1567 /* get irp offset */
1568 Irp = (PIRP)CONTAINING_RECORD(SrcEntry, IRP, Tail.Overlay.ListEntry);
1569
1570 /* now check if irp can be moved */
1571 Status = ListCallback(Irp, Context);
1572
1573 /* check if irp can be moved */
1574 if (Status == STATUS_SUCCESS)
1575 {
1576 /* remove irp from src list */
1577 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
1578
1579 if (ListLocation == KsListEntryTail)
1580 {
1581 /* insert irp end of list */
1582 InsertTailList(DestinationList, &Irp->Tail.Overlay.ListEntry);
1583 }
1584 else
1585 {
1586 /* insert irp head of list */
1587 InsertHeadList(DestinationList, &Irp->Tail.Overlay.ListEntry);
1588 }
1589
1590 /* do we need to update the irp lock */
1591 if (DestinationLock)
1592 {
1593 /* update irp lock */
1594 KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) = DestinationLock;
1595 }
1596 }
1597 else
1598 {
1599 if (Status != STATUS_NO_MATCH)
1600 {
1601 /* callback decided to stop enumeration */
1602 break;
1603 }
1604
1605 /* reset return value */
1607 }
1608 }
1609
1610 if (!DestinationLock)
1611 {
1612 /* release source lock */
1613 KeReleaseSpinLock(SourceLock, OldLevel);
1614 }
1615 else
1616 {
1617 /* now release destination lock */
1618 KeReleaseSpinLockFromDpcLevel(DestinationLock);
1619
1620 /* now release source lock */
1622
1623
1624 /* now release cancel spinlock */
1625 IoReleaseCancelSpinLock(OldLevel);
1626 }
1627
1628 /* done */
1629 return Status;
1630}
1631
1632/*
1633 @implemented
1634*/
1636VOID
1637NTAPI
1639 IN PIRP Irp)
1640{
1642 KIRQL OldLevel;
1643
1644 DPRINT("KsRemoveSpecificIrpFromCancelableQueue %p\n", Irp);
1645
1646 /* get internal queue lock */
1647 SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp);
1648
1649 /* acquire spinlock */
1650 KeAcquireSpinLock(SpinLock, &OldLevel);
1651
1652 /* remove the irp from the list */
1653 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
1654
1655 /* release spinlock */
1656 KeReleaseSpinLock(SpinLock, OldLevel);
1657}
1658
1659
1660/*
1661 @implemented
1662*/
1664VOID
1665NTAPI
1667 IN OUT PLIST_ENTRY QueueHead,
1669 IN PIRP Irp,
1670 IN KSLIST_ENTRY_LOCATION ListLocation,
1671 IN PDRIVER_CANCEL DriverCancel OPTIONAL)
1672{
1673 PDRIVER_CANCEL OldDriverCancel;
1674 PIO_STACK_LOCATION IoStack;
1675 KIRQL OldLevel;
1676
1677 /* check for required parameters */
1678 if (!QueueHead || !SpinLock || !Irp)
1679 return;
1680
1681 /* get current irp stack */
1683
1684 DPRINT("KsAddIrpToCancelableQueue QueueHead %p SpinLock %p Irp %p ListLocation %x DriverCancel %p\n", QueueHead, SpinLock, Irp, ListLocation, DriverCancel);
1685
1686 // HACK for ms portcls
1687 if (IoStack->MajorFunction == IRP_MJ_CREATE)
1688 {
1689 // complete the request
1690 DPRINT1("MS HACK\n");
1691 Irp->IoStatus.Status = STATUS_SUCCESS;
1693
1694 return;
1695 }
1696
1697
1698 if (!DriverCancel)
1699 {
1700 /* default to KsCancelRoutine */
1701 DriverCancel = KsCancelRoutine;
1702 }
1703
1704
1705 /* acquire spinlock */
1706 KeAcquireSpinLock(SpinLock, &OldLevel);
1707
1708 if (ListLocation == KsListEntryTail)
1709 {
1710 /* insert irp to tail of list */
1711 InsertTailList(QueueHead, &Irp->Tail.Overlay.ListEntry);
1712 }
1713 else
1714 {
1715 /* insert irp to head of list */
1716 InsertHeadList(QueueHead, &Irp->Tail.Overlay.ListEntry);
1717 }
1718
1719 /* store internal queue lock */
1720 KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) = SpinLock;
1721
1722 /* now set the cancel routine */
1723 OldDriverCancel = IoSetCancelRoutine(Irp, DriverCancel);
1724
1725 if (Irp->Cancel && OldDriverCancel == NULL)
1726 {
1727 /* the irp has already been canceled */
1728 KeReleaseSpinLock(SpinLock, OldLevel);
1729
1730 /* cancel routine requires that cancel spinlock is held */
1731 IoAcquireCancelSpinLock(&Irp->CancelIrql);
1732
1733 /* cancel irp */
1734 DriverCancel(IoStack->DeviceObject, Irp);
1735 }
1736 else
1737 {
1738 /* done */
1739 KeReleaseSpinLock(SpinLock, OldLevel);
1740 }
1741}
1742
1743/*
1744 @implemented
1745*/
1747VOID
1748NTAPI
1751 IN PIRP Irp)
1752{
1754
1755 /* get internal queue lock */
1756 SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp);
1757
1758 /* acquire spinlock */
1760
1761 /* sanity check */
1763
1764 /* release cancel spinlock */
1765 IoReleaseCancelSpinLock(Irp->CancelIrql);
1766
1767 /* remove the irp from the list */
1768 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
1769
1770 /* release spinlock */
1771 KeReleaseSpinLock(SpinLock, Irp->CancelIrql);
1772
1773 /* has the irp already been canceled */
1774 if (Irp->IoStatus.Status != STATUS_CANCELLED)
1775 {
1776 /* let's complete it */
1777 Irp->IoStatus.Status = STATUS_CANCELLED;
1779 }
1780}
1781
1784 PLIST_ENTRY ListHead,
1786 OUT PCREATE_ITEM_ENTRY *OutCreateItem)
1787{
1789 PCREATE_ITEM_ENTRY CreateItemEntry;
1791 LPWSTR pStr;
1792 ULONG Count;
1793
1794 /* Copy the input string */
1795 RefString = *String;
1796
1797 /* Check if the string starts with a backslash */
1798 if (String->Buffer[0] == L'\\')
1799 {
1800 /* Skip backslash */
1801 RefString.Buffer++;
1802 RefString.Length -= sizeof(WCHAR);
1803 }
1804 else
1805 {
1806 /* get terminator */
1807 pStr = String->Buffer;
1808 Count = String->Length / sizeof(WCHAR);
1809 while ((Count > 0) && (*pStr != L'\\'))
1810 {
1811 pStr++;
1812 Count--;
1813 }
1814
1815 /* sanity check */
1816 ASSERT(Count != 0);
1817
1818 // request is for pin / node / allocator
1819 RefString.Length = (USHORT)((PCHAR)pStr - (PCHAR)String->Buffer);
1820 }
1821
1822 /* point to first entry */
1823 Entry = ListHead->Flink;
1824
1825 /* loop all device items */
1826 while (Entry != ListHead)
1827 {
1828 /* get create item entry */
1829 CreateItemEntry = (PCREATE_ITEM_ENTRY)CONTAINING_RECORD(Entry,
1831 Entry);
1832
1833 ASSERT(CreateItemEntry->CreateItem);
1834
1835 if(CreateItemEntry->CreateItem->Flags & KSCREATE_ITEM_WILDCARD)
1836 {
1837 /* create item is default */
1838 *OutCreateItem = CreateItemEntry;
1839 return STATUS_SUCCESS;
1840 }
1841
1842 if (!CreateItemEntry->CreateItem->Create)
1843 {
1844 /* skip free create item */
1845 Entry = Entry->Flink;
1846 continue;
1847 }
1848
1849 DPRINT("CreateItem %S Length %u Request %wZ %u\n",
1850 CreateItemEntry->CreateItem->ObjectClass.Buffer,
1851 CreateItemEntry->CreateItem->ObjectClass.Length,
1852 &RefString,
1853 RefString.Length);
1854
1855 if (CreateItemEntry->CreateItem->ObjectClass.Length > RefString.Length)
1856 {
1857 /* create item doesnt match in length */
1858 Entry = Entry->Flink;
1859 continue;
1860 }
1861
1862 /* now check if the object class is the same */
1863 if (!RtlCompareUnicodeString(&CreateItemEntry->CreateItem->ObjectClass,
1864 &RefString,
1865 TRUE))
1866 {
1867 /* found matching create item */
1868 *OutCreateItem = CreateItemEntry;
1869 return STATUS_SUCCESS;
1870 }
1871 /* iterate to next */
1872 Entry = Entry->Flink;
1873 }
1874
1875 return STATUS_NOT_FOUND;
1876}
1877
1879NTAPI
1882 IN PIRP Irp)
1883{
1884 PCREATE_ITEM_ENTRY CreateItemEntry;
1885 PIO_STACK_LOCATION IoStack;
1886 PDEVICE_EXTENSION DeviceExtension;
1887 PKSIDEVICE_HEADER DeviceHeader;
1888 PKSIOBJECT_HEADER ObjectHeader;
1890
1891 DPRINT("KS / CREATE\n");
1892
1893 /* get current stack location */
1895 /* get device extension */
1896 DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
1897 /* get device header */
1898 DeviceHeader = DeviceExtension->DeviceHeader;
1899
1900
1901 if (IoStack->FileObject->FileName.Buffer == NULL)
1902 {
1903 /* FIXME Pnp-Issue */
1904 DPRINT("Using reference string hack\n");
1905 Irp->IoStatus.Information = 0;
1906 /* set return status */
1907 Irp->IoStatus.Status = STATUS_SUCCESS;
1909 return STATUS_SUCCESS;
1910 }
1911
1912 if (IoStack->FileObject->RelatedFileObject != NULL)
1913 {
1914 /* request is to instantiate a pin / node / clock / allocator */
1915 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->RelatedFileObject->FsContext2;
1916
1917 /* sanity check */
1918 ASSERT(ObjectHeader);
1919
1920 /* find a matching a create item */
1921 Status = FindMatchingCreateItem(&ObjectHeader->ItemList,
1922 &IoStack->FileObject->FileName,
1923 &CreateItemEntry);
1924 }
1925 else
1926 {
1927 /* request to create a filter */
1928 Status = FindMatchingCreateItem(&DeviceHeader->ItemList,
1929 &IoStack->FileObject->FileName,
1930 &CreateItemEntry);
1931 }
1932
1933 if (NT_SUCCESS(Status))
1934 {
1935 /* set object create item */
1936 KSCREATE_ITEM_IRP_STORAGE(Irp) = CreateItemEntry->CreateItem;
1937
1938 /* call create function */
1939 Status = CreateItemEntry->CreateItem->Create(DeviceObject, Irp);
1940
1941 if (NT_SUCCESS(Status))
1942 {
1943 /* increment create item reference count */
1944 InterlockedIncrement(&CreateItemEntry->ReferenceCount);
1945 }
1946 return Status;
1947 }
1948
1949 Irp->IoStatus.Information = 0;
1950 /* set return status */
1951 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
1953 return STATUS_UNSUCCESSFUL;
1954}
1955
1957NTAPI
1960 IN PIRP Irp)
1961{
1962 PIO_STACK_LOCATION IoStack;
1963 //PDEVICE_EXTENSION DeviceExtension;
1964 PKSIOBJECT_HEADER ObjectHeader;
1965 //PKSIDEVICE_HEADER DeviceHeader;
1968
1969 /* get current stack location */
1971
1972 /* get device extension */
1973 //DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
1974 /* get device header */
1975 //DeviceHeader = DeviceExtension->DeviceHeader;
1976
1977 ASSERT(IoStack->FileObject);
1978
1979 /* get object header */
1980 ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext2;
1981
1982 if (!ObjectHeader)
1983 {
1984 /* FIXME Pnp-Issue*/
1985 Irp->IoStatus.Status = STATUS_SUCCESS;
1986 Irp->IoStatus.Information = 0;
1987 /* complete and forget */
1989 return STATUS_SUCCESS;
1990 }
1991
1992 /* sanity check */
1993 ASSERT(ObjectHeader);
1994 /* store create item */
1995 //KSCREATE_ITEM_IRP_STORAGE(Irp) = (PKSOBJECT_CREATE_ITEM)0x12345678; //ObjectHeader->CreateItem;
1996
1997 /* retrieve matching dispatch function */
1998 switch(IoStack->MajorFunction)
1999 {
2000 case IRP_MJ_CLOSE:
2001 Dispatch = ObjectHeader->DispatchTable.Close;
2002 break;
2004 Dispatch = ObjectHeader->DispatchTable.DeviceIoControl;
2005 break;
2006 case IRP_MJ_READ:
2007 Dispatch = ObjectHeader->DispatchTable.Read;
2008 break;
2009 case IRP_MJ_WRITE:
2010 Dispatch = ObjectHeader->DispatchTable.Write;
2011 break;
2013 Dispatch = ObjectHeader->DispatchTable.Flush;
2014 break;
2016 Dispatch = ObjectHeader->DispatchTable.QuerySecurity;
2017 break;
2019 Dispatch = ObjectHeader->DispatchTable.SetSecurity;
2020 break;
2021 case IRP_MJ_PNP:
2023 break;
2024 default:
2025 Dispatch = NULL;
2026 }
2027
2028 /* is the request supported */
2029 if (Dispatch)
2030 {
2031 /* now call the dispatch function */
2033 }
2034 else
2035 {
2036 /* not supported request */
2038 }
2039
2040 /* done */
2041 return Status;
2042}
2043
2044/*
2045 @implemented
2046*/
2049NTAPI
2053{
2054 DPRINT("KsSetMajorFunctionHandler Function %x\n", MajorFunction);
2055
2056 switch ( MajorFunction )
2057 {
2058 case IRP_MJ_CREATE:
2059 DriverObject->MajorFunction[MajorFunction] = KspCreate;
2060 break;
2062 case IRP_MJ_CLOSE:
2063 case IRP_MJ_READ:
2064 case IRP_MJ_WRITE:
2068 DriverObject->MajorFunction[MajorFunction] = KspDispatchIrp;
2069 break;
2070 default:
2071 DPRINT1("NotSupported %x\n", MajorFunction);
2073 };
2074
2075 return STATUS_SUCCESS;
2076}
2077
2078/*
2079 @implemented
2080*/
2083NTAPI
2086 IN PIRP Irp)
2087{
2088 PIO_STACK_LOCATION IoStack;
2089 PKSIDEVICE_HEADER DeviceHeader;
2090 PDEVICE_EXTENSION DeviceExtension;
2091
2092 DPRINT("KsDispatchIrp DeviceObject %p Irp %p\n", DeviceObject, Irp);
2093
2094 /* get device extension */
2095 DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
2096
2097 /* get device header */
2098 DeviceHeader = DeviceExtension->DeviceHeader;
2099
2100
2101 /* get current irp stack */
2103
2104 if (IoStack->MajorFunction <= IRP_MJ_DEVICE_CONTROL)
2105 {
2106 if (IoStack->MajorFunction == IRP_MJ_CREATE)
2107 {
2108 /* check internal type */
2109 if (DeviceHeader->BasicHeader.OuterUnknown) /* FIXME improve check */
2110 {
2111 /* AVStream client */
2113 }
2114 else
2115 {
2116 /* external client (portcls) */
2117 return KspCreate(DeviceObject, Irp);
2118 }
2119 }
2120
2121 switch (IoStack->MajorFunction)
2122 {
2123 case IRP_MJ_CLOSE:
2124 case IRP_MJ_READ:
2125 case IRP_MJ_WRITE:
2129 case IRP_MJ_PNP:
2132 default:
2134 }
2135 }
2136
2137 /* dispatch power */
2138 if (IoStack->MajorFunction == IRP_MJ_POWER)
2139 {
2140 /* check internal type */
2141 if (DeviceHeader->BasicHeader.OuterUnknown) /* FIXME improve check */
2142 {
2143 /* AVStream client */
2145 }
2146 else
2147 {
2148 /* external client (portcls) */
2150 }
2151 }
2152 else if (IoStack->MajorFunction == IRP_MJ_PNP) /* dispatch pnp */
2153 {
2154 /* check internal type */
2155 if (DeviceHeader->BasicHeader.OuterUnknown) /* FIXME improve check */
2156 {
2157 /* AVStream client */
2159 }
2160 else
2161 {
2162 /* external client (portcls) */
2164 }
2165 }
2166 else if (IoStack->MajorFunction == IRP_MJ_SYSTEM_CONTROL)
2167 {
2168 /* forward irp */
2170 }
2171 else
2172 {
2173 /* not supported */
2175 }
2176}
2177
2178/*
2179 @unimplemented
2180*/
2182ULONG
2183NTAPI
2185 IN PIRP Irp)
2186{
2188 return KSFILTER_NODE;
2189}
2190
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
struct _IRP * PIRP
unsigned char BOOLEAN
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define InterlockedIncrement
Definition: armddk.h:53
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:118
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
Definition: bufpool.h:45
Definition: Header.h:9
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#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
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:110
KSDDKAPI NTSTATUS NTAPI KsDefaultForwardIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:227
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:166
NTSTATUS NTAPI IKsDevice_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: device.c:549
NTSTATUS NTAPI IKsDevice_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: device.c:566
NTSTATUS NTAPI IKsDevice_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: device.c:409
KSDDKAPI VOID NTAPI KsCancelIo(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock)
Definition: irp.c:1291
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1189
KSDDKAPI VOID NTAPI KsAddIrpToCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN PIRP Irp, IN KSLIST_ENTRY_LOCATION ListLocation, IN PDRIVER_CANCEL DriverCancel OPTIONAL)
Definition: irp.c:1666
KSDDKAPI NTSTATUS NTAPI KsQueryInformationFile(IN PFILE_OBJECT FileObject, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass)
Definition: irp.c:364
NTSTATUS NTAPI KspCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1880
KSDDKAPI NTSTATUS NTAPI KsStreamIo(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, IN PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL, IN PVOID CompletionContext OPTIONAL, IN KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN OUT PVOID StreamHeaders, IN ULONG Length, IN ULONG Flags, IN KPROCESSOR_MODE RequestorMode)
Definition: irp.c:560
KSDDKAPI NTSTATUS NTAPI KsSetMajorFunctionHandler(IN PDRIVER_OBJECT DriverObject, IN ULONG MajorFunction)
Definition: irp.c:2050
KSDDKAPI NTSTATUS NTAPI KsDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:2084
KSDDKAPI VOID NTAPI KsRemoveSpecificIrpFromCancelableQueue(IN PIRP Irp)
Definition: irp.c:1638
NTSTATUS FindMatchingCreateItem(PLIST_ENTRY ListHead, PUNICODE_STRING String, OUT PCREATE_ITEM_ENTRY *OutCreateItem)
Definition: irp.c:1783
KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(IN PIRP Irp, IN ULONG ProbeFlags, IN ULONG HeaderSize)
Definition: irp.c:680
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1271
KSDDKAPI ULONG NTAPI KsGetNodeIdFromIrp(IN PIRP Irp)
Definition: irp.c:2184
KSDDKAPI NTSTATUS NTAPI KsDefaultDeviceIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1205
KSDDKAPI NTSTATUS NTAPI KsWriteFile(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PVOID Buffer, IN ULONG Length, IN ULONG Key OPTIONAL, IN KPROCESSOR_MODE RequestorMode)
Definition: irp.c:253
KSDDKAPI NTSTATUS NTAPI KsAllocateExtraData(IN PIRP Irp, IN ULONG ExtraSize, OUT PVOID *ExtraBuffer)
Definition: irp.c:1111
KSDDKAPI NTSTATUS NTAPI KsReadFile(IN PFILE_OBJECT FileObject, IN PKEVENT Event OPTIONAL, IN PVOID PortContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID Buffer, IN ULONG Length, IN ULONG Key OPTIONAL, IN KPROCESSOR_MODE RequestorMode)
Definition: irp.c:142
KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:67
KSDDKAPI NTSTATUS NTAPI KsMoveIrpsOnCancelableQueue(IN OUT PLIST_ENTRY SourceList, IN PKSPIN_LOCK SourceLock, IN OUT PLIST_ENTRY DestinationList, IN PKSPIN_LOCK DestinationLock OPTIONAL, IN KSLIST_ENTRY_LOCATION ListLocation, IN PFNKSIRPLISTCALLBACK ListCallback, IN PVOID Context)
Definition: irp.c:1513
KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:22
KSDDKAPI VOID NTAPI KsNullDriverUnload(IN PDRIVER_OBJECT DriverObject)
Definition: irp.c:1178
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1251
NTSTATUS NTAPI KspDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1958
KSDDKAPI VOID NTAPI KsCancelRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1749
KSDDKAPI NTSTATUS NTAPI KsSetInformationFile(IN PFILE_OBJECT FileObject, IN PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass)
Definition: irp.c:469
KSDDKAPI NTSTATUS NTAPI KsDispatchSpecificMethod(IN PIRP Irp, IN PFNKSHANDLER Handler)
Definition: irp.c:127
KSDDKAPI VOID NTAPI KsReleaseIrpOnCancelableQueue(IN PIRP Irp, IN PDRIVER_CANCEL DriverCancel OPTIONAL)
Definition: irp.c:1353
KSDDKAPI PIRP NTAPI KsRemoveIrpFromCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN KSLIST_ENTRY_LOCATION ListLocation, IN KSIRP_REMOVAL_OPERATION RemovalOperation)
Definition: irp.c:1408
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define ExGetPreviousMode
Definition: ex.h:140
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
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2666
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
FP_OP Operation
Definition: fpcontrol.c:150
@ FileBasicInformation
Definition: from_kernel.h:65
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
__in WDFDEVICE __in CONST GUID __in_opt PCUNICODE_STRING RefString
#define IoAllocateMdl
Definition: fxmdl.h:88
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
IoSetCancelRoutine(Irp, CancelRoutine)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define KSFILTER_NODE
Definition: ks.h:44
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
#define IOCTL_KS_RESET_STATE
Definition: ks.h:145
#define IOCTL_KS_METHOD
Definition: ks.h:136
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
KSLIST_ENTRY_LOCATION
Definition: ks.h:1261
@ KsListEntryHead
Definition: ks.h:1263
@ KsListEntryTail
Definition: ks.h:1262
#define KSSTREAM_HEADER_OPTIONSF_TYPECHANGED
Definition: ks.h:2752
KSIRP_REMOVAL_OPERATION
Definition: ks.h:1272
@ KsAcquireOnlySingleItem
Definition: ks.h:1275
@ KsAcquireAndRemove
Definition: ks.h:1274
@ KsAcquireAndRemoveOnlySingleItem
Definition: ks.h:1276
KSCOMPLETION_INVOCATION
Definition: ks.h:1279
@ KsInvokeOnSuccess
Definition: ks.h:1280
@ KsInvokeOnCancel
Definition: ks.h:1282
@ KsInvokeOnError
Definition: ks.h:1281
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
#define KSDDKAPI
Definition: ks.h:40
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
struct CREATE_ITEM_ENTRY * PCREATE_ITEM_ENTRY
if(dx< 0)
Definition: linetemp.h:194
#define PCHAR
Definition: match.c:90
PVOID NTAPI MmMapLockedPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode)
Definition: mdlsup.c:818
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
#define ASSERT(a)
Definition: mode.c:44
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
Definition: pipe.c:75
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:34
#define UserMode
Definition: asm.h:35
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ NotificationEvent
@ SynchronizationEvent
#define ExRaiseStatus
Definition: ntoskrnl.h:114
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
Definition: file.c:3267
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
#define STATUS_PROPSET_NOT_FOUND
Definition: ntstatus.h:692
#define STATUS_NO_MATCH
Definition: ntstatus.h:751
#define STATUS_NO_SECURITY_ON_OBJECT
Definition: ntstatus.h:451
#define L(x)
Definition: ntvdm.h:50
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
unsigned short USHORT
Definition: pedump.c:61
#define FileStandardInformation
Definition: propsheet.cpp:61
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
Definition: ke.h:135
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define DPRINT
Definition: sndvol32.h:73
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: kstypes.h:46
PKSOBJECT_CREATE_ITEM CreateItem
Definition: kstypes.h:48
LONG ReferenceCount
Definition: kstypes.h:50
base of all file and directory entries
Definition: entries.h:83
PUNKNOWN OuterUnknown
Definition: kstypes.h:62
KSBASIC_HEADER BasicHeader
Definition: kstypes.h:87
LIST_ENTRY ItemList
Definition: kstypes.h:94
KSDISPATCH_TABLE DispatchTable
Definition: kstypes.h:22
LIST_ENTRY ItemList
Definition: kstypes.h:26
ULONG FrameExtent
Definition: ks.h:2740
ULONG Size
Definition: ks.h:2736
PVOID Data
Definition: ks.h:2742
ULONG DataUsed
Definition: ks.h:2741
ULONG OptionsFlags
Definition: ks.h:2743
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1738
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1737
struct _IO_STACK_LOCATION::@3974::@3992 QuerySecurity
struct _IO_STACK_LOCATION::@3974::@3979 Write
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _IO_STACK_LOCATION::@3974::@3993 SetSecurity
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
struct _IO_STACK_LOCATION::@3974::@3984 SetFile
struct _IO_STACK_LOCATION::@3974::@3978 Read
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
struct _IO_STACK_LOCATION::@3974::@3983 QueryFile
union _IO_STACK_LOCATION::@1575 Parameters
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define LL
Definition: tui.h:167
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:898
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:895
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
Definition: ws2tcpip.h:622
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:188
_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:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IRP_DEALLOCATE_BUFFER
#define IRP_INPUT_OPERATION
#define IO_NO_INCREMENT
Definition: iotypes.h:598
IO_COMPLETION_ROUTINE * PIO_COMPLETION_ROUTINE
Definition: iotypes.h:2835
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2262
#define IRP_MJ_QUERY_SECURITY
#define IRP_MJ_SYSTEM_CONTROL
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IRP_MJ_FLUSH_BUFFERS
#define FO_SYNCHRONOUS_IO
Definition: iotypes.h:1776
#define IRP_MJ_POWER
#define IRP_BUFFERED_IO
#define IRP_MJ_SET_SECURITY
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:415
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
enum _LOCK_OPERATION LOCK_OPERATION
@ IoReadAccess
Definition: ketypes.h:863
@ IoWriteAccess
Definition: ketypes.h:864
#define MDL_MAPPING_CAN_FAIL
Definition: mmtypes.h:31
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
#define MDL_SOURCE_IS_NONPAGED_POOL
Definition: mmtypes.h:20
#define MDL_MAPPED_TO_SYSTEM_VA
Definition: mmtypes.h:18
NTKERNELAPI NTSTATUS NTAPI SeSetSecurityDescriptorInfo(_In_opt_ PVOID Object, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
NTKERNELAPI NTSTATUS NTAPI SeQuerySecurityDescriptorInfo(_In_ PSECURITY_INFORMATION SecurityInformation, _Out_writes_bytes_(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG Length, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor)
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184