mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
- Implement KsPinPropertyHandler
svn path=/trunk/; revision=39633
This commit is contained in:
parent
cf316da120
commit
7f8d4df605
1 changed files with 198 additions and 2 deletions
|
@ -34,7 +34,9 @@ KsValidateConnectRequest(
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
KSDDKAPI NTSTATUS NTAPI
|
||||
KSDDKAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
KsPinPropertyHandler(
|
||||
IN PIRP Irp,
|
||||
IN PKSPROPERTY Property,
|
||||
|
@ -42,7 +44,201 @@ KsPinPropertyHandler(
|
|||
IN ULONG DescriptorsCount,
|
||||
IN const KSPIN_DESCRIPTOR* Descriptor)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
KSP_PIN * Pin;
|
||||
KSMULTIPLE_ITEM * Item;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
ULONG Size;
|
||||
PVOID Buffer;
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Buffer = Irp->UserBuffer;
|
||||
|
||||
if (Property->Flags != KSPROPERTY_TYPE_GET)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
switch(Property->Id)
|
||||
{
|
||||
case KSPROPERTY_PIN_CTYPES:
|
||||
(*(PULONG)Buffer) = DescriptorsCount;
|
||||
Irp->IoStatus.Information = sizeof(ULONG);
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
break;
|
||||
case KSPROPERTY_PIN_DATAFLOW:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
}
|
||||
Size = sizeof(KSPIN_DATAFLOW);
|
||||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
break;
|
||||
}
|
||||
|
||||
*((KSPIN_DATAFLOW*)Buffer) = Descriptor[Pin->PinId].DataFlow;
|
||||
Irp->IoStatus.Information = sizeof(KSPIN_DATAFLOW);
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
case KSPROPERTY_PIN_DATARANGES:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSDATARANGE) * Descriptor[Pin->PinId].DataRangesCount;
|
||||
|
||||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
break;
|
||||
}
|
||||
|
||||
Item = (KSMULTIPLE_ITEM*)Buffer;
|
||||
Item->Size = Size;
|
||||
Item->Count = Descriptor[Pin->PinId].DataRangesCount;
|
||||
RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].DataRanges, Descriptor[Pin->PinId].DataRangesCount * sizeof(KSDATARANGE));
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
case KSPROPERTY_PIN_INTERFACES:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
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;
|
||||
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));
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
case KSPROPERTY_PIN_MEDIUMS:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
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;
|
||||
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));
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
|
||||
case KSPROPERTY_PIN_COMMUNICATION:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Size = sizeof(KSPIN_COMMUNICATION);
|
||||
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
|
||||
{
|
||||
Irp->IoStatus.Information = Size;
|
||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||
break;
|
||||
}
|
||||
|
||||
*((KSPIN_COMMUNICATION*)Buffer) = Descriptor[Pin->PinId].Communication;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
|
||||
case KSPROPERTY_PIN_CATEGORY:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
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].Category, sizeof(GUID));
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
|
||||
case KSPROPERTY_PIN_NAME:
|
||||
Pin = (KSP_PIN*)Property;
|
||||
if (Pin->PinId >= DescriptorsCount)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
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));
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Size;
|
||||
break;
|
||||
default:
|
||||
DPRINT1("Unhandled property request %x\n", Property->Id);
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
}
|
||||
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
KSDDKAPI NTSTATUS NTAPI
|
||||
|
|
Loading…
Reference in a new issue