ReactOS 0.4.15-dev-7674-gc0b4db1
filter_wavepci.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_wavepci.cpp
5 * PURPOSE: portcls wave pci filter
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9#include "private.hpp"
10
11#define NDEBUG
12#include <debug.h>
13
14class CPortFilterWavePci : public CUnknownImpl<IPortFilterWavePci>
15{
16public:
18
22
23protected:
24 IPortWavePci* m_Port;
25 IPortPinWavePci ** m_Pins;
27};
28
32
33 IN REFIID refiid,
35{
36
37 if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
39 {
40 *Output = PVOID(PUNKNOWN(this));
41 PUNKNOWN(*Output)->AddRef();
42 return STATUS_SUCCESS;
43 }
44 else if (IsEqualGUIDAligned(refiid, IID_IPort))
45 {
47 PUNKNOWN(*Output)->AddRef();
48 return STATUS_SUCCESS;
49 }
50
52}
53
56CPortFilterWavePci::NewIrpTarget(
57 OUT struct IIrpTarget **OutTarget,
62 IN PIRP Irp,
63 IN KSOBJECT_CREATE *CreateObject)
64{
66 IPortPinWavePci * Pin;
67 PKSPIN_CONNECT ConnectDetails;
68
69#if 0
73#endif
74
75 DPRINT("CPortFilterWavePci::NewIrpTarget entered\n");
76
77 // let's verify the connection request
79 if (!NT_SUCCESS(Status))
80 {
82 }
83
84 if (m_Pins[ConnectDetails->PinId] &&
86 {
87 // no available instance
89 }
90
91 // now create the pin
93 if (!NT_SUCCESS(Status))
94 {
95 return Status;
96 }
97
98 // initialize the pin
99 Status = Pin->Init(m_Port, this, ConnectDetails, &m_Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId], GetDeviceObjectFromPortWavePci(m_Port));
100 if (!NT_SUCCESS(Status))
101 {
102 Pin->Release();
103 return Status;
104 }
105
106 // store pin
107 m_Pins[ConnectDetails->PinId] = Pin;
108
109 // store result
110 *OutTarget = (IIrpTarget*)Pin;
111
112 // increment current instance count
114
115 return Status;
116}
117
119NTAPI
120CPortFilterWavePci::DeviceIoControl(
122 IN PIRP Irp)
123{
124 PIO_STACK_LOCATION IoStack;
126
128
129 if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
130 {
131 DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
132
133 Irp->IoStatus.Status = STATUS_SUCCESS;
134
136 return STATUS_SUCCESS;
137 }
138
140 if (Status != STATUS_PENDING)
141 {
142 Irp->IoStatus.Status = Status;
143 DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
145 }
146 return Status;
147}
148
150NTAPI
151CPortFilterWavePci::Read(
153 IN PIRP Irp)
154{
156}
157
159NTAPI
160CPortFilterWavePci::Write(
162 IN PIRP Irp)
163{
165}
166
168NTAPI
169CPortFilterWavePci::Flush(
171 IN PIRP Irp)
172{
174}
175
177NTAPI
178CPortFilterWavePci::Close(
180 IN PIRP Irp)
181{
182 Irp->IoStatus.Status = STATUS_SUCCESS;
183 Irp->IoStatus.Information = 0;
185
186 return STATUS_UNSUCCESSFUL;
187}
188
190NTAPI
191CPortFilterWavePci::QuerySecurity(
193 IN PIRP Irp)
194{
196}
197
199NTAPI
200CPortFilterWavePci::SetSecurity(
202 IN PIRP Irp)
203{
205}
206
208NTAPI
209CPortFilterWavePci::FastDeviceIoControl(
217 OUT PIO_STATUS_BLOCK StatusBlock,
219{
220 return FALSE;
221}
222
224NTAPI
225CPortFilterWavePci::FastRead(
232 OUT PIO_STATUS_BLOCK StatusBlock,
234{
235 return FALSE;
236}
237
239NTAPI
240CPortFilterWavePci::FastWrite(
247 OUT PIO_STATUS_BLOCK StatusBlock,
249{
250 return FALSE;
251}
252
254NTAPI
255CPortFilterWavePci::Init(
256 IN IPortWavePci* Port)
257{
258 ISubdevice * ISubDevice;
261
262 m_Port = Port;
263
264 // get our private interface
265 Status = m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
266 if (!NT_SUCCESS(Status))
267 return STATUS_UNSUCCESSFUL;
268
269 // get the subdevice descriptor
270 Status = ISubDevice->GetDescriptor(&Descriptor);
271
272 // release subdevice interface
273 ISubDevice->Release();
274
275 if (!NT_SUCCESS(Status))
276 return STATUS_UNSUCCESSFUL;
277
278 // save descriptor
280
281 // allocate pin array
282 m_Pins = (IPortPinWavePci**)AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount * sizeof(IPortPinWavePci*), TAG_PORTCLASS);
283
284 if (!m_Pins)
285 return STATUS_UNSUCCESSFUL;
286
287 // increment reference count
288 Port->AddRef();
289
290 return STATUS_SUCCESS;
291}
292
294NTAPI
295CPortFilterWavePci::FreePin(
296 IN struct IPortPinWavePci* Pin)
297{
298 ULONG Index;
299
301 {
302 if (m_Pins[Index] == Pin)
303 {
305 m_Pins[Index] = NULL;
306 return STATUS_SUCCESS;
307 }
308 }
309 return STATUS_UNSUCCESSFUL;
310}
311
314 OUT IPortFilterWavePci ** OutFilter)
315{
317
319 if (!This)
321
322 This->AddRef();
323
324 // return result
325 *OutFilter = (IPortFilterWavePci*)This;
326
327 return STATUS_SUCCESS;
328}
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
virtual ~CPortFilterWavePci()
SUBDEVICE_DESCRIPTOR * m_Descriptor
IPortWavePci * m_Port
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
IPortPinWavePci ** m_Pins
CPortFilterWavePci(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
#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 NewPortFilterWavePci(OUT IPortFilterWavePci **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 NewPortPinWavePci(OUT IPortPinWavePci **OutPin)
PDEVICE_OBJECT GetDeviceObjectFromPortWavePci(IPortWavePci *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
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: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