1c2c66affSColin Finck /*
2c2c66affSColin Finck  * COPYRIGHT:       See COPYING in the top level directory
3c2c66affSColin Finck  * PROJECT:         ReactOS Kernel Streaming
4c2c66affSColin Finck  * FILE:            drivers/wdm/audio/backpln/portcls/port_wavert.cpp
5c2c66affSColin Finck  * PURPOSE:         WaveRT Port Driver
6c2c66affSColin Finck  * PROGRAMMER:      Johannes Anderwald
7c2c66affSColin Finck  */
8c2c66affSColin Finck 
9c2c66affSColin Finck #include "private.hpp"
10c2c66affSColin Finck 
11c2c66affSColin Finck #define NDEBUG
12c2c66affSColin Finck #include <debug.h>
13c2c66affSColin Finck 
14*6e97b431SVictor Perevertkin class CPortWaveRT : public CUnknownImpl<IPortWaveRT, IPortEvents, ISubdevice>
15c2c66affSColin Finck {
16c2c66affSColin Finck public:
17c2c66affSColin Finck     STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
18c2c66affSColin Finck 
19c2c66affSColin Finck     IMP_IPortWaveRT;
20c2c66affSColin Finck     IMP_ISubdevice;
21c2c66affSColin Finck     IMP_IPortEvents;
CPortWaveRT(IUnknown * OuterUnknown)22c2c66affSColin Finck     CPortWaveRT(IUnknown *OuterUnknown) {}
~CPortWaveRT()23c2c66affSColin Finck     virtual ~CPortWaveRT() {}
24c2c66affSColin Finck 
25c2c66affSColin Finck protected:
26c2c66affSColin Finck 
27c2c66affSColin Finck     BOOL m_bInitialized;
28c2c66affSColin Finck     PDEVICE_OBJECT m_pDeviceObject;
29c2c66affSColin Finck     PMINIPORTWAVERT m_pMiniport;
30c2c66affSColin Finck     PRESOURCELIST m_pResourceList;
31c2c66affSColin Finck     PPINCOUNT m_pPinCount;
32c2c66affSColin Finck     PPOWERNOTIFY m_pPowerNotify;
33c2c66affSColin Finck     PPCFILTER_DESCRIPTOR m_pDescriptor;
34c2c66affSColin Finck     PSUBDEVICE_DESCRIPTOR m_SubDeviceDescriptor;
35c2c66affSColin Finck     IPortFilterWaveRT * m_Filter;
36c2c66affSColin Finck 
37c2c66affSColin Finck     friend PMINIPORTWAVERT GetWaveRTMiniport(IN IPortWaveRT* iface);
38c2c66affSColin Finck     friend PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT(PPORTWAVERT iface);
39c2c66affSColin Finck };
40c2c66affSColin Finck 
41c2c66affSColin Finck static GUID InterfaceGuids[3] =
42c2c66affSColin Finck {
43c2c66affSColin Finck     {
44c2c66affSColin Finck         /// KS_CATEGORY_AUDIO
45c2c66affSColin Finck         0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
46c2c66affSColin Finck     },
47c2c66affSColin Finck     {
48c2c66affSColin Finck         /// KSCATEGORY_RENDER
49c2c66affSColin Finck         0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
50c2c66affSColin Finck     },
51c2c66affSColin Finck     {
52c2c66affSColin Finck         /// KSCATEGORY_CAPTURE
53c2c66affSColin Finck         0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
54c2c66affSColin Finck     }
55c2c66affSColin Finck };
56c2c66affSColin Finck 
57c2c66affSColin Finck DEFINE_KSPROPERTY_TOPOLOGYSET(PortFilterWaveRTTopologySet, TopologyPropertyHandler);
58c2c66affSColin Finck DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PortFilterWaveRTPinSet, PinPropertyHandler, PinPropertyHandler, PinPropertyHandler);
59c2c66affSColin Finck 
60c2c66affSColin Finck KSPROPERTY_SET WaveRTPropertySet[] =
61c2c66affSColin Finck {
62c2c66affSColin Finck     {
63c2c66affSColin Finck         &KSPROPSETID_Topology,
64c2c66affSColin Finck         sizeof(PortFilterWaveRTTopologySet) / sizeof(KSPROPERTY_ITEM),
65c2c66affSColin Finck         (const KSPROPERTY_ITEM*)&PortFilterWaveRTTopologySet,
66c2c66affSColin Finck         0,
67c2c66affSColin Finck         NULL
68c2c66affSColin Finck     },
69c2c66affSColin Finck     {
70c2c66affSColin Finck         &KSPROPSETID_Pin,
71c2c66affSColin Finck         sizeof(PortFilterWaveRTPinSet) / sizeof(KSPROPERTY_ITEM),
72c2c66affSColin Finck         (const KSPROPERTY_ITEM*)&PortFilterWaveRTPinSet,
73c2c66affSColin Finck         0,
74c2c66affSColin Finck         NULL
75c2c66affSColin Finck     }
76c2c66affSColin Finck };
77c2c66affSColin Finck 
78c2c66affSColin Finck //KSEVENTSETID_LoopedStreaming, Type = KSEVENT_LOOPEDSTREAMING_POSITION
79c2c66affSColin Finck //KSEVENTSETID_Connection, Type = KSEVENT_CONNECTION_ENDOFSTREAM,
80c2c66affSColin Finck 
81c2c66affSColin Finck //---------------------------------------------------------------
82c2c66affSColin Finck // IPortEvents
83c2c66affSColin Finck //
84c2c66affSColin Finck 
85c2c66affSColin Finck void
86c2c66affSColin Finck NTAPI
AddEventToEventList(IN PKSEVENT_ENTRY EventEntry)87c2c66affSColin Finck CPortWaveRT::AddEventToEventList(
88c2c66affSColin Finck     IN PKSEVENT_ENTRY EventEntry)
89c2c66affSColin Finck {
90c2c66affSColin Finck     UNIMPLEMENTED;
91c2c66affSColin Finck }
92c2c66affSColin Finck 
93c2c66affSColin Finck void
94c2c66affSColin Finck NTAPI
GenerateEventList(IN GUID * Set OPTIONAL,IN ULONG EventId,IN BOOL PinEvent,IN ULONG PinId,IN BOOL NodeEvent,IN ULONG NodeId)95c2c66affSColin Finck CPortWaveRT::GenerateEventList(
96c2c66affSColin Finck     IN  GUID* Set OPTIONAL,
97c2c66affSColin Finck     IN  ULONG EventId,
98c2c66affSColin Finck     IN  BOOL PinEvent,
99c2c66affSColin Finck     IN  ULONG PinId,
100c2c66affSColin Finck     IN  BOOL NodeEvent,
101c2c66affSColin Finck     IN  ULONG NodeId)
102c2c66affSColin Finck {
103c2c66affSColin Finck     UNIMPLEMENTED;
104c2c66affSColin Finck }
105c2c66affSColin Finck 
106c2c66affSColin Finck //---------------------------------------------------------------
107c2c66affSColin Finck // IUnknown interface functions
108c2c66affSColin Finck //
109c2c66affSColin Finck 
110c2c66affSColin Finck NTSTATUS
111c2c66affSColin Finck NTAPI
QueryInterface(IN REFIID refiid,OUT PVOID * Output)112c2c66affSColin Finck CPortWaveRT::QueryInterface(
113c2c66affSColin Finck     IN  REFIID refiid,
114c2c66affSColin Finck     OUT PVOID* Output)
115c2c66affSColin Finck {
116c2c66affSColin Finck     UNICODE_STRING GuidString;
117c2c66affSColin Finck 
118c2c66affSColin Finck     if (IsEqualGUIDAligned(refiid, IID_IPortWaveRT) ||
119c2c66affSColin Finck         IsEqualGUIDAligned(refiid, IID_IUnknown))
120c2c66affSColin Finck     {
121c2c66affSColin Finck         *Output = PVOID(PPORTWAVERT(this));
122c2c66affSColin Finck         PUNKNOWN(*Output)->AddRef();
123c2c66affSColin Finck         return STATUS_SUCCESS;
124c2c66affSColin Finck     }
125c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_IPortEvents))
126c2c66affSColin Finck     {
127c2c66affSColin Finck         *Output = PVOID(PPORTEVENTS(this));
128c2c66affSColin Finck         PUNKNOWN(*Output)->AddRef();
129c2c66affSColin Finck         return STATUS_SUCCESS;
130c2c66affSColin Finck     }
131c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_ISubdevice))
132c2c66affSColin Finck     {
133c2c66affSColin Finck         *Output = PVOID(PSUBDEVICE(this));
134c2c66affSColin Finck         PUNKNOWN(*Output)->AddRef();
135c2c66affSColin Finck         return STATUS_SUCCESS;
136c2c66affSColin Finck     }
137c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_IPortClsVersion))
138c2c66affSColin Finck     {
139c2c66affSColin Finck         return NewPortClsVersion((PPORTCLSVERSION*)Output);
140c2c66affSColin Finck     }
141c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_IDrmPort) ||
142c2c66affSColin Finck              IsEqualGUIDAligned(refiid, IID_IDrmPort2))
143c2c66affSColin Finck     {
144c2c66affSColin Finck         return NewIDrmPort((PDRMPORT2*)Output);
145c2c66affSColin Finck     }
146c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_IUnregisterSubdevice))
147c2c66affSColin Finck     {
148c2c66affSColin Finck         return NewIUnregisterSubdevice((PUNREGISTERSUBDEVICE*)Output);
149c2c66affSColin Finck     }
150c2c66affSColin Finck     else if (IsEqualGUIDAligned(refiid, IID_IUnregisterPhysicalConnection))
151c2c66affSColin Finck     {
152c2c66affSColin Finck         return NewIUnregisterPhysicalConnection((PUNREGISTERPHYSICALCONNECTION*)Output);
153c2c66affSColin Finck     }
154c2c66affSColin Finck 
155c2c66affSColin Finck     if (RtlStringFromGUID(refiid, &GuidString) == STATUS_SUCCESS)
156c2c66affSColin Finck     {
157c2c66affSColin Finck         DPRINT("IPortWaveRT_fnQueryInterface no interface!!! iface %S\n", GuidString.Buffer);
158c2c66affSColin Finck         RtlFreeUnicodeString(&GuidString);
159c2c66affSColin Finck     }
160c2c66affSColin Finck 
161c2c66affSColin Finck     return STATUS_UNSUCCESSFUL;
162c2c66affSColin Finck }
163c2c66affSColin Finck //---------------------------------------------------------------
164c2c66affSColin Finck // IPort interface functions
165c2c66affSColin Finck //
166c2c66affSColin Finck 
167c2c66affSColin Finck NTSTATUS
168c2c66affSColin Finck NTAPI
GetDeviceProperty(IN DEVICE_REGISTRY_PROPERTY DeviceRegistryProperty,IN ULONG BufferLength,OUT PVOID PropertyBuffer,OUT PULONG ReturnLength)169c2c66affSColin Finck CPortWaveRT::GetDeviceProperty(
170c2c66affSColin Finck     IN DEVICE_REGISTRY_PROPERTY  DeviceRegistryProperty,
171c2c66affSColin Finck     IN ULONG  BufferLength,
172c2c66affSColin Finck     OUT PVOID  PropertyBuffer,
173c2c66affSColin Finck     OUT PULONG  ReturnLength)
174c2c66affSColin Finck {
175c2c66affSColin Finck     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
176c2c66affSColin Finck 
177c2c66affSColin Finck     if (!m_bInitialized)
178c2c66affSColin Finck     {
179c2c66affSColin Finck         DPRINT("IPortWaveRT_fnNewRegistryKey called w/o initialized\n");
180c2c66affSColin Finck         return STATUS_UNSUCCESSFUL;
181c2c66affSColin Finck     }
182c2c66affSColin Finck 
183c2c66affSColin Finck     return IoGetDeviceProperty(m_pDeviceObject, DeviceRegistryProperty, BufferLength, PropertyBuffer, ReturnLength);
184c2c66affSColin Finck }
185c2c66affSColin Finck 
186c2c66affSColin Finck NTSTATUS
187c2c66affSColin Finck NTAPI
Init(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp,IN PUNKNOWN UnknownMiniport,IN PUNKNOWN UnknownAdapter OPTIONAL,IN PRESOURCELIST ResourceList)188c2c66affSColin Finck CPortWaveRT::Init(
189c2c66affSColin Finck     IN PDEVICE_OBJECT  DeviceObject,
190c2c66affSColin Finck     IN PIRP  Irp,
191c2c66affSColin Finck     IN PUNKNOWN  UnknownMiniport,
192c2c66affSColin Finck     IN PUNKNOWN  UnknownAdapter  OPTIONAL,
193c2c66affSColin Finck     IN PRESOURCELIST  ResourceList)
194c2c66affSColin Finck {
195c2c66affSColin Finck     IMiniportWaveRT * Miniport;
196c2c66affSColin Finck     NTSTATUS Status;
197c2c66affSColin Finck     PPINCOUNT PinCount;
198c2c66affSColin Finck     PPOWERNOTIFY PowerNotify;
199c2c66affSColin Finck 
200c2c66affSColin Finck     DPRINT("IPortWaveRT_Init entered %p\n", this);
201c2c66affSColin Finck     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
202c2c66affSColin Finck 
203c2c66affSColin Finck     if (m_bInitialized)
204c2c66affSColin Finck     {
205c2c66affSColin Finck         DPRINT("IPortWaveRT_Init called again\n");
206c2c66affSColin Finck         return STATUS_SUCCESS;
207c2c66affSColin Finck     }
208c2c66affSColin Finck 
209c2c66affSColin Finck     Status = UnknownMiniport->QueryInterface(IID_IMiniportWaveRT, (PVOID*)&Miniport);
210c2c66affSColin Finck     if (!NT_SUCCESS(Status))
211c2c66affSColin Finck     {
212c2c66affSColin Finck         DPRINT("IPortWaveRT_Init called with invalid IMiniport adapter\n");
213c2c66affSColin Finck         return STATUS_INVALID_PARAMETER;
214c2c66affSColin Finck     }
215c2c66affSColin Finck 
216c2c66affSColin Finck     // Initialize port object
217c2c66affSColin Finck     m_pMiniport = Miniport;
218c2c66affSColin Finck     m_pDeviceObject = DeviceObject;
219c2c66affSColin Finck     m_bInitialized = TRUE;
220c2c66affSColin Finck     m_pResourceList = ResourceList;
221c2c66affSColin Finck 
222c2c66affSColin Finck     // increment reference on miniport adapter
223c2c66affSColin Finck     Miniport->AddRef();
224c2c66affSColin Finck 
225c2c66affSColin Finck     Status = Miniport->Init(UnknownAdapter, ResourceList, this);
226c2c66affSColin Finck     if (!NT_SUCCESS(Status))
227c2c66affSColin Finck     {
228c2c66affSColin Finck         DPRINT("IMiniportWaveRT_Init failed with %x\n", Status);
229c2c66affSColin Finck         Miniport->Release();
230c2c66affSColin Finck         m_bInitialized = FALSE;
231c2c66affSColin Finck         return Status;
232c2c66affSColin Finck     }
233c2c66affSColin Finck 
234c2c66affSColin Finck     // get the miniport device descriptor
235c2c66affSColin Finck     Status = Miniport->GetDescription(&m_pDescriptor);
236c2c66affSColin Finck     if (!NT_SUCCESS(Status))
237c2c66affSColin Finck     {
238c2c66affSColin Finck         DPRINT("failed to get description\n");
239c2c66affSColin Finck         Miniport->Release();
240c2c66affSColin Finck         m_bInitialized = FALSE;
241c2c66affSColin Finck         return Status;
242c2c66affSColin Finck     }
243c2c66affSColin Finck 
244c2c66affSColin Finck     // create the subdevice descriptor
245c2c66affSColin Finck     Status = PcCreateSubdeviceDescriptor(&m_SubDeviceDescriptor,
246c2c66affSColin Finck                                          3,
247c2c66affSColin Finck                                          InterfaceGuids,
248c2c66affSColin Finck                                          0,
249c2c66affSColin Finck                                          NULL,
250c2c66affSColin Finck                                          2,
251c2c66affSColin Finck                                          WaveRTPropertySet,
252c2c66affSColin Finck                                          0,
253c2c66affSColin Finck                                          0,
254c2c66affSColin Finck                                          0,
255c2c66affSColin Finck                                          NULL,
256c2c66affSColin Finck                                          0,
257c2c66affSColin Finck                                          NULL,
258c2c66affSColin Finck                                          m_pDescriptor);
259c2c66affSColin Finck 
260c2c66affSColin Finck     if (!NT_SUCCESS(Status))
261c2c66affSColin Finck     {
262c2c66affSColin Finck         DPRINT("PcCreateSubdeviceDescriptor failed with %x\n", Status);
263c2c66affSColin Finck         Miniport->Release();
264c2c66affSColin Finck         m_bInitialized = FALSE;
265c2c66affSColin Finck         return Status;
266c2c66affSColin Finck     }
267c2c66affSColin Finck 
268c2c66affSColin Finck     // check if it supports IPinCount interface
269c2c66affSColin Finck     Status = UnknownMiniport->QueryInterface(IID_IPinCount, (PVOID*)&PinCount);
270c2c66affSColin Finck     if (NT_SUCCESS(Status))
271c2c66affSColin Finck     {
272c2c66affSColin Finck         // store IPinCount interface
273c2c66affSColin Finck         m_pPinCount = PinCount;
274c2c66affSColin Finck     }
275c2c66affSColin Finck 
276c2c66affSColin Finck     // does the Miniport adapter support IPowerNotify interface*/
277c2c66affSColin Finck     Status = UnknownMiniport->QueryInterface(IID_IPowerNotify, (PVOID*)&PowerNotify);
278c2c66affSColin Finck     if (NT_SUCCESS(Status))
279c2c66affSColin Finck     {
280c2c66affSColin Finck         // store reference
281c2c66affSColin Finck         m_pPowerNotify = PowerNotify;
282c2c66affSColin Finck     }
283c2c66affSColin Finck 
284c2c66affSColin Finck     // increment reference on resource list
285c2c66affSColin Finck     ResourceList->AddRef();
286c2c66affSColin Finck 
287c2c66affSColin Finck     DPRINT("IPortWaveRT successfully initialized\n");
288c2c66affSColin Finck     return STATUS_SUCCESS;
289c2c66affSColin Finck }
290c2c66affSColin Finck 
291c2c66affSColin Finck NTSTATUS
292c2c66affSColin Finck NTAPI
NewRegistryKey(OUT PREGISTRYKEY * OutRegistryKey,IN PUNKNOWN OuterUnknown OPTIONAL,IN ULONG RegistryKeyType,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,IN ULONG CreateOptions OPTIONAL,OUT PULONG Disposition OPTIONAL)293c2c66affSColin Finck CPortWaveRT::NewRegistryKey(
294c2c66affSColin Finck     OUT PREGISTRYKEY  *OutRegistryKey,
295c2c66affSColin Finck     IN PUNKNOWN  OuterUnknown  OPTIONAL,
296c2c66affSColin Finck     IN ULONG  RegistryKeyType,
297c2c66affSColin Finck     IN ACCESS_MASK  DesiredAccess,
298c2c66affSColin Finck     IN POBJECT_ATTRIBUTES  ObjectAttributes  OPTIONAL,
299c2c66affSColin Finck     IN ULONG  CreateOptions  OPTIONAL,
300c2c66affSColin Finck     OUT PULONG  Disposition  OPTIONAL)
301c2c66affSColin Finck {
302c2c66affSColin Finck     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
303c2c66affSColin Finck 
304c2c66affSColin Finck     if (!m_bInitialized)
305c2c66affSColin Finck     {
306c2c66affSColin Finck         DPRINT("IPortWaveRT_fnNewRegistryKey called w/o initialized\n");
307c2c66affSColin Finck         return STATUS_UNSUCCESSFUL;
308c2c66affSColin Finck     }
309c2c66affSColin Finck     return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, m_pDeviceObject, (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition);
310c2c66affSColin Finck }
311c2c66affSColin Finck //---------------------------------------------------------------
312c2c66affSColin Finck // ISubdevice interface
313c2c66affSColin Finck //
314c2c66affSColin Finck 
315c2c66affSColin Finck NTSTATUS
316c2c66affSColin Finck NTAPI
NewIrpTarget(OUT struct IIrpTarget ** OutTarget,IN PCWSTR Name,IN PUNKNOWN Unknown,IN POOL_TYPE PoolType,IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp,IN KSOBJECT_CREATE * CreateObject)317c2c66affSColin Finck CPortWaveRT::NewIrpTarget(
318c2c66affSColin Finck     OUT struct IIrpTarget **OutTarget,
319c2c66affSColin Finck     IN PCWSTR Name,
320c2c66affSColin Finck     IN PUNKNOWN Unknown,
321c2c66affSColin Finck     IN POOL_TYPE PoolType,
322c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
323c2c66affSColin Finck     IN PIRP Irp,
324c2c66affSColin Finck     IN KSOBJECT_CREATE *CreateObject)
325c2c66affSColin Finck {
326c2c66affSColin Finck     NTSTATUS Status;
327c2c66affSColin Finck     IPortFilterWaveRT * Filter;
328c2c66affSColin Finck 
329c2c66affSColin Finck     DPRINT("ISubDevice_NewIrpTarget this %p\n", this);
330c2c66affSColin Finck 
331c2c66affSColin Finck     if (m_Filter)
332c2c66affSColin Finck     {
333c2c66affSColin Finck         *OutTarget = (IIrpTarget*)m_Filter;
334c2c66affSColin Finck         return STATUS_SUCCESS;
335c2c66affSColin Finck     }
336c2c66affSColin Finck 
337c2c66affSColin Finck     Status = NewPortFilterWaveRT(&Filter);
338c2c66affSColin Finck     if (!NT_SUCCESS(Status))
339c2c66affSColin Finck     {
340c2c66affSColin Finck         return Status;
341c2c66affSColin Finck     }
342c2c66affSColin Finck 
343c2c66affSColin Finck     Status = Filter->Init(this);
344c2c66affSColin Finck     if (!NT_SUCCESS(Status))
345c2c66affSColin Finck     {
346c2c66affSColin Finck         Filter->Release();
347c2c66affSColin Finck         return Status;
348c2c66affSColin Finck     }
349c2c66affSColin Finck 
350c2c66affSColin Finck     *OutTarget = (IIrpTarget*)Filter;
351c2c66affSColin Finck     m_Filter = Filter;
352c2c66affSColin Finck     return Status;
353c2c66affSColin Finck }
354c2c66affSColin Finck 
355c2c66affSColin Finck NTSTATUS
356c2c66affSColin Finck NTAPI
ReleaseChildren()357c2c66affSColin Finck CPortWaveRT::ReleaseChildren()
358c2c66affSColin Finck {
359c2c66affSColin Finck     UNIMPLEMENTED;
360c2c66affSColin Finck     return STATUS_UNSUCCESSFUL;
361c2c66affSColin Finck }
362c2c66affSColin Finck 
363c2c66affSColin Finck NTSTATUS
364c2c66affSColin Finck NTAPI
GetDescriptor(IN SUBDEVICE_DESCRIPTOR ** Descriptor)365c2c66affSColin Finck CPortWaveRT::GetDescriptor(
366c2c66affSColin Finck     IN SUBDEVICE_DESCRIPTOR ** Descriptor)
367c2c66affSColin Finck {
368c2c66affSColin Finck     PC_ASSERT(m_SubDeviceDescriptor != NULL);
369c2c66affSColin Finck 
370c2c66affSColin Finck     *Descriptor = m_SubDeviceDescriptor;
371c2c66affSColin Finck 
372c2c66affSColin Finck     DPRINT("ISubDevice_GetDescriptor this %p desc %p\n", this, m_SubDeviceDescriptor);
373c2c66affSColin Finck     return STATUS_SUCCESS;
374c2c66affSColin Finck }
375c2c66affSColin Finck 
376c2c66affSColin Finck NTSTATUS
377c2c66affSColin Finck NTAPI
DataRangeIntersection(IN ULONG PinId,IN PKSDATARANGE DataRange,IN PKSDATARANGE MatchingDataRange,IN ULONG OutputBufferLength,OUT PVOID ResultantFormat OPTIONAL,OUT PULONG ResultantFormatLength)378c2c66affSColin Finck CPortWaveRT::DataRangeIntersection(
379c2c66affSColin Finck     IN  ULONG PinId,
380c2c66affSColin Finck     IN  PKSDATARANGE DataRange,
381c2c66affSColin Finck     IN  PKSDATARANGE MatchingDataRange,
382c2c66affSColin Finck     IN  ULONG OutputBufferLength,
383c2c66affSColin Finck     OUT PVOID ResultantFormat OPTIONAL,
384c2c66affSColin Finck     OUT PULONG ResultantFormatLength)
385c2c66affSColin Finck {
386c2c66affSColin Finck     DPRINT("ISubDevice_DataRangeIntersection this %p\n", this);
387c2c66affSColin Finck 
388c2c66affSColin Finck     if (m_pMiniport)
389c2c66affSColin Finck     {
390c2c66affSColin Finck         return m_pMiniport->DataRangeIntersection (PinId, DataRange, MatchingDataRange, OutputBufferLength, ResultantFormat, ResultantFormatLength);
391c2c66affSColin Finck     }
392c2c66affSColin Finck 
393c2c66affSColin Finck     return STATUS_UNSUCCESSFUL;
394c2c66affSColin Finck }
395c2c66affSColin Finck 
396c2c66affSColin Finck NTSTATUS
397c2c66affSColin Finck NTAPI
PowerChangeNotify(IN POWER_STATE PowerState)398c2c66affSColin Finck CPortWaveRT::PowerChangeNotify(
399c2c66affSColin Finck     IN POWER_STATE PowerState)
400c2c66affSColin Finck {
401c2c66affSColin Finck     if (m_pPowerNotify)
402c2c66affSColin Finck     {
403c2c66affSColin Finck         m_pPowerNotify->PowerChangeNotify(PowerState);
404c2c66affSColin Finck     }
405c2c66affSColin Finck 
406c2c66affSColin Finck     return STATUS_SUCCESS;
407c2c66affSColin Finck }
408c2c66affSColin Finck 
409c2c66affSColin Finck NTSTATUS
410c2c66affSColin Finck NTAPI
PinCount(IN ULONG PinId,IN OUT PULONG FilterNecessary,IN OUT PULONG FilterCurrent,IN OUT PULONG FilterPossible,IN OUT PULONG GlobalCurrent,IN OUT PULONG GlobalPossible)411c2c66affSColin Finck CPortWaveRT::PinCount(
412c2c66affSColin Finck     IN ULONG  PinId,
413c2c66affSColin Finck     IN OUT PULONG  FilterNecessary,
414c2c66affSColin Finck     IN OUT PULONG  FilterCurrent,
415c2c66affSColin Finck     IN OUT PULONG  FilterPossible,
416c2c66affSColin Finck     IN OUT PULONG  GlobalCurrent,
417c2c66affSColin Finck     IN OUT PULONG  GlobalPossible)
418c2c66affSColin Finck {
419c2c66affSColin Finck     if (m_pPinCount)
420c2c66affSColin Finck     {
421c2c66affSColin Finck        m_pPinCount->PinCount(PinId, FilterNecessary, FilterCurrent, FilterPossible, GlobalCurrent, GlobalPossible);
422c2c66affSColin Finck        return STATUS_SUCCESS;
423c2c66affSColin Finck     }
424c2c66affSColin Finck 
425c2c66affSColin Finck     // FIXME
426c2c66affSColin Finck     // scan filter descriptor
427c2c66affSColin Finck 
428c2c66affSColin Finck     return STATUS_UNSUCCESSFUL;
429c2c66affSColin Finck }
430c2c66affSColin Finck 
431c2c66affSColin Finck ///--------------------------------------------------------------
432c2c66affSColin Finck PMINIPORTWAVERT
GetWaveRTMiniport(IN IPortWaveRT * iface)433c2c66affSColin Finck GetWaveRTMiniport(
434c2c66affSColin Finck     IN IPortWaveRT* iface)
435c2c66affSColin Finck {
436c2c66affSColin Finck     CPortWaveRT * This = (CPortWaveRT *)iface;
437c2c66affSColin Finck     return This->m_pMiniport;
438c2c66affSColin Finck }
439c2c66affSColin Finck 
440c2c66affSColin Finck PDEVICE_OBJECT
GetDeviceObjectFromPortWaveRT(PPORTWAVERT iface)441c2c66affSColin Finck GetDeviceObjectFromPortWaveRT(
442c2c66affSColin Finck     PPORTWAVERT iface)
443c2c66affSColin Finck {
444c2c66affSColin Finck     CPortWaveRT * This = (CPortWaveRT *)iface;
445c2c66affSColin Finck     return This->m_pDeviceObject;
446c2c66affSColin Finck }
447c2c66affSColin Finck 
448c2c66affSColin Finck //---------------------------------------------------------------
449c2c66affSColin Finck // IPortWaveRT constructor
450c2c66affSColin Finck //
451c2c66affSColin Finck 
452c2c66affSColin Finck NTSTATUS
NewPortWaveRT(OUT PPORT * OutPort)453c2c66affSColin Finck NewPortWaveRT(
454c2c66affSColin Finck     OUT PPORT* OutPort)
455c2c66affSColin Finck {
456c2c66affSColin Finck     CPortWaveRT * Port;
457c2c66affSColin Finck     NTSTATUS Status;
458c2c66affSColin Finck 
459c2c66affSColin Finck     Port = new(NonPagedPool, TAG_PORTCLASS) CPortWaveRT(NULL);
460c2c66affSColin Finck     if (!Port)
461c2c66affSColin Finck         return STATUS_INSUFFICIENT_RESOURCES;
462c2c66affSColin Finck 
463c2c66affSColin Finck     Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
464c2c66affSColin Finck 
465c2c66affSColin Finck     if (!NT_SUCCESS(Status))
466c2c66affSColin Finck     {
467c2c66affSColin Finck         delete Port;
468c2c66affSColin Finck     }
469c2c66affSColin Finck 
470c2c66affSColin Finck     DPRINT("NewPortWaveRT %p Status %u\n", Port, Status);
471c2c66affSColin Finck     return Status;
472c2c66affSColin Finck }
473