ReactOS  0.4.13-dev-563-g0561610
CPortPinWaveRT Class Reference
Inheritance diagram for CPortPinWaveRT:
Collaboration diagram for CPortPinWaveRT:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
 CPortPinWaveRT (IUnknown *OuterUnknown)
 
virtual ~CPortPinWaveRT ()
 

Public Attributes

 IMP_IPortPinWaveRT
 

Protected Member Functions

NTSTATUS NTAPI HandleKsProperty (IN PIRP Irp)
 
NTSTATUS NTAPI HandleKsStream (IN PIRP Irp)
 
VOID NTAPI SetStreamState (IN KSSTATE State)
 

Protected Attributes

IPortWaveRT * m_Port
 
IPortFilterWaveRT * m_Filter
 
KSPIN_DESCRIPTOR * m_KsPinDescriptor
 
PMINIPORTWAVERT m_Miniport
 
PMINIPORTWAVERTSTREAM m_Stream
 
PPORTWAVERTSTREAM m_PortStream
 
KSSTATE m_State
 
PKSDATAFORMAT m_Format
 
KSPIN_CONNECTm_ConnectDetails
 
PVOID m_CommonBuffer
 
ULONG m_CommonBufferSize
 
ULONG m_CommonBufferOffset
 
IIrpQueue * m_IrpQueue
 
BOOL m_Capture
 
ULONG m_TotalPackets
 
ULONG m_PreCompleted
 
ULONG m_PostCompleted
 
ULONGLONG m_Delay
 
MEMORY_CACHING_TYPE m_CacheType
 
PMDL m_Mdl
 
LONG m_Ref
 

Friends

