mirror of
https://github.com/reactos/reactos.git
synced 2025-06-04 17:00:31 +00:00
[KS]
- Proper implement KsValidateConnectRequest - Dataformat isnt not yet checked svn path=/trunk/; revision=42664
This commit is contained in:
parent
9a7221dc8b
commit
11a3ac6f28
1 changed files with 101 additions and 35 deletions
|
@ -9,6 +9,21 @@
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
KSPIN_INTERFACE StandardPinInterface =
|
||||||
|
{
|
||||||
|
{STATIC_KSINTERFACESETID_Standard},
|
||||||
|
KSINTERFACE_STANDARD_STREAMING,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
KSPIN_MEDIUM StandardPinMedium =
|
||||||
|
{
|
||||||
|
{STATIC_KSMEDIUMSETID_Standard},
|
||||||
|
KSMEDIUM_TYPE_ANYINSTANCE,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@implemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
|
@ -50,61 +65,112 @@ KsValidateConnectRequest(
|
||||||
IN KSPIN_DESCRIPTOR* Descriptor,
|
IN KSPIN_DESCRIPTOR* Descriptor,
|
||||||
OUT PKSPIN_CONNECT* Connect)
|
OUT PKSPIN_CONNECT* Connect)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IoStack;
|
|
||||||
PKSPIN_CONNECT ConnectDetails;
|
PKSPIN_CONNECT ConnectDetails;
|
||||||
LPWSTR PinName = L"{146F1A80-4791-11D0-A5D6-28DB04C10000}\\";
|
PKSPIN_INTERFACE Interface;
|
||||||
PKSDATAFORMAT DataFormat;
|
PKSPIN_MEDIUM Medium;
|
||||||
LPWSTR Offset;
|
ULONG Size;
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG Index;
|
||||||
|
ULONG Count;
|
||||||
|
BOOLEAN Found;
|
||||||
|
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
/* did the caller miss the connect parameter */
|
||||||
if (!IoStack->FileObject->FileName.Buffer)
|
if (!Connect)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (IoStack->FileObject->FileName.Length < wcslen(PinName) + sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT))
|
/* set create param size */
|
||||||
return STATUS_INVALID_PARAMETER;
|
Size = sizeof(KSPIN_CONNECT);
|
||||||
|
|
||||||
Offset = wcsstr(IoStack->FileObject->FileName.Buffer, PinName);
|
/* fetch create parameters */
|
||||||
if (!Offset)
|
Status = KspCopyCreateRequest(Irp,
|
||||||
{
|
KSSTRING_Pin,
|
||||||
/* request is not targeted for a pin */
|
&Size,
|
||||||
return STATUS_INVALID_PARAMETER;
|
(PVOID*)&ConnectDetails);
|
||||||
}
|
|
||||||
|
|
||||||
ConnectDetails = (PKSPIN_CONNECT)(Offset + wcslen(PinName));
|
/* check for success */
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
if (ConnectDetails->PinToHandle != NULL)
|
return Status;
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* is pin id out of bounds */
|
||||||
if (ConnectDetails->PinId >= DescriptorsCount)
|
if (ConnectDetails->PinId >= DescriptorsCount)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
#if 0
|
/* does the pin have interface details filled in */
|
||||||
if (!IsEqualGUIDAligned(&ConnectDetails->Interface.Set, &KSINTERFACESETID_Standard) &&
|
if (Descriptor[ConnectDetails->PinId].InterfacesCount && Descriptor[ConnectDetails->PinId].Interfaces)
|
||||||
ConnectDetails->Interface.Id != KSINTERFACE_STANDARD_STREAMING)
|
|
||||||
{
|
{
|
||||||
//FIXME
|
/* use provided pin interface count */
|
||||||
// validate provided interface set
|
Count = Descriptor[ConnectDetails->PinId].InterfacesCount;
|
||||||
DPRINT1("FIXME\n");
|
Interface = (PKSPIN_INTERFACE)Descriptor[ConnectDetails->PinId].Interfaces;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* use standard pin interface */
|
||||||
|
Count = 1;
|
||||||
|
Interface = &StandardPinInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsEqualGUIDAligned(&ConnectDetails->Medium.Set, &KSMEDIUMSETID_Standard) &&
|
/* now check the interface */
|
||||||
ConnectDetails->Medium.Id != KSMEDIUM_TYPE_ANYINSTANCE)
|
Found = FALSE;
|
||||||
|
Index = 0;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
//FIXME
|
if (IsEqualGUIDAligned(&Interface[Index].Set, &ConnectDetails->Interface.Set) &&
|
||||||
// validate provided medium set
|
Interface[Index].Id == ConnectDetails->Interface.Id)
|
||||||
DPRINT1("FIXME\n");
|
{
|
||||||
|
/* found a matching interface */
|
||||||
|
Found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* iterate to next interface */
|
||||||
|
Index++;
|
||||||
|
}while(Index < Count);
|
||||||
|
|
||||||
|
if (!Found)
|
||||||
|
{
|
||||||
|
/* pin doesnt support this interface */
|
||||||
|
return STATUS_NO_MATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* does the pin have medium details filled in */
|
||||||
|
if (Descriptor[ConnectDetails->PinId].MediumsCount && Descriptor[ConnectDetails->PinId].Mediums)
|
||||||
|
{
|
||||||
|
/* use provided pin interface count */
|
||||||
|
Count = Descriptor[ConnectDetails->PinId].MediumsCount;
|
||||||
|
Medium = (PKSPIN_MEDIUM)Descriptor[ConnectDetails->PinId].Mediums;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* use standard pin interface */
|
||||||
|
Count = 1;
|
||||||
|
Medium = &StandardPinMedium;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now check the interface */
|
||||||
|
Found = FALSE;
|
||||||
|
Index = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (IsEqualGUIDAligned(&Medium[Index].Set, &ConnectDetails->Medium.Set) &&
|
||||||
|
Medium[Index].Id == ConnectDetails->Medium.Id)
|
||||||
|
{
|
||||||
|
/* found a matching interface */
|
||||||
|
Found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* iterate to next medium */
|
||||||
|
Index++;
|
||||||
|
}while(Index < Count);
|
||||||
|
|
||||||
|
if (!Found)
|
||||||
|
{
|
||||||
|
/* pin doesnt support this medium */
|
||||||
|
return STATUS_NO_MATCH;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/// FIXME
|
/// FIXME
|
||||||
/// implement format checking
|
/// implement format checking
|
||||||
|
|
||||||
DataFormat = (PKSDATAFORMAT) (ConnectDetails + 1);
|
|
||||||
*Connect = ConnectDetails;
|
*Connect = ConnectDetails;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue