ReactOS  0.4.14-dev-115-g4576127
filter_topology.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_topology.c
5  * PURPOSE: portcls topology 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 
17 class CPortFilterTopology : public IPortFilterTopology
18 {
19 public:
21 
23  {
25  return m_Ref;
26  }
28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
39  CPortFilterTopology(IUnknown *OuterUnknown){}
41 
42 protected:
43  IPortTopology * m_Port;
45  ISubdevice * m_SubDevice;
47 };
48 
49 
51 NTAPI
53  IN REFIID refiid,
54  OUT PVOID* Output)
55 {
56 
57  if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
59  {
60  *Output = PVOID(PUNKNOWN(this));
61  PUNKNOWN(*Output)->AddRef();
62  return STATUS_SUCCESS;
63  }
64  else if (IsEqualGUIDAligned(refiid, IID_IPort))
65  {
67  PUNKNOWN(*Output)->AddRef();
68  return STATUS_SUCCESS;
69  }
70 
71  return STATUS_UNSUCCESSFUL;
72 }
73 
75 NTAPI
76 CPortFilterTopology::NewIrpTarget(
77  OUT struct IIrpTarget **OutTarget,
78  IN PCWSTR Name,
82  IN PIRP Irp,
83  IN KSOBJECT_CREATE *CreateObject)
84 {
85  DPRINT("CPortFilterTopology::NewIrpTarget entered\n");
86 
87  return STATUS_NOT_SUPPORTED;
88 }
89 
90 
92 NTAPI
95  IN PIRP Irp)
96 {
97  PIO_STACK_LOCATION IoStack;
99 
101 
102  if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
103  {
104  DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
105 
106  Irp->IoStatus.Status = STATUS_SUCCESS;
107 
109  return STATUS_SUCCESS;
110  }
111 
113  if (Status != STATUS_PENDING)
114  {
115  Irp->IoStatus.Status = Status;
116  DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
118  }
119  return Status;
120 
121 }
122 
123 NTSTATUS
124 NTAPI
127  IN PIRP Irp)
128 {
130 }
131 
132 NTSTATUS
133 NTAPI
136  IN PIRP Irp)
137 {
139 }
140 
141 NTSTATUS
142 NTAPI
145  IN PIRP Irp)
146 {
148 }
149 
150 NTSTATUS
151 NTAPI
154  IN PIRP Irp)
155 {
157 
158  // FIXME handle DirectSound
159 
160 #if 0
161 //FIXME
162  if (m_ref == 1)
163  {
164  // release reference to port
165  This->SubDevice->lpVtbl->Release(This->SubDevice);
166 
167  // time to shutdown the audio system
168  Status = This->SubDevice->lpVtbl->ReleaseChildren(This->SubDevice);
169  }
170 #endif
171 
172  Irp->IoStatus.Status = Status;
173  Irp->IoStatus.Information = 0;
175 
176  return STATUS_SUCCESS;
177 }
178 
179 NTSTATUS
180 NTAPI
181 CPortFilterTopology::QuerySecurity(
183  IN PIRP Irp)
184 {
186 }
187 
188 NTSTATUS
189 NTAPI
190 CPortFilterTopology::SetSecurity(
192  IN PIRP Irp)
193 {
195 }
196 
197 BOOLEAN
198 NTAPI
199 CPortFilterTopology::FastDeviceIoControl(
201  IN BOOLEAN Wait,
207  OUT PIO_STATUS_BLOCK StatusBlock,
209 {
210  return FALSE;
211 }
212 
213 BOOLEAN
214 NTAPI
215 CPortFilterTopology::FastRead(
218  IN ULONG Length,
219  IN BOOLEAN Wait,
220  IN ULONG LockKey,
221  IN PVOID Buffer,
222  OUT PIO_STATUS_BLOCK StatusBlock,
224 {
225  return FALSE;
226 }
227 
228 BOOLEAN
229 NTAPI
230 CPortFilterTopology::FastWrite(
233  IN ULONG Length,
234  IN BOOLEAN Wait,
235  IN ULONG LockKey,
236  IN PVOID Buffer,
237  OUT PIO_STATUS_BLOCK StatusBlock,
239 {
240  return FALSE;
241 }
242 
243 NTSTATUS
244 NTAPI
246  IN IPortTopology* Port)
247 {
248  ISubdevice * ISubDevice;
251 
252 
253  // get our private interface
254  Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
255  if (!NT_SUCCESS(Status))
256  return STATUS_UNSUCCESSFUL;
257 
258  // get the subdevice descriptor
259  Status = ISubDevice->GetDescriptor(&Descriptor);
260 
261  // store subdevice interface
262  m_SubDevice = ISubDevice;
263 
264  if (!NT_SUCCESS(Status))
265  return STATUS_UNSUCCESSFUL;
266 
267  // save descriptor
269 
270  // store port object
271  m_Port = Port;
272 
273  return STATUS_SUCCESS;
274 }
275 
276 NTSTATUS
278  OUT IPortFilterTopology ** OutFilter)
279 {
281 
283  if (!This)
285 
286  This->AddRef();
287 
288  // return result
289  *OutFilter = (CPortFilterTopology*)This;
290 
291  return STATUS_SUCCESS;
292 }
CPPORT Port[4]
Definition: headless.c:34
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
_In_ BOOLEAN Read
Definition: strmini.h:479
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
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
_In_ BOOLEAN Release
Definition: classpnp.h:929
CPortFilterTopology(IUnknown *OuterUnknown)
_In_ PIRP Irp
Definition: csq.h:116
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:385
static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
Definition: vmhorizon.c:15
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
NTSTATUS NewPortFilterTopology(OUT IPortFilterTopology **OutFilter)
SUBDEVICE_DESCRIPTOR * m_Descriptor
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
#define STDMETHODIMP
Definition: basetyps.h:43
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
void * PVOID
Definition: retypes.h:9
ISubdevice * m_SubDevice
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2650
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1156
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
INT POOL_TYPE
Definition: typedefs.h:76
const GUID IID_IUnknown
STDMETHODIMP_(ULONG) Release()
virtual ~CPortFilterTopology()
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
STDMETHODIMP_(ULONG) AddRef()
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define InterlockedIncrement
Definition: armddk.h:53
Definition: sacdrv.h:267
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define OUT
Definition: typedefs.h:39
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
PKSPROPERTY_SET FilterPropertySet
Definition: interfaces.hpp:210
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
IPortTopology * m_Port
IN BOOLEAN Wait
Definition: fatprocs.h:1529
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966