VOID NTAPI SetStreamWorkerRoutine (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 
VOID NTAPI CloseStreamRoutine (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 

Detailed Description

Definition at line 17 of file pin_wavert.cpp.

Constructor & Destructor Documentation

◆ CPortPinWaveRT()

CPortPinWaveRT::CPortPinWaveRT ( IUnknown OuterUnknown)
inline

Definition at line 39 of file pin_wavert.cpp.

39 {}

◆ ~CPortPinWaveRT()

virtual CPortPinWaveRT::~CPortPinWaveRT ( )
inlinevirtual

Definition at line 40 of file pin_wavert.cpp.

40 {}

Member Function Documentation

◆ HandleKsProperty()

NTSTATUS NTAPI CPortPinWaveRT::HandleKsProperty ( IN PIRP  Irp)
protected

Definition at line 128 of file pin_wavert.cpp.

130 {
134  PIO_STACK_LOCATION IoStack;
135 
137 
138  DPRINT("IPortPinWave_HandleKsProperty entered\n");
139 
140  if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY))
141  {
142  Irp->IoStatus.Information = 0;
143  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
146  }
147 
148  Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
149 
151  {
153  {
154  PKSSTATE State = (PKSSTATE)Irp->UserBuffer;
155 
156  if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSSTATE))
157  {
158  Irp->IoStatus.Information = sizeof(KSSTATE);
159  Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
162  }
163 
164  if (Property->Flags & KSPROPERTY_TYPE_SET)
165  {
167  Irp->IoStatus.Information = 0;
168 
169  if (m_Stream)
170  {
171  Status = m_Stream->SetState(*State);
172 
173  DPRINT("Setting state %u %x\n", *State, Status);
174  if (NT_SUCCESS(Status))
175  {
176  m_State = *State;
177  }
178  }
179  Irp->IoStatus.Status = Status;
181  return Status;
182  }
183  else if (Property->Flags & KSPROPERTY_TYPE_GET)
184  {
185  *State = m_State;
186  Irp->IoStatus.Information = sizeof(KSSTATE);
187  Irp->IoStatus.Status = STATUS_SUCCESS;
189  return STATUS_SUCCESS;
190  }
191  }
193  {
194  PKSDATAFORMAT DataFormat = (PKSDATAFORMAT)Irp->UserBuffer;
195  if (Property->Flags & KSPROPERTY_TYPE_SET)
196  {
197  PKSDATAFORMAT NewDataFormat;
198  if (!RtlCompareMemory(DataFormat, m_Format, DataFormat->FormatSize))
199  {
200  Irp->IoStatus.Information = DataFormat->FormatSize;
201  Irp->IoStatus.Status = STATUS_SUCCESS;
203  return STATUS_SUCCESS;
204  }
205 
206  NewDataFormat = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
207  if (!NewDataFormat)
208  {
209  Irp->IoStatus.Information = 0;
210  Irp->IoStatus.Status = STATUS_NO_MEMORY;
212  return STATUS_NO_MEMORY;
213  }
214  RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize);
215 
216  if (m_Stream)
217  {
218 #if 0
220  ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX));
224 
226 #endif
227  DPRINT("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
228  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
229  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
230 
231  Status = m_Stream->SetFormat(NewDataFormat);
232  if (NT_SUCCESS(Status))
233  {
234  if (m_Format)
236 
237  m_Format = NewDataFormat;
238  Irp->IoStatus.Information = DataFormat->FormatSize;
239  Irp->IoStatus.Status = STATUS_SUCCESS;
241  return STATUS_SUCCESS;
242  }
243  }
244  DPRINT("Failed to set format\n");
245  Irp->IoStatus.Information = 0;
246  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
248  return STATUS_UNSUCCESSFUL;
249  }
250  else if (Property->Flags & KSPROPERTY_TYPE_GET)
251  {
252  if (!m_Format)
253  {
254  DPRINT("No format\n");
255  Irp->IoStatus.Information = 0;
256  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
258  return STATUS_UNSUCCESSFUL;
259  }
260  if (m_Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
261  {
262  Irp->IoStatus.Information = m_Format->FormatSize;
263  Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
266  }
267 
269  Irp->IoStatus.Information = DataFormat->FormatSize;
270  Irp->IoStatus.Status = STATUS_SUCCESS;
272  return STATUS_SUCCESS;
273  }
274  }
275 
276  }
278  DPRINT("Unhandled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
280 
281  Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
282  Irp->IoStatus.Information = 0;
284  return STATUS_NOT_IMPLEMENTED;
285 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
static PWSTR GuidString
Definition: apphelp.c:91
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:921
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
PKSDATAFORMAT m_Format
Definition: pin_wavert.cpp:51
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
KSSTATE m_State
Definition: pin_wavert.cpp:50
LONG NTSTATUS
Definition: precomp.h:26
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define KSPROPSETID_Connection
Definition: ks.h:376
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Definition: ksmedia.h:931
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
enum KSSTATE * PKSSTATE
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KSDATAFORMAT_TYPE_AUDIO
Definition: ksmedia.h:883
Status
Definition: gdiplustypes.h:24
_In_ DWORD Property
Definition: setupapi.h:1545
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
enum State_ State
Definition: pofuncs.h:54
KSSTATE
Definition: ks.h:1244
PMINIPORTWAVERTSTREAM m_Stream
Definition: pin_wavert.cpp:48
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define IO_NO_INCREMENT
Definition: iotypes.h:565
struct KSIDENTIFIER * PKSPROPERTY
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
KSDATAFORMAT * PKSDATAFORMAT

◆ HandleKsStream()

NTSTATUS NTAPI CPortPinWaveRT::HandleKsStream ( IN PIRP  Irp)
protected

Definition at line 289 of file pin_wavert.cpp.

291 {
292  DPRINT("IPortPinWaveRT_HandleKsStream entered State %u Stream %p is UNIMPLEMENTED\n", m_State, m_Stream);
293 
294  return STATUS_PENDING;
295 }
KSSTATE m_State
Definition: pin_wavert.cpp:50
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_PENDING
Definition: ntstatus.h:82
PMINIPORTWAVERTSTREAM m_Stream
Definition: pin_wavert.cpp:48

◆ QueryInterface()

NTSTATUS NTAPI CPortPinWaveRT::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 93 of file pin_wavert.cpp.

96 {
97  DPRINT("IServiceSink_fnQueryInterface entered\n");
98 
99  if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
101  {
102  *Output = PVOID(PUNKNOWN((IIrpTarget*)this));
103  PUNKNOWN(*Output)->AddRef();
104  return STATUS_SUCCESS;
105  }
106  return STATUS_UNSUCCESSFUL;
107 }
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
void DPRINT(...)
Definition: polytest.cpp:61
void * PVOID
Definition: retypes.h:9
const GUID IID_IUnknown
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: arc.h:85
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ SetStreamState()

VOID NTAPI CPortPinWaveRT::SetStreamState ( IN KSSTATE  State)
protected

◆ STDMETHODIMP_() [1/2]

CPortPinWaveRT::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 22 of file pin_wavert.cpp.

23  {
25  return m_Ref;
26  }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CPortPinWaveRT::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 27 of file pin_wavert.cpp.

28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
#define InterlockedDecrement
Definition: armddk.h:52

Friends And Related Function Documentation

◆ CloseStreamRoutine

VOID NTAPI CloseStreamRoutine ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)
friend

Definition at line 374 of file pin_wavert.cpp.

