ReactOS  0.4.15-dev-4603-gb922b6d
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 CUnknownImpl<IPortFilterTopology>
18 {
19 public:
21 
23  CPortFilterTopology(IUnknown *OuterUnknown){}
25 
26 protected:
27  IPortTopology * m_Port;
29  ISubdevice * m_SubDevice;
30 };
31 
32 
34 NTAPI
36  IN REFIID refiid,
37  OUT PVOID* Output)
38 {
39 
40  if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
42  {
43  *Output = PVOID(PUNKNOWN(this));
44  PUNKNOWN(*Output)->AddRef();
45  return STATUS_SUCCESS;
46  }
47  else if (IsEqualGUIDAligned(refiid, IID_IPort))
48  {
50  PUNKNOWN(*Output)->AddRef();
51  return STATUS_SUCCESS;
52  }
53 
54  return STATUS_UNSUCCESSFUL;
55 }
56 
58 NTAPI
59 CPortFilterTopology::NewIrpTarget(
60  OUT struct IIrpTarget **OutTarget,
61  IN PCWSTR Name,
65  IN PIRP Irp,
66  IN KSOBJECT_CREATE *CreateObject)
67 {
68  DPRINT("CPortFilterTopology::NewIrpTarget entered\n");
69 
70  return STATUS_NOT_SUPPORTED;
71 }
72 
73 
75 NTAPI
78  IN PIRP Irp)
79 {
80  PIO_STACK_LOCATION IoStack;
82 
84 
85  if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
86  {
87  DPRINT("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength);
88 
89  Irp->IoStatus.Status = STATUS_SUCCESS;
90 
92  return STATUS_SUCCESS;
93  }
94 
96  if (Status != STATUS_PENDING)
97  {
98  Irp->IoStatus.Status = Status;
99  DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information);
101  }
102  return Status;
103 
104 }
105 
106 NTSTATUS
107 NTAPI
110  IN PIRP Irp)
111 {
113 }
114 
115 NTSTATUS
116 NTAPI
119  IN PIRP Irp)
120 {
122 }
123 
124 NTSTATUS
125 NTAPI
128  IN PIRP Irp)
129 {
131 }
132 
133 NTSTATUS
134 NTAPI
137  IN PIRP Irp)
138 {
140 
141  // FIXME handle DirectSound
142 
143 #if 0
144 //FIXME
145  if (m_ref == 1)
146  {
147  // release reference to port
148  This->SubDevice->lpVtbl->Release(This->SubDevice);
149 
150  // time to shutdown the audio system
151  Status = This->SubDevice->lpVtbl->ReleaseChildren(This->SubDevice);
152  }
153 #endif
154 
155  Irp->IoStatus.Status = Status;
156  Irp->IoStatus.Information = 0;
158 
159  return STATUS_SUCCESS;
160 }
161 
162 NTSTATUS
163 NTAPI
164 CPortFilterTopology::QuerySecurity(
166  IN PIRP Irp)
167 {
169 }
170 
171 NTSTATUS
172 NTAPI
173 CPortFilterTopology::SetSecurity(
175  IN PIRP Irp)
176 {
178 }
179 
180 BOOLEAN
181 NTAPI
182 CPortFilterTopology::FastDeviceIoControl(
184  IN BOOLEAN Wait,
190  OUT PIO_STATUS_BLOCK StatusBlock,
192 {
193  return FALSE;
194 }
195 
196 BOOLEAN
197 NTAPI
198 CPortFilterTopology::FastRead(
201  IN ULONG Length,
202  IN BOOLEAN Wait,
203  IN ULONG LockKey,
204  IN PVOID Buffer,
205  OUT PIO_STATUS_BLOCK StatusBlock,
207 {
208  return FALSE;
209 }
210 
211 BOOLEAN
212 NTAPI
213 CPortFilterTopology::FastWrite(
216  IN ULONG Length,
217  IN BOOLEAN Wait,
218  IN ULONG LockKey,
219  IN PVOID Buffer,
220  OUT PIO_STATUS_BLOCK StatusBlock,
222 {
223  return FALSE;
224 }
225 
226 NTSTATUS
227 NTAPI
229  IN IPortTopology* Port)
230 {
231  ISubdevice * ISubDevice;
234 
235 
236  // get our private interface
237  Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&ISubDevice);
238  if (!NT_SUCCESS(Status))
239  return STATUS_UNSUCCESSFUL;
240 
241  // get the subdevice descriptor
242  Status = ISubDevice->GetDescriptor(&Descriptor);
243 
244  // store subdevice interface
245  m_SubDevice = ISubDevice;
246 
247  if (!NT_SUCCESS(Status))
248  return STATUS_UNSUCCESSFUL;
249 
250  // save descriptor
252 
253  // store port object
254  m_Port = Port;
255 
256  return STATUS_SUCCESS;
257 }
258 
259 NTSTATUS
261  OUT IPortFilterTopology ** OutFilter)
262 {
264 
266  if (!This)
268 
269  This->AddRef();
270 
271  // return result
272  *OutFilter = (CPortFilterTopology*)This;
273 
274  return STATUS_SUCCESS;
275 }
CPPORT Port[4]
Definition: headless.c:35
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
return STATUS_NOT_SUPPORTED
_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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
CPortFilterTopology(IUnknown *OuterUnknown)
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define TAG_PORTCLASS
Definition: private.hpp:24
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:318
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:385
static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
Definition: vmhorizon.c:15
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:318
NTSTATUS NewPortFilterTopology(OUT IPortFilterTopology **OutFilter)
SUBDEVICE_DESCRIPTOR * m_Descriptor
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
#define STDMETHODIMP
Definition: basetyps.h:43
unsigned char BOOLEAN
#define IoCompleteRequest
Definition: irp.c:1240
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
ISubdevice * m_SubDevice
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
Status
Definition: gdiplustypes.h:24
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1168
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
INT POOL_TYPE
Definition: typedefs.h:78
const GUID IID_IUnknown
virtual ~CPortFilterTopology()
* PFILE_OBJECT
Definition: iotypes.h:1998
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: arc.h:85
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:318
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
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
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
Definition: sacdrv.h:268
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
PKSPROPERTY_SET FilterPropertySet
Definition: interfaces.hpp:210
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
IPortTopology * m_Port