PVOID Buffer;
PKSDATARANGE_AUDIO *WaveFormatOut;
PKSDATAFORMAT_WAVEFORMATEX WaveFormatIn;
+ PULONG GuidBuffer;
+ static WCHAR Speaker[] = {L"PC-Speaker"};
IoStack = IoGetCurrentIrpStackLocation(Irp);
Buffer = Irp->UserBuffer;
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
break;
}
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;
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;
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;
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
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;
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
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;
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
Irp->IoStatus.Information = Size;
- Status = STATUS_BUFFER_TOO_SMALL;
+ Status = STATUS_MORE_ENTRIES;
break;
}
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;
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);
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}};
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
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);
/* create the subdevice descriptor */
Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
- 3,
+ 4,
InterfaceGuids,
0,
NULL,
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),\
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
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)
{
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);
}