377 {
380  ISubdevice *ISubDevice;
384 
385  This = (CPortPinWaveRT*)Ctx->Pin;
386 
387  if (This->m_Stream)
388  {
389  if (This->m_State != KSSTATE_STOP)
390  {
391  This->m_Stream->SetState(KSSTATE_STOP);
393  }
394  }
395 
396  Status = This->m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
397  if (NT_SUCCESS(Status))
398  {
399  Status = ISubDevice->GetDescriptor(&Descriptor);
400  if (NT_SUCCESS(Status))
401  {
402  Descriptor->Factory.Instances[This->m_ConnectDetails->PinId].CurrentPinInstanceCount--;
403  }
404  ISubDevice->Release();
405  }
406 
407  if (This->m_Format)
408  {
409  FreeItem(This->m_Format, TAG_PORTCLASS);
410  This->m_Format = NULL;
411  }
412 
413  if (This->m_IrpQueue)
414  {
415  This->m_IrpQueue->Release();
416  }
417 
418  // complete the irp
419  Ctx->Irp->IoStatus.Information = 0;
420  Ctx->Irp->IoStatus.Status = STATUS_SUCCESS;
422 
423  // free the work item
424  IoFreeWorkItem(Ctx->WorkItem);
425 
426  // free work item ctx
427  FreeItem(Ctx, TAG_PORTCLASS);
428 
429  if (This->m_Stream)
430  {
431  Stream = This->m_Stream;
432  This->m_Stream = NULL;
433  DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
434  Stream->Release();
435  }
436 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define TAG_PORTCLASS
Definition: private.hpp:24
IMiniportWaveRTStream * PMINIPORTWAVERTSTREAM
Definition: portcls.h:1809
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
nsrefcnt Release()
PIO_WORKITEM WorkItem
Definition: private.hpp:424
Status
Definition: gdiplustypes.h:24
struct CLOSESTREAM_CONTEXT * PCLOSESTREAM_CONTEXT
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2777
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ SetStreamWorkerRoutine

VOID NTAPI SetStreamWorkerRoutine ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)
friend

Member Data Documentation

◆ IMP_IPortPinWaveRT

CPortPinWaveRT::IMP_IPortPinWaveRT

Definition at line 38 of file pin_wavert.cpp.

◆ m_CacheType

MEMORY_CACHING_TYPE CPortPinWaveRT::m_CacheType
protected

Definition at line 68 of file pin_wavert.cpp.

◆ m_Capture

BOOL CPortPinWaveRT::m_Capture
protected

Definition at line 60 of file pin_wavert.cpp.

◆ m_CommonBuffer

PVOID CPortPinWaveRT::m_CommonBuffer
protected

Definition at line 54 of file pin_wavert.cpp.

◆ m_CommonBufferOffset

ULONG CPortPinWaveRT::m_CommonBufferOffset
protected

Definition at line 56 of file pin_wavert.cpp.

◆ m_CommonBufferSize

ULONG CPortPinWaveRT::m_CommonBufferSize
protected

Definition at line 55 of file pin_wavert.cpp.

◆ m_ConnectDetails

KSPIN_CONNECT* CPortPinWaveRT::m_ConnectDetails
protected

Definition at line 52 of file pin_wavert.cpp.

◆ m_Delay

ULONGLONG CPortPinWaveRT::m_Delay
protected

Definition at line 66 of file pin_wavert.cpp.

◆ m_Filter

IPortFilterWaveRT* CPortPinWaveRT::m_Filter
protected

Definition at line 45 of file pin_wavert.cpp.

◆ m_Format

PKSDATAFORMAT CPortPinWaveRT::m_Format
protected

Definition at line 51 of file pin_wavert.cpp.

Referenced by HandleKsProperty().

◆ m_IrpQueue

IIrpQueue* CPortPinWaveRT::m_IrpQueue
protected

Definition at line 58 of file pin_wavert.cpp.

◆ m_KsPinDescriptor

KSPIN_DESCRIPTOR* CPortPinWaveRT::m_KsPinDescriptor
protected

Definition at line 46 of file pin_wavert.cpp.

◆ m_Mdl

PMDL CPortPinWaveRT::m_Mdl
protected

Definition at line 69 of file pin_wavert.cpp.

◆ m_Miniport

PMINIPORTWAVERT CPortPinWaveRT::m_Miniport
protected

Definition at line 47 of file pin_wavert.cpp.

◆ m_Port

IPortWaveRT* CPortPinWaveRT::m_Port
protected

Definition at line 44 of file pin_wavert.cpp.

◆ m_PortStream

PPORTWAVERTSTREAM CPortPinWaveRT::m_PortStream
protected

Definition at line 49 of file pin_wavert.cpp.

◆ m_PostCompleted

ULONG CPortPinWaveRT::m_PostCompleted
protected

Definition at line 64 of file pin_wavert.cpp.

◆ m_PreCompleted

ULONG CPortPinWaveRT::m_PreCompleted
protected

Definition at line 63 of file pin_wavert.cpp.

◆ m_Ref

LONG CPortPinWaveRT::m_Ref
protected

Definition at line 71 of file pin_wavert.cpp.

Referenced by STDMETHODIMP_().

◆ m_State

KSSTATE CPortPinWaveRT::m_State
protected

Definition at line 50 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_Stream

PMINIPORTWAVERTSTREAM CPortPinWaveRT::m_Stream
protected

Definition at line 48 of file pin_wavert.cpp.

Referenced by HandleKsProperty(), and HandleKsStream().

◆ m_TotalPackets

ULONG CPortPinWaveRT::m_TotalPackets
protected

Definition at line 62 of file pin_wavert.cpp.


The documentation for this class was generated from the following file: