ReactOS 0.4.15-dev-7201-g2de6e75
filter_wavecyclic.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_wavecyclic.c
5 * PURPOSE: portcls wave cyclic filter
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9#include "private.hpp"
10
11#define NDEBUG
12#include <debug.h>
13
14class CPortFilterWaveCyclic : public CUnknownImpl<IPortFilterWaveCyclic>
15{
16public:
18
22
23protected:
24 IPortWaveCyclic* m_Port;
25 IPortPinWaveCyclic ** m_Pins;
27 ISubdevice * m_SubDevice;
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
55CPortFilterWaveCyclic::NewIrpTarget(
56 OUT struct IIrpTarget **OutTarget,
61 IN PIRP Irp,
62 IN KSOBJECT_CREATE *CreateObject)
63{
65 IPortPinWaveCyclic * Pin;
66 PKSPIN_CONNECT ConnectDetails;
67
68#if 0
72#endif
73
74 DPRINT("CPortFilterWaveCyclic::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] &&
85 {
86 // release existing instance
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]);
99 if (!NT_SUCCESS(Status))
100 {
101 Pin->Release();
102 return Status;
103 }
104
105 // store pin
106 m_Pins[ConnectDetails->PinId] = Pin;
107
108 // store result
109 *OutTarget = (IIrpTarget*)Pin;
110
111 // increment current instance count
113
114 return Status;
115}
116
118NTAPI
119CPortFilterWaveCyclic::DeviceIoControl(
121 IN PIRP Irp)
122{
123 PIO_STACK_LOCATION IoStack;
125
127
128 if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
129 {
130 DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
131
132 Irp->IoStatus.Status = STATUS_NOT_FOUND;
133
135 return STATUS_NOT_FOUND;
136 }
137
139 if (Status != STATUS_PENDING)
140 {
141 Irp->IoStatus.Status = Status;
142 DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
144 }
145 return Status;
146}
147
149NTAPI
150CPortFilterWaveCyclic::Read(
152 IN PIRP Irp)
153{
155}
156
158NTAPI
159CPortFilterWaveCyclic::Write(
161 IN PIRP Irp)
162{
164}
165
167NTAPI
168CPortFilterWaveCyclic::Flush(
170 IN PIRP Irp)
171{
173}
174
176NTAPI
177CPortFilterWaveCyclic::Close(
179 IN PIRP Irp)
180{
181 //ULONG Index;
183
184#if 0
185 if (m_ref == 1)
186 {
188 {
189 // all pins should have been closed by now
190 ASSERT(m_Pins[Index] == NULL);
191 }
192
193 // release reference to port
194 m_SubDevice->Release(m_SubDevice);
195
196 // time to shutdown the audio system
197 Status = m_SubDevice->ReleaseChildren(m_SubDevice);
198 }
199#endif
200
201 Irp->IoStatus.Status = Status;
202 Irp->IoStatus.Information = 0;
204
205 return STATUS_SUCCESS;
206}
207
209NTAPI
210CPortFilterWaveCyclic::QuerySecurity(
212 IN PIRP Irp)
213{
215}
216
218NTAPI
219CPortFilterWaveCyclic::SetSecurity(
221 IN PIRP Irp)
222{
224}
225
227NTAPI
228CPortFilterWaveCyclic::FastDeviceIoControl(
236 OUT PIO_STATUS_BLOCK StatusBlock,
238{
240}
241
243NTAPI
244CPortFilterWaveCyclic::FastRead(
251 OUT PIO_STATUS_BLOCK StatusBlock,
253{
255 return FALSE;
256}
257
259NTAPI
260CPortFilterWaveCyclic::FastWrite(
267 OUT PIO_STATUS_BLOCK StatusBlock,
269{
271 return FALSE;
272}
273
275NTAPI
276CPortFilterWaveCyclic::Init(
277 IN IPortWaveCyclic* Port)
278{
279 ISubdevice * ISubDevice;
282
283 // get our private interface
284 Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
285 if (!NT_SUCCESS(Status))
286 return STATUS_UNSUCCESSFUL;
287
288 // get the subdevice descriptor
289 Status = ISubDevice->GetDescriptor(&Descriptor);
290
291 // store subdevice interface
292 m_SubDevice = ISubDevice;
293
294 if (!NT_SUCCESS(Status))
295 return STATUS_UNSUCCESSFUL;
296
297 // save descriptor
299
300 // allocate pin array
301 m_Pins = (IPortPinWaveCyclic**)AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount * sizeof(IPortPinWaveCyclic*), TAG_PORTCLASS);
302
303 if (!m_Pins)
304 return STATUS_UNSUCCESSFUL;
305
306 // store port driver
307 m_Port = Port;
308
309 return STATUS_SUCCESS;
310}
311
313NTAPI
314CPortFilterWaveCyclic::FreePin(
316{
317 ULONG Index;
318
320 {
321 if (m_Pins[Index] == Pin)
322 {
324 m_Pins[Index] = NULL;
325 return STATUS_SUCCESS;
326 }
327 }
328 return STATUS_UNSUCCESSFUL;
329}
330
333 OUT IPortFilterWaveCyclic ** OutFilter)
334{
336
338
339 if (!This)
341
342 This->AddRef();
343
344 // return result
345 *OutFilter = (IPortFilterWaveCyclic*)This;
346
347 return STATUS_SUCCESS;
348}
unsigned char BOOLEAN
IPortPinWaveCyclic * PPORTPINWAVECYCLIC
Definition: interfaces.hpp:798
LONG NTSTATUS
Definition: precomp.h:26
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
#define UNIMPLEMENTED
Definition: debug.h:115
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
SUBDEVICE_DESCRIPTOR * m_Descriptor
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
IPortPinWaveCyclic ** m_Pins
IPortWaveCyclic * m_Port
CPortFilterWaveCyclic(IUnknown *OuterUnknown)
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
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
#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 NewPortFilterWaveCyclic(OUT IPortFilterWaveCyclic **OutFilter)
Status
Definition: gdiplustypes.h:25
CPPORT Port[4]
Definition: headless.c:35
@ Unknown
Definition: i8042prt.h:114
ULONG AddRef()
#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 NewPortPinWaveCyclic(OUT IPortPinWaveCyclic **OutPin)
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
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 STATUS_NOT_FOUND
Definition: shellext.h:72
#define DPRINT
Definition: sndvol32.h:71
ULONG PinId
Definition: ks.h:2603
PIN_INSTANCE_INFO * Instances
Definition: interfaces.hpp:201
ULONG PinDescriptorCount
Definition: interfaces.hpp:198
KSPIN_DESCRIPTOR * KsPinDescriptor
Definition: interfaces.hpp:200
ULONG MaxFilterInstanceCount
Definition: interfaces.hpp:189
ULONG CurrentPinInstanceCount
Definition: interfaces.hpp:191
PKSPROPERTY_SET FilterPropertySet
Definition: interfaces.hpp:210
KSPIN_FACTORY Factory
Definition: interfaces.hpp:208
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
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_ WDFCOLLECTION _In_ ULONG Index
_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
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598
* PFILE_OBJECT
Definition: iotypes.h:1998