ReactOS 0.4.15-dev-8135-g1bc6c90
filter_wavert.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/filter_wavert.cpp
5 * PURPOSE: portcls wave RT filter
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9#include "private.hpp"
10
11#define NDEBUG
12#include <debug.h>
13
14class CPortFilterWaveRT : public CUnknownImpl<IPortFilterWaveRT>
15{
16public:
18
20 CPortFilterWaveRT(IUnknown *OuterUnknown){}
22
23protected:
24
25 IPortWaveRT* m_Port;
26 IPortPinWaveRT ** m_Pins;
28};
29
33 IN REFIID refiid,
35{
36 if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
38 {
39 *Output = PVOID(PUNKNOWN(this));
40 PUNKNOWN(*Output)->AddRef();
41 return STATUS_SUCCESS;
42 }
43 else if (IsEqualGUIDAligned(refiid, IID_IPort))
44 {
46 PUNKNOWN(*Output)->AddRef();
47 return STATUS_SUCCESS;
48 }
49
51}
52
55CPortFilterWaveRT::NewIrpTarget(
56 OUT struct IIrpTarget **OutTarget,
61 IN PIRP Irp,
62 IN KSOBJECT_CREATE *CreateObject)
63{
65 IPortPinWaveRT * Pin;
66 PKSPIN_CONNECT ConnectDetails;
67
68#if 0
72#endif
73
74 DPRINT("CPortFilterWaveRT::NewIrpTarget entered\n");
75
76 // let's verify the connection request
78 if (!NT_SUCCESS(Status))
79 {
81 }
82
83 if (m_Pins[ConnectDetails->PinId] && m_Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount)
84 {
85 // release existing instance
86 PC_ASSERT(0);
87 m_Pins[ConnectDetails->PinId]->Close(DeviceObject, NULL);
88 }
89
90 // now create the pin
92 if (!NT_SUCCESS(Status))
93 {
94 return Status;
95 }
96
97 // initialize the pin
98 Status = Pin->Init(m_Port, this, ConnectDetails, &m_Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId], GetDeviceObjectFromPortWaveRT(m_Port));
99 if (!NT_SUCCESS(Status))
100 {
101 Pin->Release();
102 return Status;
103 }
104
105 // release existing pin
106 if (m_Pins[ConnectDetails->PinId])
107 {
108 m_Pins[ConnectDetails->PinId]->Release();
109 }
110 // store pin
111 m_Pins[ConnectDetails->PinId] = Pin;
112
113 // store result
114 *OutTarget = (IIrpTarget*)Pin;
115
116 // increment current instance count
118
119 return Status;
120}
121
123NTAPI
124CPortFilterWaveRT::DeviceIoControl(
126 IN PIRP Irp)
127{
128 PIO_STACK_LOCATION IoStack;
130
132
133 if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
134 {
135 DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
136
137 Irp->IoStatus.Status = STATUS_SUCCESS;
138
140 return STATUS_SUCCESS;
141 }
142
144 if (Status != STATUS_PENDING)
145 {
146 Irp->IoStatus.Status = Status;
147 DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
149 }
150 return Status;
151}
152
154NTAPI
155CPortFilterWaveRT::Read(
157 IN PIRP Irp)
158{
160}
161
163NTAPI
164CPortFilterWaveRT::Write(
166 IN PIRP Irp)
167{
169}
170
172NTAPI
173CPortFilterWaveRT::Flush(
175 IN PIRP Irp)
176{
178}
179
181NTAPI
182CPortFilterWaveRT::Close(
184 IN PIRP Irp)
185{
186 Irp->IoStatus.Status = STATUS_SUCCESS;
187 Irp->IoStatus.Information = 0;
189
190 return STATUS_UNSUCCESSFUL;
191}
192
194NTAPI
195CPortFilterWaveRT::QuerySecurity(
197 IN PIRP Irp)
198{
200}
201
203NTAPI
204CPortFilterWaveRT::SetSecurity(
206 IN PIRP Irp)
207{
209}
210
212NTAPI
213CPortFilterWaveRT::FastDeviceIoControl(
221 OUT PIO_STATUS_BLOCK StatusBlock,
223{
224 return FALSE;
225}
226
228NTAPI
229CPortFilterWaveRT::FastRead(
236 OUT PIO_STATUS_BLOCK StatusBlock,
238{
239 return FALSE;
240}
241
243NTAPI
244CPortFilterWaveRT::FastWrite(
245
252 OUT PIO_STATUS_BLOCK StatusBlock,
254{
255 return FALSE;
256}
257
259NTAPI
260CPortFilterWaveRT::Init(
261 IN IPortWaveRT* Port)
262{
263 ISubdevice * ISubDevice;
266
267 m_Port = Port;
268
269 // get our private interface
270 Status = m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
271 if (!NT_SUCCESS(Status))
272 return STATUS_UNSUCCESSFUL;
273
274 // get the subdevice descriptor
275 Status = ISubDevice->GetDescriptor(&Descriptor);
276
277 // release subdevice interface
278 ISubDevice->Release();
279
280 if (!NT_SUCCESS(Status))
281 return STATUS_UNSUCCESSFUL;
282
283 // save descriptor
285
286 // allocate pin array
287 m_Pins = (IPortPinWaveRT**)AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount * sizeof(IPortPinWaveRT*), TAG_PORTCLASS);
288
289 if (!m_Pins)
290 return STATUS_UNSUCCESSFUL;
291
292 // increment reference count
293 Port->AddRef();
294
295 return STATUS_SUCCESS;
296}
297
300 OUT IPortFilterWaveRT ** OutFilter)
301{
303
305 if (!This)
307
308 This->AddRef();
309
310 // return result
311 *OutFilter = (CPortFilterWaveRT*)This;
312
313 return STATUS_SUCCESS;
314}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
IPortPinWaveRT ** m_Pins
CPortFilterWaveRT(IUnknown *OuterUnknown)
virtual ~CPortFilterWaveRT()
SUBDEVICE_DESCRIPTOR * m_Descriptor
IPortWaveRT * m_Port
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1189
#define NonPagedPool
Definition: env_spec_w32.h:307
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2665
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:427
NTSTATUS NewPortFilterWaveRT(OUT IPortFilterWaveRT **OutFilter)
Status
Definition: gdiplustypes.h:25
CPPORT Port[4]
Definition: headless.c:35
@ Unknown
Definition: i8042prt.h:114
ULONG AddRef()
nsrefcnt Release()
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NewPortPinWaveRT(OUT IPortPinWaveRT **OutPin)
Definition: pin_wavert.cpp:670
PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT(PPORTWAVERT iface)
NTSTATUS NTAPI PcValidateConnectRequest(IN PIRP Irp, IN KSPIN_FACTORY *Descriptor, OUT PKSPIN_CONNECT *Connect)
Definition: undoc.cpp:985
#define TAG_PORTCLASS
Definition: private.hpp:24
#define PC_ASSERT(exp)
Definition: private.hpp:26
NTSTATUS NTAPI PcHandlePropertyWithTable(IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR Descriptor)
Definition: undoc.cpp:78
#define REFIID
Definition: guiddef.h:118
@ Output
Definition: arc.h:85
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
ULONG PinId
Definition: ks.h:2603
PIN_INSTANCE_INFO * Instances
Definition: interfaces.hpp:201
KSPIN_DESCRIPTOR * KsPinDescriptor
Definition: interfaces.hpp:200
ULONG CurrentPinInstanceCount
Definition: interfaces.hpp:191
PKSPROPERTY_SET FilterPropertySet
Definition: interfaces.hpp:210
KSPIN_FACTORY Factory
Definition: interfaces.hpp:208
struct _IO_STACK_LOCATION::@1568::@1569 DeviceIoControl
union _IO_STACK_LOCATION::@1568 Parameters
const uint16_t * PCWSTR
Definition: typedefs.h:57
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_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
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define IO_NO_INCREMENT
Definition: iotypes.h:598
* PFILE_OBJECT
Definition: iotypes.h:1998