mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 02:34:53 +00:00
[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 svn path=/trunk/; revision=42892
This commit is contained in:
parent
9ef29fde4b
commit
d3f226afd5
|
@ -194,6 +194,8 @@ KsPinPropertyHandler(
|
|||
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 @@ KsPinPropertyHandler(
|
|||
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 @@ KsPinPropertyHandler(
|
|||
break;
|
||||
}
|
||||
|
||||
Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSPIN_INTERFACE) * Descriptor[Pin->PinId].InterfacesCount;
|
||||
/* 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_BUFFER_TOO_SMALL;
|
||||
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 @@ KsPinPropertyHandler(
|
|||
break;
|
||||
}
|
||||
|
||||
Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSPIN_MEDIUM) * Descriptor[Pin->PinId].MediumsCount;
|
||||
/* 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_BUFFER_TOO_SMALL;
|
||||
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 @@ KsPinPropertyHandler(
|
|||
break;
|
||||
}
|
||||
|
||||
Size = sizeof(GUID);
|
||||
GuidBuffer = Buffer;
|
||||
Size = sizeof(Speaker);
|
||||
|
||||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
|
||||
break;
|
||||
}
|
||||
|
||||
RtlMoveMemory(GuidBuffer, Speaker, sizeof(Speaker));
|
||||
|
||||
RtlMoveMemory(Buffer, &Descriptor[Pin->PinId].Name, sizeof(GUID));
|
||||
//RtlMoveMemory(Buffer, &Descriptor[Pin->PinId].Name, sizeof(GUID));
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
|
|
|
@ -176,7 +176,7 @@ KsTopologyPropertyHandler(
|
|||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Status = STATUS_MORE_ENTRIES;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,10 @@ KsTopologyPropertyHandler(
|
|||
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 @@ KsTopologyPropertyHandler(
|
|||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Status = STATUS_MORE_ENTRIES;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -203,6 +206,10 @@ KsTopologyPropertyHandler(
|
|||
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 @@ KsTopologyPropertyHandler(
|
|||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
Status = STATUS_MORE_ENTRIES;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -220,7 +227,11 @@ KsTopologyPropertyHandler(
|
|||
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;
|
||||
|
|
|
@ -165,6 +165,18 @@ IPortFilterWaveCyclic_fnDeviceIoControl(
|
|||
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);
|
||||
|
|
|
@ -21,6 +21,7 @@ const GUID IID_IMiniportTopology = {0xb4c90a31L, 0x5791, 0x11d0, {0x86, 0xf9, 0x
|
|||
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}};
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef struct
|
|||
|
||||
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 @@ static GUID InterfaceGuids[3] =
|
|||
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 @@ IPortWaveCyclic_fnInit(
|
|||
|
||||
/* create the subdevice descriptor */
|
||||
Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
|
||||
3,
|
||||
4,
|
||||
InterfaceGuids,
|
||||
0,
|
||||
NULL,
|
||||
|
|
|
@ -302,6 +302,9 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
|||
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),\
|
||||
|
|
|
@ -409,6 +409,68 @@ FindPropertyHandler(
|
|||
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
|
||||
|
@ -429,6 +491,12 @@ PcPropertyHandler(
|
|||
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 @@ PcPropertyHandler(
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue