0
};
+const GUID KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT = {0xf4aeb342, 0x0329, 0x4fdd, {0xa8, 0xfd, 0x4a, 0xff, 0x49, 0x26, 0xc9, 0x78}};
/*
@implemented
ConnectionHandle);
}
-/*
- @unimplemented
-*/
-KSDDKAPI
NTSTATUS
-NTAPI
-KsValidateConnectRequest(
- IN PIRP Irp,
- IN ULONG DescriptorsCount,
- IN KSPIN_DESCRIPTOR* Descriptor,
+KspValidateConnectRequest(
+ IN PIRP Irp,
+ IN ULONG DescriptorsCount,
+ IN PVOID Descriptors,
+ IN ULONG DescriptorSize,
OUT PKSPIN_CONNECT* Connect)
{
PKSPIN_CONNECT ConnectDetails;
ULONG Index;
ULONG Count;
BOOLEAN Found;
+ PKSPIN_DESCRIPTOR Descriptor;
/* did the caller miss the connect parameter */
if (!Connect)
if (ConnectDetails->PinId >= DescriptorsCount)
return STATUS_INVALID_PARAMETER;
+ if (DescriptorSize == sizeof(KSPIN_DESCRIPTOR))
+ {
+ /* standard pin descriptor */
+ Descriptor = (PKSPIN_DESCRIPTOR)((ULONG_PTR)Descriptors + sizeof(KSPIN_DESCRIPTOR) * ConnectDetails->PinId);
+ }
+ else
+ {
+ /* extended / variable pin descriptor */
+ Descriptor = &((PKSPIN_DESCRIPTOR_EX)((ULONG_PTR)Descriptors + DescriptorSize * ConnectDetails->PinId))->PinDescriptor;
+ }
+
+
/* does the pin have interface details filled in */
- if (Descriptor[ConnectDetails->PinId].InterfacesCount && Descriptor[ConnectDetails->PinId].Interfaces)
+ if (Descriptor->InterfacesCount && Descriptor->Interfaces)
{
/* use provided pin interface count */
- Count = Descriptor[ConnectDetails->PinId].InterfacesCount;
- Interface = (PKSPIN_INTERFACE)Descriptor[ConnectDetails->PinId].Interfaces;
+ Count = Descriptor->InterfacesCount;
+ Interface = (PKSPIN_INTERFACE)Descriptor->Interfaces;
}
else
{
Index = 0;
do
{
+ UNICODE_STRING GuidString, GuidString2;
+ RtlStringFromGUID(&Interface[Index].Set, &GuidString);
+ RtlStringFromGUID(&ConnectDetails->Interface.Set, &GuidString2);
+
+ DPRINT("Driver Interface %S Id %u\n", GuidString.Buffer, Interface[Index].Id);
+ DPRINT("Connect Interface %S Id %u\n", GuidString2.Buffer, ConnectDetails->Interface.Id);
+
if (IsEqualGUIDAligned(&Interface[Index].Set, &ConnectDetails->Interface.Set) &&
Interface[Index].Id == ConnectDetails->Interface.Id)
{
}
/* does the pin have medium details filled in */
- if (Descriptor[ConnectDetails->PinId].MediumsCount && Descriptor[ConnectDetails->PinId].Mediums)
+ if (Descriptor->MediumsCount && Descriptor->Mediums)
{
/* use provided pin interface count */
- Count = Descriptor[ConnectDetails->PinId].MediumsCount;
- Medium = (PKSPIN_MEDIUM)Descriptor[ConnectDetails->PinId].Mediums;
+ Count = Descriptor->MediumsCount;
+ Medium = (PKSPIN_MEDIUM)Descriptor->Mediums;
}
else
{
Index = 0;
do
{
+ UNICODE_STRING GuidString, GuidString2;
+ RtlStringFromGUID(&Medium[Index].Set, &GuidString);
+ RtlStringFromGUID(&ConnectDetails->Medium.Set, &GuidString2);
+
+ DPRINT("Driver Medium %S Id %u\n", GuidString.Buffer, Medium[Index].Id);
+ DPRINT("Connect Medium %S Id %u\n", GuidString2.Buffer, ConnectDetails->Medium.Id);
+
+
if (IsEqualGUIDAligned(&Medium[Index].Set, &ConnectDetails->Medium.Set) &&
Medium[Index].Id == ConnectDetails->Medium.Id)
{
Found = TRUE;
break;
}
+
+
+
/* iterate to next medium */
Index++;
}while(Index < Count);
return STATUS_SUCCESS;
}
+/*
+ @implemented
+*/
+KSDDKAPI
+NTSTATUS
+NTAPI
+KsValidateConnectRequest(
+ IN PIRP Irp,
+ IN ULONG DescriptorsCount,
+ IN KSPIN_DESCRIPTOR* Descriptor,
+ OUT PKSPIN_CONNECT* Connect)
+{
+ return KspValidateConnectRequest(Irp, DescriptorsCount, Descriptor, sizeof(KSPIN_DESCRIPTOR), Connect);
+}
NTSTATUS
KspReadMediaCategory(
return Status;
}
-/*
- @implemented
-*/
KSDDKAPI
NTSTATUS
NTAPI
-KsPinPropertyHandler(
+KspPinPropertyHandler(
IN PIRP Irp,
IN PKSPROPERTY Property,
IN OUT PVOID Data,
IN ULONG DescriptorsCount,
- IN const KSPIN_DESCRIPTOR* Descriptor)
+ IN const KSPIN_DESCRIPTOR* Descriptors,
+ IN ULONG DescriptorSize)
{
KSP_PIN * Pin;
KSMULTIPLE_ITEM * Item;
PKSDATARANGE_AUDIO *WaveFormatOut;
PKSDATAFORMAT_WAVEFORMATEX WaveFormatIn;
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
+ const KSPIN_DESCRIPTOR *Descriptor;
NTSTATUS Status = STATUS_NOT_SUPPORTED;
ULONG Count;
const PKSDATARANGE* DataRanges;
//DPRINT("KsPinPropertyHandler Irp %p Property %p Data %p DescriptorsCount %u Descriptor %p OutputLength %u Id %u\n", Irp, Property, Data, DescriptorsCount, Descriptor, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Property->Id);
+ /* convert to PKSP_PIN */
+ Pin = (KSP_PIN*)Property;
+
+ if (Property->Id != KSPROPERTY_PIN_CTYPES)
+ {
+ if (Pin->PinId >= DescriptorsCount)
+ {
+ /* invalid parameter */
+ return STATUS_INVALID_PARAMETER;
+ }
+ }
+
+ if (DescriptorSize == sizeof(KSPIN_DESCRIPTOR))
+ {
+ /* it is simple pin descriptor */
+ Descriptor = &Descriptors[Pin->PinId];
+ }
+ else
+ {
+ /* get offset to pin descriptor */
+ Descriptor = &(((PKSPIN_DESCRIPTOR_EX)((ULONG_PTR)Descriptors + Pin->PinId * DescriptorSize))->PinDescriptor);
+ }
+
switch(Property->Id)
{
case KSPROPERTY_PIN_CTYPES:
Status = STATUS_SUCCESS;
break;
case KSPROPERTY_PIN_DATAFLOW:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
+
Size = sizeof(KSPIN_DATAFLOW);
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
break;
}
- *((KSPIN_DATAFLOW*)Buffer) = Descriptor[Pin->PinId].DataFlow;
+ *((KSPIN_DATAFLOW*)Buffer) = Descriptor->DataFlow;
Irp->IoStatus.Information = sizeof(KSPIN_DATAFLOW);
Status = STATUS_SUCCESS;
break;
case KSPROPERTY_PIN_DATARANGES:
case KSPROPERTY_PIN_CONSTRAINEDDATARANGES:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
+
Size = sizeof(KSMULTIPLE_ITEM);
- if (Property->Id == KSPROPERTY_PIN_DATARANGES || Descriptor[Pin->PinId].ConstrainedDataRangesCount == 0)
+ DPRINT("Id %lu PinId %lu DataRangesCount %lu ConstrainedDataRangesCount %lu\n", Property->Id, Pin->PinId, Descriptor->DataRangesCount, Descriptor->ConstrainedDataRangesCount);
+
+ if (Property->Id == KSPROPERTY_PIN_DATARANGES || Descriptor->ConstrainedDataRangesCount == 0)
{
- DataRanges = Descriptor[Pin->PinId].DataRanges;
- Count = Descriptor[Pin->PinId].DataRangesCount;
+ DataRanges = Descriptor->DataRanges;
+ Count = Descriptor->DataRangesCount;
}
else
{
- DataRanges = Descriptor[Pin->PinId].ConstrainedDataRanges;
- Count = Descriptor[Pin->PinId].ConstrainedDataRangesCount;
+ DataRanges = Descriptor->ConstrainedDataRanges;
+ Count = Descriptor->ConstrainedDataRangesCount;
}
for (Index = 0; Index < Count; Index++)
Irp->IoStatus.Information = Size;
break;
case KSPROPERTY_PIN_INTERFACES:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
- if (Descriptor[Pin->PinId].Interfaces)
+ if (Descriptor->Interfaces)
{
/* use mediums provided by driver */
- return KsHandleSizedListQuery(Irp, Descriptor[Pin->PinId].InterfacesCount, sizeof(KSPIN_MEDIUM), Descriptor[Pin->PinId].Interfaces);
+ return KsHandleSizedListQuery(Irp, Descriptor->InterfacesCount, sizeof(KSPIN_MEDIUM), Descriptor->Interfaces);
}
else
{
break;
case KSPROPERTY_PIN_MEDIUMS:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
- if (Descriptor[Pin->PinId].MediumsCount)
+ if (Descriptor->MediumsCount)
{
/* use mediums provided by driver */
- return KsHandleSizedListQuery(Irp, Descriptor[Pin->PinId].MediumsCount, sizeof(KSPIN_MEDIUM), Descriptor[Pin->PinId].Mediums);
+ return KsHandleSizedListQuery(Irp, Descriptor->MediumsCount, sizeof(KSPIN_MEDIUM), Descriptor->Mediums);
}
else
{
break;
case KSPROPERTY_PIN_COMMUNICATION:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
Size = sizeof(KSPIN_COMMUNICATION);
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
break;
}
- //DPRINT("Pin %lu Communication %lu\n", Pin->PinId, Descriptor[Pin->PinId].Communication);
- *((KSPIN_COMMUNICATION*)Buffer) = Descriptor[Pin->PinId].Communication;
+ *((KSPIN_COMMUNICATION*)Buffer) = Descriptor->Communication;
Status = STATUS_SUCCESS;
Irp->IoStatus.Information = Size;
break;
case KSPROPERTY_PIN_CATEGORY:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
Size = sizeof(GUID);
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
Status = STATUS_BUFFER_TOO_SMALL;
break;
}
- if (Descriptor[Pin->PinId].Category)
+ if (Descriptor->Category)
{
- RtlMoveMemory(Buffer, Descriptor[Pin->PinId].Category, sizeof(GUID));
+ RtlMoveMemory(Buffer, Descriptor->Category, sizeof(GUID));
}
Status = STATUS_SUCCESS;
break;
case KSPROPERTY_PIN_NAME:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- if (!Descriptor[Pin->PinId].Name)
+ if (!Descriptor->Name)
{
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
- Status = KspReadMediaCategory((LPGUID)Descriptor[Pin->PinId].Name, &KeyInfo);
+ Status = KspReadMediaCategory((LPGUID)Descriptor->Name, &KeyInfo);
if (!NT_SUCCESS(Status))
{
Irp->IoStatus.Information = 0;
break;
}
-
Irp->IoStatus.Information = KeyInfo->DataLength + sizeof(WCHAR);
if (KeyInfo->DataLength + sizeof(WCHAR) > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
ExFreePool(KeyInfo);
break;
case KSPROPERTY_PIN_PROPOSEDATAFORMAT:
- Pin = (KSP_PIN*)Property;
- if (Pin->PinId >= DescriptorsCount)
- {
- Status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
Size = sizeof(KSDATAFORMAT);
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
}
WaveFormatIn = (PKSDATAFORMAT_WAVEFORMATEX)Buffer;
- if (!Descriptor[Pin->PinId].DataRanges || !Descriptor[Pin->PinId].DataRangesCount)
+ if (!Descriptor->DataRanges || !Descriptor->DataRangesCount)
{
Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0;
break;
}
- WaveFormatOut = (PKSDATARANGE_AUDIO*)Descriptor[Pin->PinId].DataRanges;
- for(Index = 0; Index < Descriptor[Pin->PinId].DataRangesCount; Index++)
+ WaveFormatOut = (PKSDATARANGE_AUDIO*)Descriptor->DataRanges;
+ for(Index = 0; Index < Descriptor->DataRangesCount; Index++)
{
if (WaveFormatOut[Index]->DataRange.FormatSize != sizeof(KSDATARANGE_AUDIO))
{
return Status;
}
+/*
+ @implemented
+*/
+KSDDKAPI
+NTSTATUS
+NTAPI
+KsPinPropertyHandler(
+ IN PIRP Irp,
+ IN PKSPROPERTY Property,
+ IN OUT PVOID Data,
+ IN ULONG DescriptorsCount,
+ IN const KSPIN_DESCRIPTOR* Descriptor)
+{
+ return KspPinPropertyHandler(Irp, Property, Data, DescriptorsCount, Descriptor, sizeof(KSPIN_DESCRIPTOR));
+}
+
/*
@unimplemented
*/