ReactOS  0.4.13-dev-464-g6b95727
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 class CIrpQueue : public IIrpQueue
18 {
19 public:
21 
23  {
25  return m_Ref;
26  }
28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
39  CIrpQueue(IUnknown *OuterUnknown){}
40  virtual ~CIrpQueue(){}
41 
42 protected:
43 
45  PKSPIN_DESCRIPTOR m_Descriptor;
46 
50 
57  volatile PIRP m_Irp;
58  volatile LONG m_Ref;
59 };
60 
61 typedef struct
62 {
66 
67 typedef struct
68 {
72 
77 
78 #define STREAM_DATA_OFFSET (0)
79 
80 
82 NTAPI
84  IN REFIID refiid,
85  OUT PVOID* Output)
86 {
87  if (IsEqualGUIDAligned(refiid, IID_IUnknown))
88  {
89  *Output = PVOID(PUNKNOWN(this));
90  PUNKNOWN(*Output)->AddRef();
91  return STATUS_SUCCESS;
92  }
93 
94  return STATUS_UNSUCCESSFUL;
95 }
96 
98 NTAPI
100  IN PKSPIN_CONNECT ConnectDetails,
101  IN PKSPIN_DESCRIPTOR Descriptor,
102  IN ULONG FrameSize,
104  IN ULONG TagSupportEnabled)
105 {
106  m_ConnectDetails = ConnectDetails;
108  m_MaxFrameSize = FrameSize;
110  m_TagSupportEnabled = TagSupportEnabled;
111 
115 
116  return STATUS_SUCCESS;
117 }
118 
119 NTSTATUS
120 NTAPI
121 CIrpQueue::AddMapping(
122  IN PIRP Irp,
123  OUT PULONG Data)
124 {
127  PIO_STACK_LOCATION IoStack;
128  ULONG Index, Length;
129  PMDL Mdl;
131 
133 
134  // allocate stream data
136  if (!StreamData)
137  {
138  // not enough memory
140  }
141 
142  // get current irp stack location
144 
145  // lets probe the irp
146  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM)
147  {
148  // probe IOCTL_KS_WRITE_STREAM
149  Status = KsProbeStreamIrp(Irp, KSSTREAM_WRITE | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, 0);
150  }
151  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM)
152  {
153  // probe IOCTL_KS_READ_STREAM
154  Status = KsProbeStreamIrp(Irp, KSSTREAM_READ | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, 0);
155  }
156 
157  // check for success
158  if (!NT_SUCCESS(Status))
159  {
160  // irp probing failed
162  return Status;
163  }
164 
165  // get first stream header
166  Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
167 
168  // store header
169  StreamData->CurStreamHeader = Header;
170 
171  // sanity check
172  PC_ASSERT(Header);
173 
174  // first calculate the numbers of stream headers
175  Length = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
176 
177  do
178  {
179  /* subtract size */
180  Length -= Header->Size;
181 
182  /* increment header count */
183  StreamData->StreamHeaderCount++;
184 
185  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
186  {
187  // irp sink
188  StreamData->TotalStreamData += Header->DataUsed;
189  }
190  else
191  {
192  // irp source
193  StreamData->TotalStreamData += Header->FrameExtent;
194  }
195 
196  /* move to next header */
198 
199  }while(Length);
200 
201  // sanity check
202  ASSERT(StreamData->StreamHeaderCount);
203 
204  // allocate array for storing the pointers of the data */
205  StreamData->Data = (PVOID*)AllocateItem(NonPagedPool, sizeof(PVOID) * StreamData->StreamHeaderCount, TAG_PORTCLASS);
206  if (!StreamData->Data)
207  {
208  // out of memory
210 
211  // done
213  }
214 
216  {
217  // allocate array for storing the pointers of the data */
218  StreamData->Tags = (PKSSTREAM_TAG)AllocateItem(NonPagedPool, sizeof(KSSTREAM_TAG) * StreamData->StreamHeaderCount, TAG_PORTCLASS);
219  if (!StreamData->Data)
220  {
221  // out of memory
224 
225  // done
227  }
228  }
229 
230 
231  // now get a system address for the user buffers
232  Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
233  Mdl = Irp->MdlAddress;
234 
235  for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
236  {
237  /* get system address */
239 
240  /* check for success */
241  if (!StreamData->Data[Index])
242  {
243  // out of resources
245 
247  {
248  // free tag array
250  }
251 
253  // done
255  }
256 
257  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
258  {
259  // increment available data
261  }
262  else if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
263  {
264  // increment available data
266  }
267 
268  // move to next header / mdl
269  Mdl = Mdl->Next;
271 
272  }
273 
274  // store stream data
275  Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET] = (PVOID)StreamData;
276 
277  *Data = StreamData->TotalStreamData;
278 
279  // mark irp as pending
281 
282  // add irp to cancelable queue
284 
285  // disable mapping failed status
287 
288  // done
289  return STATUS_SUCCESS;
290 }
291 
292 NTSTATUS
293 NTAPI
294 CIrpQueue::GetMapping(
295  OUT PUCHAR * Buffer,
297 {
298  PIRP Irp;
299  ULONG Offset;
301 
302  // check if there is an irp in the partially processed
303  if (m_Irp)
304  {
305  // use last irp
306  if (m_Irp->Cancel == FALSE)
307  {
308  Irp = m_Irp;
310  }
311  else
312  {
313  // irp has been cancelled
314  m_Irp->IoStatus.Status = STATUS_CANCELLED;
316  m_Irp = Irp = NULL;
317  m_CurrentOffset = 0;
318  }
319  }
320  else
321  {
322  // get a fresh new irp from the queue
324  m_CurrentOffset = Offset = 0;
325  }
326 
327  if (!Irp)
328  {
329  // no irp buffer available
330  return STATUS_UNSUCCESSFUL;
331  }
332 
333  // get stream data
334  StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
335 
336  // sanity check
338 
339  // get buffer size
340  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
341  {
342  // sink pin
343  *BufferSize = StreamData->CurStreamHeader->DataUsed - Offset;
344  }
345  else
346  {
347  // source pin
348  *BufferSize = StreamData->CurStreamHeader->FrameExtent - Offset;
349  }
350 
351  // sanity check
353 
354  // store buffer
355  *Buffer = &((PUCHAR)StreamData->Data[StreamData->StreamHeaderIndex])[Offset];
356 
357  // unset flag that no irps are available
359 
360  return STATUS_SUCCESS;
361 }
362 
363 VOID
364 NTAPI
365 CIrpQueue::UpdateMapping(
367 {
369  ULONG Size;
370  PIO_STACK_LOCATION IoStack;
371  ULONG Index;
372  PMDL Mdl;
373 
374  // sanity check
375  ASSERT(m_Irp);
376 
377  // get stream data
378  StreamData = (PKSSTREAM_DATA)m_Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
379 
380  // sanity check
382 
383  // add to current offset
385 
386  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
387  {
388  // store written bytes (source pin)
389  StreamData->CurStreamHeader->DataUsed += BytesWritten;
390  }
391 
392  // decrement available data counter
394 
395  // get audio buffer size
396  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_OUT)
397  Size = StreamData->CurStreamHeader->FrameExtent;
398  else
399  Size = StreamData->CurStreamHeader->DataUsed;
400 
401  // sanity check
402  PC_ASSERT(Size);
403 
404  if (m_CurrentOffset >= Size)
405  {
406  // sanity check
408 
409  if (StreamData->StreamHeaderIndex + 1 < StreamData->StreamHeaderCount)
410  {
411  // move to next stream header
412  StreamData->CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)StreamData->CurStreamHeader + StreamData->CurStreamHeader->Size);
413 
414  // increment stream header index
415  StreamData->StreamHeaderIndex++;
416 
417  // reset offset
418  m_CurrentOffset = 0;
419 
420  // done
421  return;
422  }
423 
424  //
425  // all stream buffers have been played
426  // check if this is a looped buffer
427  //
429  {
430  // looped streaming repeat the buffers untill
431  // the caller decides to stop the streams
432 
433  // reset stream header index
434  StreamData->StreamHeaderIndex = 0;
435 
436  // reset stream header
437  StreamData->CurStreamHeader = (PKSSTREAM_HEADER)m_Irp->AssociatedIrp.SystemBuffer;
438 
439  // increment available data
441 
442  // re-insert irp
444 
445  // clear current irp
446  m_Irp = NULL;
447 
448  // reset offset
449  m_CurrentOffset = 0;
450 
451  // done
452  return;
453  }
454 
455  Mdl = m_Irp->MdlAddress;
456  for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
457  {
458  MmUnmapLockedPages(StreamData->Data[Index], Mdl);
459  Mdl = Mdl->Next;
460  }
461 
462  // free stream data array
464 
466  {
467  // free tag array
469  }
470 
471  // free stream data
473 
474  // get io stack
476 
477  // store operation status
478  m_Irp->IoStatus.Status = STATUS_SUCCESS;
479 
480  // store operation length
481  m_Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
482 
483  // complete the request
485 
486  // remove irp as it is complete
487  m_Irp = NULL;
488 
489  // reset offset
490  m_CurrentOffset = 0;
491  }
492 }
493 
494 ULONG
495 NTAPI
496 CIrpQueue::NumData()
497 {
498  // returns the amount of audio stream data available
499  return m_NumDataAvailable;
500 }
501 
502 BOOL
503 NTAPI
504 CIrpQueue::CancelBuffers()
505 {
506  //TODO: own cancel routine
507 
508  // is there an active irp
509  if (m_Irp)
510  {
511  // re-insert it to cancelable queue
513  //set it to zero
514  m_Irp = NULL;
515  }
516 
517  // cancel all irps
519 
520  // reset number of data available
521  m_NumDataAvailable = 0;
522 
523  // done
524  return TRUE;
525 }
526 
527 NTSTATUS
528 NTAPI
529 CIrpQueue::GetMappingWithTag(
530  IN PVOID Tag,
534  OUT PULONG Flags)
535 {
537 
538  /* sanity checks */
542  PC_ASSERT(Flags);
543 
544  if (!m_Irp)
545  {
546  // get an irp from the queue
548  }
549 
550  // check if there is an irp
551  if (!m_Irp)
552  {
553  // no irp available
555  DPRINT("GetMappingWithTag no mapping available\n");
556  return STATUS_NOT_FOUND;
557  }
558 
559  // get stream data
560  StreamData = (PKSSTREAM_DATA)m_Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
561 
562  // sanity check
563  PC_ASSERT(StreamData->StreamHeaderIndex < StreamData->StreamHeaderCount);
564 
565  // setup mapping
566  *PhysicalAddress = MmGetPhysicalAddress(StreamData->Data[StreamData->StreamHeaderIndex]);
567  *VirtualAddress = StreamData->Data[StreamData->StreamHeaderIndex];
568 
569  // store tag in irp
570  StreamData->Tags[StreamData->StreamHeaderIndex].Tag = Tag;
571  StreamData->Tags[StreamData->StreamHeaderIndex].Used = TRUE;
572 
573  // increment header index
574  StreamData->StreamHeaderIndex++;
575 
576  // mapping size
577  if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
578  {
579  // sink pin
580  *ByteCount = StreamData->CurStreamHeader->DataUsed;
581 
582  // decrement num data available
583  m_NumDataAvailable -= StreamData->CurStreamHeader->DataUsed;
584  }
585  else
586  {
587  // source pin
588  *ByteCount = StreamData->CurStreamHeader->FrameExtent;
589 
590  // decrement num data available
591  m_NumDataAvailable -= StreamData->CurStreamHeader->FrameExtent;
592  }
593 
594  if (StreamData->StreamHeaderIndex == StreamData->StreamHeaderCount)
595  {
596  // last mapping
597  *Flags = 1;
598 
599  // insert mapping into free list
600  ExInterlockedInsertTailList(&m_FreeIrpList, &m_Irp->Tail.Overlay.ListEntry, &m_IrpListLock);
601 
602  // clear irp
603  m_Irp = NULL;
604 
605  }
606  else
607  {
608  // one more mapping in the irp
609  *Flags = 0;
610 
611  // move to next header
612  StreamData->CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)StreamData->CurStreamHeader + StreamData->CurStreamHeader->Size);
613  }
614 
615  DPRINT("GetMappingWithTag Tag %p Buffer %p Flags %lu ByteCount %lx\n", Tag, VirtualAddress, *Flags, *ByteCount);
616  // done
617  return STATUS_SUCCESS;
618 }
619 
620 NTSTATUS
621 NTAPI
622 CIrpQueue::ReleaseMappingWithTag(
623  IN PVOID Tag)
624 {
625  PIRP Irp;
626  PLIST_ENTRY CurEntry;
628  PIO_STACK_LOCATION IoStack;
629  ULONG Index;
630 
631  // first check if there is an active irp
632  if (m_Irp)
633  {
634  // now check if there are already used mappings
635  StreamData = (PKSSTREAM_DATA)m_Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
636 
637  if (StreamData->StreamHeaderIndex)
638  {
639  // check if the released mapping is one current processed irps
640  for(Index = 0; Index < StreamData->StreamHeaderIndex; Index++)
641  {
642  // check if it is the same tag
643  if ((StreamData->Tags[Index].Tag == Tag) &&
644  (StreamData->Tags[Index].Used != FALSE))
645  {
646  // mark mapping as released
647  StreamData->Tags[Index].Tag = NULL;
648  StreamData->Tags[Index].Used = FALSE;
649 
650  // done
651  return STATUS_SUCCESS;
652  }
653 
654  }
655  }
656  }
657 
658  // remove irp from used list
660  if (CurEntry == NULL)
661  {
662  // this should not happen
663  DPRINT("ReleaseMappingWithTag Tag %p not found\n", Tag);
664  return STATUS_NOT_FOUND;
665  }
666 
667  // sanity check
668  PC_ASSERT(CurEntry);
669 
670  // get irp from list entry
671  Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
672 
673  // get stream data
674  StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
675 
676  // sanity check
677  PC_ASSERT(StreamData->StreamHeaderIndex == StreamData->StreamHeaderCount);
678 
679  // check if the released mapping is one of these
680  for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
681  {
682  if ((StreamData->Tags[Index].Tag == Tag) &&
683  (StreamData->Tags[Index].Used != FALSE))
684  {
685  // mark mapping as released
686  StreamData->Tags[Index].Tag = NULL;
687  StreamData->Tags[Index].Used = FALSE;
688 
689  // done
690  break;
691  }
692  else
693  {
694  //
695  // we assume that mappings are released in the same order as they have been acquired
696  // therefore if the current mapping is not the searched one, it must have been already
697  // released
698  //
699  ASSERT(StreamData->Tags[Index].Tag == NULL);
700  ASSERT(StreamData->Tags[Index].Used == FALSE);
701  }
702  }
703 
704  // check if this is the last one released mapping
705  if (Index + 1 == StreamData->StreamHeaderCount)
706  {
707  // last mapping released
708  // now check if this is a looped buffer
710  {
711  // looped buffers are not completed when they have been played
712  // they are completed when the stream is set to stop
713 
714  // reset stream header index
715  StreamData->StreamHeaderIndex = 0;
716 
717  // reset stream header
718  StreamData->CurStreamHeader = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
719 
720  // increment available data
722 
723  // re-insert irp
725 
726  // done
727  return STATUS_SUCCESS;
728  }
729 
730  //
731  // time to complete non looped buffer
732  //
733 
734  // free stream data array
736 
737  // free stream tags array
739 
740  // free stream data
742 
743  // get io stack
745 
746  // store operation status
747  Irp->IoStatus.Status = STATUS_SUCCESS;
748 
749  // store operation length
750  Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
751 
752  // complete the request
754  }
755  else
756  {
757  // there are still some headers not consumed
758  ExInterlockedInsertHeadList(&m_FreeIrpList, &Irp->Tail.Overlay.ListEntry, &m_IrpListLock);
759  }
760 
761  return STATUS_SUCCESS;
762 }
763 
764 BOOLEAN
765 NTAPI
766 CIrpQueue::HasLastMappingFailed()
767 {
768  return m_OutOfMapping;
769 }
770 
771 ULONG
772 NTAPI
773 CIrpQueue::GetCurrentIrpOffset()
774 {
775 
776  return m_CurrentOffset;
777 }
778 
779 BOOLEAN
780 NTAPI
781 CIrpQueue::GetAcquiredTagRange(
782  IN PVOID * FirstTag,
783  IN PVOID * LastTag)
784 {
785  KIRQL OldLevel;
786  BOOLEAN Ret = FALSE;
787  //PIRP Irp;
788  //PLIST_ENTRY CurEntry;
789  //PKSSTREAM_DATA StreamData;
790 
791  // lock list
792  KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
793 
794  // initialize to zero
795  *FirstTag = NULL;
796  *LastTag = NULL;
797 
799 
800  // release lock
801  KeReleaseSpinLock(&m_IrpListLock, OldLevel);
802  // done
803  return Ret;
804 }
805 
806 NTSTATUS
807 NTAPI
809  IN IIrpQueue **Queue)
810 {
812  if (!This)
814 
815  This->AddRef();
816 
817  *Queue = (IIrpQueue*)This;
818  return STATUS_SUCCESS;
819 }
820 
PKSSTREAM_TAG Tags
Definition: irpstream.cpp:75
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define IN
Definition: typedefs.h:38
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:157
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
KSPIN_INTERFACE Interface
Definition: ks.h:2630
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PKSPIN_CONNECT m_ConnectDetails
Definition: irpstream.cpp:44
#define PC_ASSERT(exp)
Definition: usbehci.h:17
_In_ BOOLEAN Release
Definition: classpnp.h:929
_In_ PIRP Irp
Definition: csq.h:116
struct KSSTREAM_TAG * PKSSTREAM_TAG
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define IOCTL_KS_READ_STREAM
Definition: ks.h:164
#define TAG_PORTCLASS
Definition: private.hpp:24
unsigned char * PUCHAR
Definition: retypes.h:3
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
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:647
LONG NTSTATUS
Definition: precomp.h:26
LIST_ENTRY m_FreeIrpList
Definition: irpstream.cpp:49
ULONG StreamHeaderCount
Definition: irpstream.cpp:69
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:367
IRP
Definition: iotypes.h:2462
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define IO_SOUND_INCREMENT
Definition: iotypes.h:575
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
uint32_t ULONG_PTR
Definition: typedefs.h:63
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:1375
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
PLIST_ENTRY NTAPI ExInterlockedInsertHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:114
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
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:45
KSDDKAPI VOID NTAPI KsCancelIo(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock)
Definition: irp.c:1258
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:841
volatile ULONG m_CurrentOffset
Definition: irpstream.cpp:56
#define STDMETHODIMP
Definition: basetyps.h:43
union Alignment_ Alignment
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
PLIST_ENTRY NTAPI ExInterlockedRemoveHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:166
unsigned char BOOLEAN
ULONG StreamHeaderIndex
Definition: irpstream.cpp:70
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define STREAM_DATA_OFFSET
Definition: irpstream.cpp:78
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define InterlockedExchangeAdd
Definition: interlocked.h:181
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:52
struct KSSTREAM_DATA * PKSSTREAM_DATA
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define STATUS_NOT_FOUND
Definition: shellext.h:67
CIrpQueue(IUnknown *OuterUnknown)
Definition: irpstream.cpp:39
ULONG Id
Definition: dmksctrl.h:77
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PKSSTREAM_HEADER CurStreamHeader
Definition: irpstream.cpp:73
BOOLEAN m_OutOfMapping
Definition: irpstream.cpp:51
ULONG m_Alignment
Definition: irpstream.cpp:53
const GUID IID_IUnknown
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
static const UCHAR Index[8]
Definition: usbohci.c:18
STDMETHODIMP_(ULONG) Release()
Definition: irpstream.cpp:27
#define BufferSize
Definition: classpnp.h:419
volatile LONG m_Ref
Definition: irpstream.cpp:58
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG AddRef()
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1060
unsigned char UCHAR
Definition: xmlstorage.h:181
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
Definition: typedefs.h:117
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1060
Status
Definition: gdiplustypes.h:24
virtual ~CIrpQueue()
Definition: irpstream.cpp:40
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
KSPIN_LOCK m_IrpListLock
Definition: irpstream.cpp:47
#define InterlockedIncrement
Definition: armddk.h:53
#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:1633
unsigned int * PULONG
Definition: retypes.h:1
volatile PIRP m_Irp
Definition: irpstream.cpp:57
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
STDMETHODIMP_(ULONG) AddRef()
Definition: irpstream.cpp:22
ULONG TotalStreamData
Definition: irpstream.cpp:71
#define OUT
Definition: typedefs.h:39
PVOID PIRP
Definition: usb.h:38
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: irpstream.cpp:83
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define UNIMPLEMENTED
Definition: debug.h:114
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:682
NTSTATUS NTAPI NewIrpQueue(IN IIrpQueue **Queue)
Definition: irpstream.cpp:808
struct StreamData StreamData
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2777
PVOID * Data
Definition: irpstream.cpp:74
ULONG m_TagSupportEnabled
Definition: irpstream.cpp:54
IoMarkIrpPending(Irp)
signed int * PLONG
Definition: retypes.h:5
LIST_ENTRY m_IrpList
Definition: irpstream.cpp:48
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966
volatile ULONG m_NumDataAvailable
Definition: irpstream.cpp:55