Author: janderwald
Date: Sun Jan 18 14:56:01 2009
New Revision: 38913
URL:
http://svn.reactos.org/svn/reactos?rev=38913&view=rev
Log:
- Fix IPortWaveCyclic interface
- Implement IPortEvents interface
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Sun Jan
18 14:56:01 2009
@@ -6,6 +6,7 @@
IPortEventsVtbl *lpVbtlPortEvents;
IUnregisterSubdeviceVtbl *lpVtblUnregisterSubdevice;
IUnregisterPhysicalConnectionVtbl *lpVtblPhysicalConnection;
+ IPortEventsVtbl *lpVtblPortEvents;
ISubdeviceVtbl *lpVtblSubDevice;
LONG ref;
@@ -22,6 +23,98 @@
const GUID GUID_DEVCLASS_SOUND; //FIXME
+
+//---------------------------------------------------------------
+// IPortEvents
+//
+
+static
+NTSTATUS
+NTAPI
+IPortEvents_fnQueryInterface(
+ IPortEvents* iface,
+ IN REFIID refiid,
+ OUT PVOID* Output)
+{
+ IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortWaveCyclicImpl, lpVtblPortEvents);
+
+ DPRINT1("IPortEvents_fnQueryInterface entered\n");
+
+ if (IsEqualGUIDAligned(refiid, &IID_IPortEvents) ||
+ IsEqualGUIDAligned(refiid, &IID_IUnknown))
+ {
+ *Output = &This->lpVbtlPortEvents;
+ InterlockedIncrement(&This->ref);
+ return STATUS_SUCCESS;
+ }
+ return STATUS_UNSUCCESSFUL;
+}
+
+static
+ULONG
+NTAPI
+IPortEvents_fnAddRef(
+ IPortEvents* iface)
+{
+ IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortWaveCyclicImpl, lpVtblPortEvents);
+ DPRINT1("IPortEvents_fnQueryInterface entered\n");
+ return InterlockedIncrement(&This->ref);
+}
+
+static
+ULONG
+NTAPI
+IPortEvents_fnRelease(
+ IPortEvents* iface)
+{
+ IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortWaveCyclicImpl, lpVtblPortEvents);
+ DPRINT1("IPortEvents_fnQueryInterface entered\n");
+ InterlockedDecrement(&This->ref);
+
+ if (This->ref == 0)
+ {
+ FreeItem(This, TAG_PORTCLASS);
+ return 0;
+ }
+ /* Return new reference count */
+ return This->ref;
+}
+
+static
+void
+NTAPI
+IPortEvents_fnAddEventToEventList(
+ IPortEvents* iface,
+ IN PKSEVENT_ENTRY EventEntry)
+{
+ DPRINT1("IPortEvents_fnAddEventToEventList stub\n");
+}
+
+
+static
+void
+NTAPI
+IPortEvents_fnGenerateEventList(
+ IPortEvents* iface,
+ IN GUID* Set OPTIONAL,
+ IN ULONG EventId,
+ IN BOOL PinEvent,
+ IN ULONG PinId,
+ IN BOOL NodeEvent,
+ IN ULONG NodeId)
+{
+ DPRINT1("IPortEvents_fnGenerateEventList stub\n");
+}
+
+static IPortEventsVtbl vt_IPortEvents =
+{
+ IPortEvents_fnQueryInterface,
+ IPortEvents_fnAddRef,
+ IPortEvents_fnRelease,
+ IPortEvents_fnAddEventToEventList,
+ IPortEvents_fnGenerateEventList
+};
+
//---------------------------------------------------------------
// IUnknown interface functions
//
@@ -33,6 +126,7 @@
IN REFIID refiid,
OUT PVOID* Output)
{
+ WCHAR Buffer[100];
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
if (IsEqualGUIDAligned(refiid, &IID_IPortWaveCyclic) ||
IsEqualGUIDAligned(refiid, &IID_IUnknown))
@@ -41,6 +135,12 @@
InterlockedIncrement(&This->ref);
return STATUS_SUCCESS;
}
+ else if (IsEqualGUIDAligned(refiid, &IID_IPortEvents))
+ {
+ *Output = &This->lpVtblPortEvents;
+ InterlockedIncrement(&This->ref);
+ return STATUS_SUCCESS;
+ }
else if (IsEqualGUIDAligned(refiid, &IID_ISubdevice))
{
*Output = &This->lpVtblSubDevice;
@@ -56,6 +156,10 @@
{
return NewIDrmPort((PDRMPORT2*)Output);
}
+
+ StringFromCLSID(refiid, Buffer);
+ DPRINT1("IPortWaveCyclic_fnQueryInterface no interface!!! iface %S\n",
Buffer);
+ KeBugCheckEx(0, 0, 0, 0, 0);
return STATUS_UNSUCCESSFUL;
}
@@ -176,11 +280,12 @@
Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPinCount, (PVOID*)&PinCount);
if (NT_SUCCESS(Status))
{
+ /* store IPinCount interface */
This->pPinCount = PinCount;
- This->pDescriptor = NULL;
}
else
{
+ /* check if the miniport adapter provides a valid device descriptor */
Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
if (!NT_SUCCESS(Status))
{
@@ -188,17 +293,14 @@
Miniport->lpVtbl->Release(Miniport);
return Status;
}
- This->pPinCount = NULL;
- }
-
+ }
+
+ /* does the Miniport adapter support IPowerNotify interface*/
Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPowerNotify, (PVOID*)&PowerNotify);
if (NT_SUCCESS(Status))
{
+ /* store reference */
This->pPowerNotify = PowerNotify;
- }
- else
- {
- This->pPowerNotify = NULL;
}
/* increment reference on resource list */
@@ -329,8 +431,8 @@
IPortWaveCyclic_fnGetDeviceProperty,
IPortWaveCyclic_fnNewRegistryKey,
IPortWaveCyclic_fnNotify,
- IPortWaveCyclic_fnNewMasterDmaChannel,
IPortWaveCyclic_fnNewSlaveDmaChannel,
+ IPortWaveCyclic_fnNewMasterDmaChannel
};
//---------------------------------------------------------------
@@ -514,6 +616,7 @@
This->lpVtbl = &vt_IPortWaveCyclicVtbl;
This->lpVtblSubDevice = &vt_ISubdeviceVtbl;
+ This->lpVtblPortEvents = &vt_IPortEvents;
This->ref = 1;
*OutPort = (PPORT)(&This->lpVtbl);