mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 23:14:53 +00:00
- Fix calling property handler in IKsFilter_DispatchDeviceIoControl
- Found by [[Amine Khaldi]] - Implement handling of KSPROPERTY_TYPE_BASICSUPPORT svn path=/trunk/; revision=42910
This commit is contained in:
parent
e080831a72
commit
63b3ed6d1e
|
@ -706,10 +706,10 @@ IKsFilter_DispatchDeviceIoControl(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PFNKSHANDLER PropertyHandler = NULL;
|
||||
IKsFilter * Filter;
|
||||
IKsFilterImpl * This;
|
||||
NTSTATUS Status;
|
||||
PKSFILTER FilterInstance;
|
||||
|
||||
/* obtain filter from object header */
|
||||
Status = IKsFilter_GetFilterFromIrp(Irp, &Filter);
|
||||
|
@ -735,19 +735,24 @@ IKsFilter_DispatchDeviceIoControl(
|
|||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* find a supported property handler */
|
||||
Status = KsPropertyHandler(Irp, 2, FilterPropertySet);
|
||||
if (NT_SUCCESS(Status))
|
||||
/* call property handler supported by ks */
|
||||
Status = KspPropertyHandler(Irp, 2, FilterPropertySet, NULL, sizeof(KSPROPERTY_ITEM));
|
||||
|
||||
if (Status == STATUS_NOT_FOUND)
|
||||
{
|
||||
KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PVOID)This;
|
||||
DPRINT("Calling property handler %p\n", PropertyHandler);
|
||||
Status = PropertyHandler(Irp, IoStack->Parameters.DeviceIoControl.Type3InputBuffer, Irp->UserBuffer);
|
||||
/* get filter instance */
|
||||
FilterInstance = Filter->lpVtbl->GetStruct(Filter);
|
||||
|
||||
/* check if the driver supports property sets */
|
||||
if (FilterInstance->Descriptor->AutomationTable && FilterInstance->Descriptor->AutomationTable->PropertySetsCount)
|
||||
{
|
||||
/* call driver's filter property handler */
|
||||
Status = KspPropertyHandler(Irp,
|
||||
FilterInstance->Descriptor->AutomationTable->PropertySetsCount,
|
||||
FilterInstance->Descriptor->AutomationTable->PropertySets,
|
||||
NULL,
|
||||
FilterInstance->Descriptor->AutomationTable->PropertyItemSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* call driver's property handler */
|
||||
UNIMPLEMENTED
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
|
|
@ -139,4 +139,13 @@ VOID
|
|||
KspFreeCreateItems(
|
||||
IN PLIST_ENTRY ListHead);
|
||||
|
||||
NTSTATUS
|
||||
KspPropertyHandler(
|
||||
IN PIRP Irp,
|
||||
IN ULONG PropertySetsCount,
|
||||
IN const KSPROPERTY_SET* PropertySet,
|
||||
IN PFNKSALLOCATOR Allocator OPTIONAL,
|
||||
IN ULONG PropertyItemSize OPTIONAL);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,9 +17,11 @@ FindPropertyHandler(
|
|||
IN PKSPROPERTY Property,
|
||||
IN ULONG InputBufferLength,
|
||||
IN ULONG OutputBufferLength,
|
||||
OUT PVOID OutputBuffer,
|
||||
OUT PFNKSHANDLER *PropertyHandler)
|
||||
{
|
||||
ULONG Index, ItemIndex;
|
||||
//PULONG Flags;
|
||||
|
||||
for(Index = 0; Index < PropertySetCount; Index++)
|
||||
{
|
||||
|
@ -42,6 +44,46 @@ FindPropertyHandler(
|
|||
IoStatus->Information = PropertySet[Index].PropertyItem[ItemIndex].MinData;
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
#if 0
|
||||
if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT)
|
||||
{
|
||||
if (sizeof(ULONG) > OutputBufferLength)
|
||||
{
|
||||
/* too small buffer */
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* get output buffer */
|
||||
Flags = (PULONG)OutputBuffer;
|
||||
|
||||
/* clear flags */
|
||||
*Flags = KSPROPERTY_TYPE_BASICSUPPORT;
|
||||
|
||||
if (PropertySet[Index].PropertyItem[ItemIndex].GetSupported)
|
||||
*Flags |= KSPROPERTY_TYPE_GET;
|
||||
|
||||
if (PropertySet[Index].PropertyItem[ItemIndex].SetSupported)
|
||||
*Flags |= KSPROPERTY_TYPE_SET;
|
||||
|
||||
IoStatus->Information = sizeof(ULONG);
|
||||
|
||||
if (OutputBufferLength >= sizeof(KSPROPERTY_DESCRIPTION))
|
||||
{
|
||||
/* get output buffer */
|
||||
Description = (PKSPROPERTY_DESCRIPTION)OutputBuffer;
|
||||
|
||||
/* store result */
|
||||
Description->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION);
|
||||
Description->PropTypeSet.Set = KSPROPTYPESETID_General;
|
||||
Description->PropTypeSet.Id = 0;
|
||||
Description->PropTypeSet.Flags = 0;
|
||||
Description->MembersListCount = 0;
|
||||
Description->Reserved = 0;
|
||||
|
||||
IoStatus->Information = sizeof(KSPROPERTY_DESCRIPTION);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Property->Flags & KSPROPERTY_TYPE_SET)
|
||||
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].SetPropertyHandler;
|
||||
|
@ -69,7 +111,7 @@ KspPropertyHandler(
|
|||
PKSPROPERTY Property;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
NTSTATUS Status;
|
||||
PFNKSHANDLER PropertyHandler;
|
||||
PFNKSHANDLER PropertyHandler = NULL;
|
||||
|
||||
/* get current irp stack */
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
@ -97,9 +139,9 @@ KspPropertyHandler(
|
|||
}
|
||||
|
||||
/* find the property handler */
|
||||
Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, &PropertyHandler);
|
||||
Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Irp->UserBuffer, &PropertyHandler);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
if (NT_SUCCESS(Status) && PropertyHandler)
|
||||
{
|
||||
/* call property handler */
|
||||
Status = PropertyHandler(Irp, Property, Irp->UserBuffer);
|
||||
|
|
Loading…
Reference in a new issue