ReactOS  0.4.15-dev-5606-gf34e425
irpstream.cpp
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/wdm/audio/backpln/portcls/irpstream.cpp
5  * PURPOSE: IRP Stream handling
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "private.hpp"
10 
11 #ifndef YDEBUG
12 #define NDEBUG
13 #endif
14 
15 #include <debug.h>
16 
17 static
18 PIRP
20  IN OUT PLIST_ENTRY QueueHead)
21 {
22  PIRP Irp;
23  PLIST_ENTRY CurEntry;
24 
25  for (CurEntry = QueueHead->Flink; CurEntry != QueueHead; CurEntry = CurEntry->Flink)
26  {
27  /* Get the IRP offset */
28  Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
29 
30  /* Remove the cancel routine */
32  {
33  /* Remove the IRP from the list and return it */
34  RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
35  return Irp;
36  }
37  }
38 
39  /* no non canceled irp has been found */
40  return NULL;
41 }
42 class CIrpQueue : public CUnknownImpl<IIrpQueue>
43 {
44 public:
46 
48  CIrpQueue(IUnknown *OuterUnknown){}
49  virtual ~CIrpQueue(){}
50 
51 protected:
52 
54  PKSPIN_DESCRIPTOR m_Descriptor;
55 
59 
63 
67 
70 };
71 
72 typedef struct
73 {
77 
78 typedef struct
79 {
82 
86 
87 #define STREAM_DATA_OFFSET (0)
88 
89 
91 NTAPI
93  IN REFIID refiid,
94  OUT PVOID* Output)
95 {
96  if (IsEqualGUIDAligned(refiid, IID_IUnknown))
97  {
98  *Output = PVOID(PUNKNOWN(this));
99  PUNKNOWN(*Output)->AddRef();
100  return STATUS_SUCCESS;
101  }
102 
103  return STATUS_UNSUCCESSFUL;
104 }
105 
106 NTSTATUS
107 NTAPI
109  IN PKSPIN_CONNECT ConnectDetails,
110  IN PKSPIN_DESCRIPTOR Descriptor,
111  IN ULONG FrameSize,
113  IN ULONG TagSupportEnabled)
114 {
115  m_ConnectDetails = ConnectDetails;
117  m_MaxFrameSize = FrameSize;
119  m_TagSupportEnabled = TagSupportEnabled;
120 
124 
125  return STATUS_SUCCESS;
126 }
127 
128 NTSTATUS
129 NTAPI
130 CIrpQueue::AddMapping(
131  IN PIRP Irp,
132  OUT PULONG Data)
133 {
136  PIO_STACK_LOCATION IoStack;
137  ULONG Index, Length;
138  PMDL Mdl;
140  LONG TotalStreamData;
141  LONG StreamPageCount;
142  LONG HeaderLength;
143 
145 
146  // allocate stream data
148  if (!StreamData)
149  {
150  // not enough memory
152  }
153 
154  // get current irp stack location
156 
157  // lets probe the irp
158  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM)
159  {
160  // probe IOCTL_KS_WRITE_STREAM
161  Status = KsProbeStreamIrp(Irp, KSSTREAM_WRITE | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, 0);
162  }
163  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM)
164  {
165  // probe IOCTL_KS_READ_STREAM
166  Status = KsProbeStreamIrp(Irp, KSSTREAM_READ | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, 0);
167  }
168 
169  // check for success
170  if (!NT_SUCCESS(Status))
171  {
172  // irp probing failed
174  return Status;
175  }
176 
177  // get first stream header
178  Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
179 
180  // sanity check
181  PC_ASSERT(Header);
182 
183  // first calculate the numbers of stream headers
184  Length = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
185  Mdl = Irp->MdlAddress;
186 
187  TotalStreamData = 0;
188  StreamPageCount = 0;
189 
190  do
191  {
192  /* subtract size */
193  Length -= Header->Size;
194 
195  /* increment header count */
196  StreamData->StreamHeaderCount++;
197 
198  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
199  {
200  // irp sink
201  HeaderLength = Header->DataUsed;
202  }
203  else
204  {
205  // irp source
206  HeaderLength = Header->FrameExtent;
207  }
208 
209  // increment available data
210  TotalStreamData += HeaderLength;
211 
212  // append page count
213  StreamPageCount += ADDRESS_AND_SIZE_TO_SPAN_PAGES(
214  MmGetMdlByteOffset(Mdl), HeaderLength);
215 
216  // move to next header / mdl
217  Mdl = Mdl->Next;
219 
220  }while(Length);
221 
222  // sanity check
223  ASSERT(StreamData->StreamHeaderCount);
224 
225  // allocate array for storing the pointers of the data */
226  StreamData->Data = (PVOID*)AllocateItem(NonPagedPool, sizeof(PVOID) * StreamData->StreamHeaderCount, TAG_PORTCLASS);
227  if (!StreamData->Data)
228  {
229  // out of memory
231 
232  // done
234  }
235 
237  {
238  // allocate array for storing the pointers of the data */
239  StreamData->Tags = (PKSSTREAM_TAG)AllocateItem(NonPagedPool, sizeof(KSSTREAM_TAG) * StreamPageCount, TAG_PORTCLASS);
240  if (!StreamData->Data)
241  {
242  // out of memory
245 
246  // done
248  }
249  }
250 
251 
252  // now get a system address for the user buffers
253  Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
254  Mdl = Irp->MdlAddress;
255 
256  for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
257  {
258  /* get system address */
260 
261  /* check for success */
262  if (!StreamData->Data[Index])
263  {
264  // out of resources
266 
268  {
269  // free tag array
271  }
272 
274  // done
276  }
277 
278  // move to next header / mdl
279  Mdl = Mdl->Next;
281 
282  }
283 
284  // store stream data
285  Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET] = (PVOID)StreamData;
286 
287  *Data = TotalStreamData;
288 
289  // mark irp as pending
291 
292  // add irp to cancelable queue
294 
295  // done
296  return STATUS_SUCCESS;
297 }
298 
299 NTSTATUS
300 NTAPI
301 CIrpQueue::GetMapping(
302  OUT PUCHAR * Buffer,
304 {
305  PIRP Irp;
306  ULONG Offset;
308 
309  // check if there is an irp in the partially processed
310  if (m_Irp)
311  {
312  // use last irp
313  if (m_Irp->Cancel == FALSE)
314  {
315  Irp = m_Irp;
317  }
318  else
319  {
320  // irp has been cancelled
323  m_Irp = Irp = NULL;
324  m_CurrentOffset = 0;
325  }
326  }
327  else
328  {
329  // get a fresh new irp from the queue
331  m_CurrentOffset = Offset = 0;
332 
333  if (m_Irp)
334  {
335  // reset stream header index
337 
338  // reset stream header
339  m_CurStreamHeader = (PKSSTREAM_HEADER)m_Irp->AssociatedIrp.SystemBuffer;
340  }
341  }
342 
343  if (!Irp)
344  {
345  // no irp buffer available
346  return STATUS_UNSUCCESSFUL;
347  }
348 
349  // get stream data
350  StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
351 
352  // sanity check
354 
355  // get buffer size
356  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
357  {
358  // sink pin
360  }
361  else
362  {
363  // source pin
365  }
366 
367  // sanity check
369 
370  // store buffer
372 
373  return STATUS_SUCCESS;
374 }
375 
376 VOID
377 NTAPI
378 CIrpQueue::UpdateMapping(
380 {
382  ULONG Size;
383  PIO_STACK_LOCATION IoStack;
384  ULONG Index;
385  PMDL Mdl;
386 
387  // sanity check
388  ASSERT(m_Irp);
389 
390  // get stream data
391  StreamData = (PKSSTREAM_DATA)m_Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
392 
393  // sanity check
395 
396  // add to current offset
398 
399  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
400  {
401  // store written bytes (source pin)
403  }
404 
405  // get audio buffer size
406  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
408  else
410 
411  // sanity check
412  PC_ASSERT(Size);
413 
414  if (m_CurrentOffset >= Size)
415  {
416  // sanity check
418 
419  if (m_StreamHeaderIndex + 1 < StreamData->StreamHeaderCount)
420  {
421  // move to next stream header
423 
424  // increment stream header index
426 
427  // reset offset
428  m_CurrentOffset = 0;
429 
430  // done
431  return;
432  }
433 
434  //
435  // all stream buffers have been played
436  // check if this is a looped buffer
437  //
439  {
440  // looped streaming repeat the buffers untill
441  // the caller decides to stop the streams
442 
443  // re-insert irp
445 
446  // clear current irp
447  m_Irp = NULL;
448 
449  // reset offset
450  m_CurrentOffset = 0;
451 
452  // done
453  return;
454  }
455 
456  Mdl = m_Irp->MdlAddress;
457  for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
458  {
460  Mdl = Mdl->Next;
461  }
462 
463  // free stream data array
465 
467  {
468  // free tag array
470  }
471 
472  // free stream data
474 
475  // get io stack
477 
478  // store operation status
480 
481  // store operation length
482  m_Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
483 
484  // complete the request
486 
487  // remove irp as it is complete
488  m_Irp = NULL;
489 
490  // reset offset
491  m_CurrentOffset = 0;
492  }
493 }
494 
495 ULONG
496 NTAPI
497 CIrpQueue::NumData()
498 {
499  KIRQL OldLevel;
500  ULONG NumDataAvailable;
501  PLIST_ENTRY CurEntry;
502  PIRP Irp;
503  ULONG CurrentOffset;
504  ULONG StreamHeaderIndex;
505  PKSSTREAM_HEADER CurStreamHeader;
507  ULONG Size;
508 
509  KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
510 
511  NumDataAvailable = 0;
512  CurEntry = &m_IrpList;
513 
514  // current IRP state
515  Irp = m_Irp;
516  CurrentOffset = m_CurrentOffset;
517  StreamHeaderIndex = m_StreamHeaderIndex;
518  CurStreamHeader = m_CurStreamHeader;
519 
520  while (TRUE)
521  {
522  if (Irp != NULL)
523  {
524  // get stream data
525  StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
526 
527  // loop over stream headers
528  for (; StreamHeaderIndex < StreamData->StreamHeaderCount; StreamHeaderIndex++)
529  {
530  // get audio buffer size
531  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
532  Size = CurStreamHeader->FrameExtent;
533  else
534  Size = CurStreamHeader->DataUsed;
535 
536  // increment available data
537  NumDataAvailable += Size - CurrentOffset;
538  CurrentOffset = 0;
539 
540  // move to next stream header
541  CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)CurStreamHeader + CurStreamHeader->Size);
542  }
543  }
544 
545  /* iterate to next entry */
546  CurEntry = CurEntry->Flink;
547 
548  /* is the end of list reached */
549  if (CurEntry == &m_IrpList)
550  break;
551 
552  /* get irp offset */
553  Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
554 
555  // next IRP state
556  CurrentOffset = 0;
557  StreamHeaderIndex = 0;
558  CurStreamHeader = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
559  }
560 
561  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
562  return NumDataAvailable;
563 }
564 
565 BOOL
566 NTAPI
567 CIrpQueue::CancelBuffers()
568 {
569  //TODO: own cancel routine
570 
571  // is there an active irp
572  if (m_Irp)
573  {
574  // re-insert it to cancelable queue
576  //set it to zero
577  m_Irp = NULL;
578  }
579 
580  // cancel all irps
582 
583  // done
584  return TRUE;
585 }
586 
587 NTSTATUS
588 NTAPI
589 CIrpQueue::GetMappingWithTag(
590  IN PVOID Tag,
594  OUT PULONG Flags)
595 {
597  KIRQL OldLevel;
598  ULONG Size;
599  LPBYTE Data;
600 
601  /* sanity checks */
605  PC_ASSERT(Flags);
606 
607  KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
608 
609  if (!m_Irp)
610  {
611  // get an irp from the queue
613 
614  // check if there is an irp
615  if (!m_Irp)
616  {
617  // no irp available
618  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
619 
620  DPRINT("GetMappingWithTag no mapping available\n");
621  return STATUS_NOT_FOUND;
622  }
623 
624  // reset offset
625  m_CurrentOffset = 0;
626 
627  // reset tag index
628  m_TagIndex = 0;
629 
630  // reset stream header index
632 
633  // reset stream header
634  m_CurStreamHeader = (PKSSTREAM_HEADER)m_Irp->AssociatedIrp.SystemBuffer;
635  }
636 
637  // get stream data
638  StreamData = (PKSSTREAM_DATA)m_Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
639 
640  // sanity check
641  PC_ASSERT(m_StreamHeaderIndex < StreamData->StreamHeaderCount);
642 
643  // store tag in irp
644  StreamData->Tags[m_TagIndex].Tag = Tag;
645  StreamData->Tags[m_TagIndex].Used = TRUE;
646  m_TagIndex++;
647 
648  // get audio buffer size
649  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
651  else
653 
654  // sanity check
655  PC_ASSERT(Size);
656 
657  // setup mapping
659  *VirtualAddress = Data;
660 
661  // get byte count
663  if (*ByteCount > (Size - m_CurrentOffset))
666 
667  if (m_CurrentOffset >= Size)
668  {
669  // sanity check
671 
672  // increment header index
674 
675  if (m_StreamHeaderIndex == StreamData->StreamHeaderCount)
676  {
677  // last mapping
678  *Flags = 1;
679 
680  //
681  StreamData->nTags = m_TagIndex;
682 
683  // insert mapping into free list
684  InsertTailList(&m_FreeIrpList, &m_Irp->Tail.Overlay.ListEntry);
685 
686  // clear irp
687  m_Irp = NULL;
688 
689  }
690  else
691  {
692  // one more mapping in the irp
693  *Flags = 0;
694 
695  // move to next header
697  }
698  }
699 
700  // get physical address
702 
703  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
704 
705  DPRINT("GetMappingWithTag Tag %p Buffer %p Flags %lu ByteCount %lx\n", Tag, VirtualAddress, *Flags, *ByteCount);
706  // done
707  return STATUS_SUCCESS;
708 }
709 
710 NTSTATUS
711 NTAPI
712 CIrpQueue::ReleaseMappingWithTag(
713  IN PVOID Tag)
714 {
715  PIRP Irp;
716  PLIST_ENTRY CurEntry;
718  PIO_STACK_LOCATION IoStack;
719  ULONG Index;
720  KIRQL OldLevel;
721 
722  KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
723 
724  // check if used list empty
726  {
727  // get current irp
728  if (!m_Irp)
729  {
730  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
731 
732  // this should not happen
733  DPRINT("ReleaseMappingWithTag Tag %p not found\n", Tag);
734  return STATUS_NOT_FOUND;
735  }
736 
737  Irp = m_Irp;
738  }
739  else
740  {
741  // remove irp from used list
742  CurEntry = RemoveHeadList(&m_FreeIrpList);
743 
744  // get irp from list entry
745  Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
746  }
747 
748  // get stream data
749  StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
750 
751  // release oldest in use mapping
752  for (Index = 0; Index < StreamData->nTags; Index++)
753  {
754  if (StreamData->Tags[Index].Used != FALSE)
755  {
756  StreamData->Tags[Index].Used = FALSE;
757 
758  // Warn if wrong mapping released
759  if (StreamData->Tags[Index].Tag != Tag)
760  {
761  DPRINT1("Mapping released out of order\n");
762  }
763 
764  break;
765  }
766  }
767 
768  // If this is the current IRP, do not complete
769  if (Irp == m_Irp)
770  {
771  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
772  return STATUS_SUCCESS;
773  }
774 
775  // check if this is the last one released mapping
776  if (Index + 1 == StreamData->nTags)
777  {
778  // last mapping released
779  // now check if this is a looped buffer
781  {
782  // looped buffers are not completed when they have been played
783  // they are completed when the stream is set to stop
784 
785  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
786 
787  // re-insert irp
789 
790  // done
791  return STATUS_SUCCESS;
792  }
793 
794  //
795  // time to complete non looped buffer
796  //
797 
798  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
799 
800  // free stream data array
802 
803  // free stream tags array
805 
806  // free stream data
808 
809  // get io stack
811 
812  // store operation status
813  Irp->IoStatus.Status = STATUS_SUCCESS;
814 
815  // store operation length
816  Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
817 
818  // complete the request
820  }
821  else
822  {
823  // there are still some headers not consumed
824  InsertHeadList(&m_FreeIrpList, &Irp->Tail.Overlay.ListEntry);
825 
826  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
827  }
828 
829  return STATUS_SUCCESS;
830 }
831 
832 ULONG
833 NTAPI
834 CIrpQueue::GetCurrentIrpOffset()
835 {
836 
837  return m_CurrentOffset;
838 }
839 
840 BOOLEAN
841 NTAPI
842 CIrpQueue::GetAcquiredTagRange(
843  IN PVOID * FirstTag,
844  IN PVOID * LastTag)
845 {
846  KIRQL OldLevel;
847  BOOLEAN Ret = FALSE;
848  //PIRP Irp;
849  //PLIST_ENTRY CurEntry;
850  //PKSSTREAM_DATA StreamData;
851 
852  // lock list
853  KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
854 
855  // initialize to zero
856  *FirstTag = NULL;
857  *LastTag = NULL;
858 
860 
861  // release lock
862  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
863  // done
864  return Ret;
865 }
866 
867 NTSTATUS
868 NTAPI
870  IN IIrpQueue **Queue)
871 {
873  if (!This)
875 
876  This->AddRef();
877 
878  *Queue = (IIrpQueue*)This;
879  return STATUS_SUCCESS;
880 }
PKSSTREAM_TAG Tags
Definition: irpstream.cpp:84
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:949
#define IN
Definition: typedefs.h:39
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define REFIID
Definition: guiddef.h:118
KSPIN_INTERFACE Interface
Definition: ks.h:2601
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PKSPIN_CONNECT m_ConnectDetails
Definition: irpstream.cpp:53
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
ULONG m_CurrentOffset
Definition: irpstream.cpp:68
struct KSSTREAM_TAG * PKSSTREAM_TAG
#define TRUE
Definition: types.h:120
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2221
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
#define TAG_PORTCLASS
Definition: private.hpp:24
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(IN PIRP Irp, IN ULONG ProbeFlags, IN ULONG HeaderSize)
Definition: irp.c:659
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LIST_ENTRY m_FreeIrpList
Definition: irpstream.cpp:58
ULONG StreamHeaderCount
Definition: irpstream.cpp:80
IO_STATUS_BLOCK IoStatus
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:386
#define InsertTailList(ListHead, Entry)
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
IoSetCancelRoutine(Irp, CancelRoutine)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define IO_SOUND_INCREMENT
Definition: iotypes.h:608
#define PC_ASSERT(exp)
Definition: private.hpp:26
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
uint32_t ULONG_PTR
Definition: typedefs.h:65
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:1387
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
unsigned char * LPBYTE
Definition: typedefs.h:53
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
Definition: Header.h:8
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
PKSPIN_DESCRIPTOR m_Descriptor
Definition: irpstream.cpp:54
KSDDKAPI VOID NTAPI KsCancelIo(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock)
Definition: irp.c:1270
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:837
#define STDMETHODIMP
Definition: basetyps.h:43
union Alignment_ Alignment
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:240
unsigned char BOOLEAN
#define IoCompleteRequest
Definition: irp.c:1240
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
#define STREAM_DATA_OFFSET
Definition: irpstream.cpp:87
Definition: bufpool.h:45
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
void * PVOID
Definition: retypes.h:9
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
ULONG m_MaxFrameSize
Definition: irpstream.cpp:60
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
struct KSSTREAM_DATA * PKSSTREAM_DATA
Status
Definition: gdiplustypes.h:24
PKSSTREAM_HEADER m_CurStreamHeader
Definition: irpstream.cpp:66
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define STATUS_NOT_FOUND
Definition: shellext.h:72
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
CIrpQueue(IUnknown *OuterUnknown)
Definition: irpstream.cpp:48
#define ASSERT(a)
Definition: mode.c:44
ULONG Id
Definition: dmksctrl.h:77
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG m_StreamHeaderIndex
Definition: irpstream.cpp:64
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG m_Alignment
Definition: irpstream.cpp:61
const GUID IID_IUnknown
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
ULONG FrameExtent
Definition: ks.h:2740
#define for
Definition: utility.h:88
struct _IRP * PIRP
ULONG AddRef()
static PIRP RemoveHeadList_IRP(IN OUT PLIST_ENTRY QueueHead)
Definition: irpstream.cpp:19
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: arc.h:85
Definition: typedefs.h:119
ULONG DataUsed
Definition: ks.h:2741
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1098
virtual ~CIrpQueue()
Definition: irpstream.cpp:49
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG Size
Definition: ks.h:2736
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
KSPIN_LOCK m_IrpListLock
Definition: irpstream.cpp:56
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
#define ROUND_TO_PAGES(Size)
PIRP m_Irp
Definition: irpstream.cpp:69
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
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:1645
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define DPRINT1
Definition: precomp.h:8
ULONG m_TagIndex
Definition: irpstream.cpp:65
#define OUT
Definition: typedefs.h:40
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: irpstream.cpp:92
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define UNIMPLEMENTED
Definition: debug.h:115
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
#define MmGetMdlByteOffset(_Mdl)
NTSTATUS NTAPI NewIrpQueue(IN IIrpQueue **Queue)
Definition: irpstream.cpp:869
#define STATUS_SUCCESS
Definition: shellext.h:65
struct StreamData StreamData
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
PVOID * Data
Definition: irpstream.cpp:83
ULONG m_TagSupportEnabled
Definition: irpstream.cpp:62
IoMarkIrpPending(Irp)
LIST_ENTRY m_IrpList
Definition: irpstream.cpp:57
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251