Author: janderwald
Date: Mon Aug 24 14:21:20 2009
New Revision: 42910
URL:
http://svn.reactos.org/svn/reactos?rev=42910&view=rev
Log:
- Fix calling property handler in IKsFilter_DispatchDeviceIoControl
- Found by [[Amine Khaldi]]
- Implement handling of KSPROPERTY_TYPE_BASICSUPPORT
Modified:
trunk/reactos/drivers/ksfilter/ks/filter.c
trunk/reactos/drivers/ksfilter/ks/ksfunc.h
trunk/reactos/drivers/ksfilter/ks/property.c
Modified: trunk/reactos/drivers/ksfilter/ks/filter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Mon Aug 24 14:21:20 2009
@@ -706,10 +706,10 @@
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 @@
return STATUS_NOT_IMPLEMENTED;
}
- /* find a supported property handler */
- Status = KsPropertyHandler(Irp, 2, FilterPropertySet);
- if (NT_SUCCESS(Status))
- {
- KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PVOID)This;
- DPRINT("Calling property handler %p\n", PropertyHandler);
- Status = PropertyHandler(Irp,
IoStack->Parameters.DeviceIoControl.Type3InputBuffer, Irp->UserBuffer);
- }
- else
- {
- /* call driver's property handler */
- UNIMPLEMENTED
- Status = STATUS_NOT_IMPLEMENTED;
+ /* call property handler supported by ks */
+ Status = KspPropertyHandler(Irp, 2, FilterPropertySet, NULL,
sizeof(KSPROPERTY_ITEM));
+
+ if (Status == STATUS_NOT_FOUND)
+ {
+ /* 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);
+ }
}
Irp->IoStatus.Status = Status;
Modified: trunk/reactos/drivers/ksfilter/ks/ksfunc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/ksfunc…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/ksfunc.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/ksfunc.h [iso-8859-1] Mon Aug 24 14:21:20 2009
@@ -139,4 +139,13 @@
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
Modified: trunk/reactos/drivers/ksfilter/ks/property.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/proper…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/property.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/property.c [iso-8859-1] Mon Aug 24 14:21:20 2009
@@ -17,9 +17,11 @@
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 @@
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 @@
PKSPROPERTY Property;
PIO_STACK_LOCATION IoStack;
NTSTATUS Status;
- PFNKSHANDLER PropertyHandler;
+ PFNKSHANDLER PropertyHandler = NULL;
/* get current irp stack */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -97,9 +139,9 @@
}
/* find the property handler */
- Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount,
Property, IoStack->Parameters.DeviceIoControl.InputBufferLength,
IoStack->Parameters.DeviceIoControl.OutputBufferLength, &PropertyHandler);
-
- if (NT_SUCCESS(Status))
+ Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount,
Property, IoStack->Parameters.DeviceIoControl.InputBufferLength,
IoStack->Parameters.DeviceIoControl.OutputBufferLength, Irp->UserBuffer,
&PropertyHandler);
+
+ if (NT_SUCCESS(Status) && PropertyHandler)
{
/* call property handler */
Status = PropertyHandler(Irp, Property, Irp->UserBuffer);