ReactOS 0.4.15-dev-5672-gf73ac17
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#ifndef YDEBUG
12#define NDEBUG
13#endif
14
15#include <debug.h>
16
17class CPortFilterWaveCyclic : public CUnknownImpl<IPortFilterWaveCyclic>
18{
19public:
21
25
26protected:
27 IPortWaveCyclic* m_Port;
28 IPortPinWaveCyclic ** m_Pins;
30 ISubdevice * m_SubDevice;
31};
32
36 IN REFIID refiid,
38{
39 if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
41 {
42 *Output = PVOID(PUNKNOWN(this));
43 PUNKNOWN(*Output)->AddRef();
44 return STATUS_SUCCESS;
45 }
46 else if (IsEqualGUIDAligned(refiid, IID_IPort))
47 {
49 PUNKNOWN(*Output)->AddRef();
50 return STATUS_SUCCESS;
51 }
52
54}
55
58CPortFilterWaveCyclic::NewIrpTarget(
59 OUT struct IIrpTarget **OutTarget,
64 IN PIRP Irp,
65 IN KSOBJECT_CREATE *CreateObject)
66{
68 IPortPinWaveCyclic * Pin;
69 PKSPIN_CONNECT ConnectDetails;
70
71#if 0
75#endif
76
77 DPRINT("CPortFilterWaveCyclic::NewIrpTarget entered\n");
78
79 // let's verify the connection request
81 if (!NT_SUCCESS(Status))
82 {
84 }
85
86 if (m_Pins[ConnectDetails->PinId] &&
88 {
89 // release existing instance
91 }
92
93 // now create the pin
95 if (!NT_SUCCESS(Status))
96 {
97 return Status;
98 }
99
100 // initialize the pin
101 Status = Pin->Init(m_Port, this, ConnectDetails, &m_Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId]);
102 if (!NT_SUCCESS(Status))
103 {
104 Pin->Release();
105 return Status;
106 }
107
108 // store pin
109 m_Pins[ConnectDetails->PinId] = Pin;
110
111 // store result
112 *OutTarget = (IIrpTarget*)Pin;
113
114 // increment current instance count
116
117 return Status;
118}
119
121NTAPI
122CPortFilterWaveCyclic::DeviceIoControl(
124 IN PIRP Irp)
125{
126 PIO_STACK_LOCATION IoStack;
128
130
131 if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
132 {
133 DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
134
135 Irp->IoStatus.Status = STATUS_NOT_FOUND;
136
138 return STATUS_NOT_FOUND;
139 }
140
142 if (Status != STATUS_PENDING)
143 {
144 Irp->IoStatus.Status = Status;
145 DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
147 }
148 return Status;
149}
150
152NTAPI
153CPortFilterWaveCyclic::Read(
155 IN PIRP Irp)
156{
158}
159
161NTAPI
162CPortFilterWaveCyclic::Write(
164 IN PIRP Irp)
165{
167}
168
170NTAPI
171CPortFilterWaveCyclic::Flush(
173 IN PIRP Irp)
174{
176}
177
179NTAPI
180CPortFilterWaveCyclic::Close(
182 IN PIRP Irp)
183{
184 //ULONG Index;
186
187#if 0
188 if (m_ref == 1)
189 {
191 {
192 // all pins should have been closed by now
193 ASSERT(m_Pins[Index] == NULL);
194 }
195
196 // release reference to port
197 m_SubDevice->Release(m_SubDevice);
198
199 // time to shutdown the audio system
200 Status = m_SubDevice->ReleaseChildren(m_SubDevice);
201 }
202#endif
203
204 Irp->IoStatus.Status = Status;
205 Irp->IoStatus.Information = 0;
207
208 return STATUS_SUCCESS;
209}
210
212NTAPI
213CPortFilterWaveCyclic::QuerySecurity(
215 IN PIRP Irp)
216{
218}
219
221NTAPI
222CPortFilterWaveCyclic::SetSecurity(
224 IN PIRP Irp)
225{
227}
228
230NTAPI
231CPortFilterWaveCyclic::FastDeviceIoControl(
239 OUT PIO_STATUS_BLOCK StatusBlock,
241{
243}
244
246NTAPI
247CPortFilterWaveCyclic::FastRead(
254 OUT PIO_STATUS_BLOCK StatusBlock,
256{
258 return FALSE;
259}
260
262NTAPI
263CPortFilterWaveCyclic::FastWrite(
270 OUT PIO_STATUS_BLOCK StatusBlock,
272{
274 return FALSE;
275}
276
278NTAPI
279CPortFilterWaveCyclic::Init(
280 IN IPortWaveCyclic* Port)
281{
282 ISubdevice * ISubDevice;
285
286 // get our private interface
287 Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
288 if (!NT_SUCCESS(Status))
289 return STATUS_UNSUCCESSFUL;
290
291 // get the subdevice descriptor
292 Status = ISubDevice->GetDescriptor(&Descriptor);
293
294 // store subdevice interface
295 m_SubDevice = ISubDevice;
296
297 if (!NT_SUCCESS(Status))
298 return STATUS_UNSUCCESSFUL;
299
300 // save descriptor
302
303 // allocate pin array
304 m_Pins = (IPortPinWaveCyclic**)AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount * sizeof(IPortPinWaveCyclic*), TAG_PORTCLASS);
305
306 if (!m_Pins)
307 return STATUS_UNSUCCESSFUL;
308
309 // store port driver
310 m_Port = Port;
311
312 return STATUS_SUCCESS;
313}
314
315
317NTAPI
318CPortFilterWaveCyclic::FreePin(
320{
321 ULONG Index;
322
324 {
325 if (m_Pins[Index] == Pin)
326 {
328 m_Pins[Index] = NULL;
329 return STATUS_SUCCESS;
330 }
331 }
332 return STATUS_UNSUCCESSFUL;
333}
334
335
338 OUT IPortFilterWaveCyclic ** OutFilter)
339{
341
343
344 if (!This)
346
347 This->AddRef();
348
349 // return result
350 *OutFilter = (IPortFilterWaveCyclic*)This;
351
352 return STATUS_SUCCESS;
353}
354
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:1168
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:1230
#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:30
#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:998
#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:81
#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