Author: janderwald
Date: Mon Aug 24 00:50:09 2009
New Revision: 42892
URL:
http://svn.reactos.org/svn/reactos?rev=42892&view=rev
Log:
[KS]
- Fix a few bugs in KsPinPropertyHandler & KsTopologyPropertyHandler
[PORTCLS]
- Implement retrieving KSPROPSETID's
- Register KSCATEGORY_AUDIO_DEVICE as a temporary hack untill sysaudio is able to register
device interfaces (bug 4556)
Ks Studio is now able to instantiate audio filters on ReactOS
Modified:
trunk/reactos/drivers/ksfilter/ks/connectivity.c
trunk/reactos/drivers/ksfilter/ks/topology.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c
Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connec…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] Mon Aug 24 00:50:09
2009
@@ -194,6 +194,8 @@
PVOID Buffer;
PKSDATARANGE_AUDIO *WaveFormatOut;
PKSDATAFORMAT_WAVEFORMATEX WaveFormatIn;
+ PULONG GuidBuffer;
+ static WCHAR Speaker[] = {L"PC-Speaker"};
IoStack = IoGetCurrentIrpStackLocation(Irp);
Buffer = Irp->UserBuffer;
@@ -243,7 +245,7 @@
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
break;
}
@@ -270,19 +272,30 @@
break;
}
- Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSPIN_INTERFACE) *
Descriptor[Pin->PinId].InterfacesCount;
-
- if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
- {
- Irp->IoStatus.Information = Size;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ /* calculate size */
+ Size = sizeof(KSMULTIPLE_ITEM);
+ Size += max(1, Descriptor[Pin->PinId].InterfacesCount) *
sizeof(KSPIN_INTERFACE);
+
+ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
+ {
+ Irp->IoStatus.Information = Size;
+ Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
break;
}
Item = (KSMULTIPLE_ITEM*)Buffer;
Item->Size = Size;
- Item->Count = Descriptor[Pin->PinId].InterfacesCount;
- RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].Interfaces,
Descriptor[Pin->PinId].InterfacesCount * sizeof(KSDATARANGE));
+
+ if (Descriptor[Pin->PinId].InterfacesCount)
+ {
+ Item->Count = Descriptor[Pin->PinId].InterfacesCount;
+ RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].Interfaces,
Descriptor[Pin->PinId].InterfacesCount * sizeof(KSPIN_INTERFACE));
+ }
+ else
+ {
+ Item->Count = 1;
+ RtlMoveMemory((PVOID)(Item + 1), &StandardPinInterface,
sizeof(KSPIN_INTERFACE));
+ }
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = Size;
@@ -296,18 +309,30 @@
break;
}
- Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSPIN_MEDIUM) *
Descriptor[Pin->PinId].MediumsCount;
- if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
- {
- Irp->IoStatus.Information = Size;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ /* calculate size */
+ Size = sizeof(KSMULTIPLE_ITEM);
+ Size += max(1, Descriptor[Pin->PinId].MediumsCount) *
sizeof(KSPIN_MEDIUM);
+
+ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
+ {
+ Irp->IoStatus.Information = Size;
+ Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
break;
}
Item = (KSMULTIPLE_ITEM*)Buffer;
Item->Size = Size;
- Item->Count = Descriptor[Pin->PinId].MediumsCount;
- RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].Mediums,
Descriptor[Pin->PinId].MediumsCount * sizeof(KSDATARANGE));
+
+ if (Descriptor[Pin->PinId].MediumsCount)
+ {
+ Item->Count = Descriptor[Pin->PinId].MediumsCount;
+ RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].Mediums,
Descriptor[Pin->PinId].MediumsCount * sizeof(KSPIN_MEDIUM));
+ }
+ else
+ {
+ Item->Count = 1;
+ RtlMoveMemory((PVOID)(Item + 1), &StandardPinMedium,
sizeof(KSPIN_MEDIUM));
+ }
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = Size;
@@ -366,16 +391,19 @@
break;
}
- Size = sizeof(GUID);
- if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
- {
- Irp->IoStatus.Information = Size;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
- break;
- }
-
-
- RtlMoveMemory(Buffer, &Descriptor[Pin->PinId].Name, sizeof(GUID));
+ GuidBuffer = Buffer;
+ Size = sizeof(Speaker);
+
+ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
+ {
+ Irp->IoStatus.Information = Size;
+ Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
+ break;
+ }
+
+ RtlMoveMemory(GuidBuffer, Speaker, sizeof(Speaker));
+
+ //RtlMoveMemory(Buffer, &Descriptor[Pin->PinId].Name, sizeof(GUID));
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = Size;
break;
Modified: trunk/reactos/drivers/ksfilter/ks/topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topolo…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Mon Aug 24 00:50:09 2009
@@ -176,7 +176,7 @@
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
@@ -184,7 +184,10 @@
Item->Size = Size;
Item->Count = Topology->CategoriesCount;
- RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->Categories,
Topology->CategoriesCount * sizeof(GUID));
+ if (Topology->CategoriesCount)
+ {
+ RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->Categories,
Topology->CategoriesCount * sizeof(GUID));
+ }
Irp->IoStatus.Information = Size;
Status = STATUS_SUCCESS;
break;
@@ -194,7 +197,7 @@
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
@@ -203,6 +206,10 @@
Item->Count = Topology->TopologyNodesCount;
RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->TopologyNodes,
Topology->TopologyNodesCount * sizeof(GUID));
+ if (Topology->TopologyNodesCount)
+ {
+ RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->TopologyNodes,
Topology->TopologyNodesCount * sizeof(GUID));
+ }
Irp->IoStatus.Information = Size;
Status = STATUS_SUCCESS;
break;
@@ -212,7 +219,7 @@
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
@@ -220,7 +227,11 @@
Item->Size = Size;
Item->Count = Topology->TopologyConnectionsCount;
- RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->TopologyConnections,
Topology->TopologyConnectionsCount * sizeof(KSTOPOLOGY_CONNECTION));
+ if (Topology->TopologyConnections)
+ {
+ RtlMoveMemory((PVOID)(Item + 1), (PVOID)Topology->TopologyConnections,
Topology->TopologyConnectionsCount * sizeof(KSTOPOLOGY_CONNECTION));
+ }
+
Irp->IoStatus.Information = Size;
Status = STATUS_SUCCESS;
break;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Mon
Aug 24 00:50:09 2009
@@ -165,6 +165,18 @@
IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface;
IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
+ {
+ DPRINT1("Unhandled function %lx Length %x\n",
IoStack->Parameters.DeviceIoControl.IoControlCode,
IoStack->Parameters.DeviceIoControl.InputBufferLength);
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
+ }
+
+
ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY);
return PcPropertyHandler(Irp, This->Descriptor);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] Mon Aug 24
00:50:09 2009
@@ -21,6 +21,7 @@
const GUID IID_IMiniportMidi = {0xb4c90a41L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0,
0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IMiniportWavePci = {0xb4c90a52L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0,
0xc9, 0x11, 0xb5, 0x44}};
+const GUID GUID_NULL ={0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00}};
const GUID IID_IPortTopology = {0xb4c90a30L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0,
0xc9, 0x11, 0xb5, 0x44}};
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] Mon Aug
24 00:50:09 2009
@@ -31,7 +31,7 @@
GUID KSPROPERTY_SETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5,
0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
-static GUID InterfaceGuids[3] =
+static GUID InterfaceGuids[4] =
{
{
/// KSCATEGORY_RENDER
@@ -42,9 +42,14 @@
0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
},
{
- /// KS_CATEGORY_AUDIO
+ //KS_CATEGORY_AUDIO
0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
- }
+ },
+ {
+ ///KSCATEGORY_AUDIO_DEVICE
+ 0xFBF6F530L, 0x07B9, 0x11D2, {0xA7, 0x1E, 0x00, 0x00, 0xF8, 0x00, 0x47, 0x88}
+ }
+
};
DEFINE_KSPROPERTY_TOPOLOGYSET(PortFilterWaveCyclicTopologySet, TopologyPropertyHandler);
@@ -363,7 +368,7 @@
/* create the subdevice descriptor */
Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
- 3,
+ 4,
InterfaceGuids,
0,
NULL,
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Mon Aug 24
00:50:09 2009
@@ -302,6 +302,9 @@
DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
+ DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(PropGeneral),\
+ DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(PropGeneral),\
+ DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral),\
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c [iso-8859-1] Mon Aug
24 00:50:09 2009
@@ -409,6 +409,68 @@
return STATUS_UNSUCCESSFUL;
}
+NTSTATUS
+PcCountProperties(
+ IN PIRP Irp,
+ IN PSUBDEVICE_DESCRIPTOR Descriptor)
+{
+ ULONG Properties;
+ ULONG Index, Offset;
+ PIO_STACK_LOCATION IoStack;
+ LPGUID Guid;
+
+ /* count property items */
+ Properties = Descriptor->FilterPropertySet.FreeKsPropertySetOffset;
+
+ if (Descriptor->DeviceDescriptor->AutomationTable)
+ {
+ Properties =
Descriptor->DeviceDescriptor->AutomationTable->PropertyCount;
+ }
+
+ /* get current irp stack */
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ /* store output size */
+ Irp->IoStatus.Information = sizeof(GUID) * Properties;
+
+ if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(GUID) *
Properties)
+ {
+ /* buffer too small */
+ Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_BUFFER_OVERFLOW;
+ }
+
+ /* get output buffer */
+ Guid = Irp->UserBuffer;
+
+
+ /* copy property guids from filter */
+ Offset = 0;
+ for(Index = 0; Index < Descriptor->FilterPropertySet.FreeKsPropertySetOffset;
Index++)
+ {
+ RtlMoveMemory(&Guid[Offset],
Descriptor->FilterPropertySet.Properties[Index].Set, sizeof(GUID));
+ Offset++;
+ }
+
+ if (Descriptor->DeviceDescriptor->AutomationTable)
+ {
+ /* copy property guids from driver */
+ for(Index = 0; Index <
Descriptor->DeviceDescriptor->AutomationTable->PropertyCount; Index++)
+ {
+ RtlMoveMemory(&Guid[Offset],
Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Set,
sizeof(GUID));
+ Offset++;
+ }
+ }
+
+ /* done */
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
+}
+
NTSTATUS
NTAPI
@@ -428,6 +490,12 @@
Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
ASSERT(Property);
+
+ if (IsEqualGUIDAligned(&Property->Set, &GUID_NULL) &&
Property->Id == 0 && Property->Flags == KSPROPERTY_TYPE_SETSUPPORT)
+ {
+ return PcCountProperties(Irp, Descriptor);
+ }
+
/* check properties provided by the driver */
if (Descriptor->DeviceDescriptor->AutomationTable)
@@ -478,7 +546,7 @@
else
{
RtlStringFromGUID(&Property->Set, &GuidString);
- DPRINT1("Unhandeled property: Set %S Id %u Flags %x\n",
GuidString.Buffer, Property->Id, Property->Flags);
+ DPRINT1("Unhandeled property: Set %S Id %u Flags %x InputLength %u
OutputLength %u\n", GuidString.Buffer, Property->Id, Property->Flags,
IoStack->Parameters.DeviceIoControl.InputBufferLength,
IoStack->Parameters.DeviceIoControl.OutputBufferLength);
RtlFreeUnicodeString(&GuidString);
}