mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:25:44 +00:00
- Implement KsAcquireControl, KsReleaseControl
- Add create item for creation of pins and topology nodes - Implement pin creation handler svn path=/trunk/; revision=42279
This commit is contained in:
parent
52e5cc0ba2
commit
3bf37964b7
7 changed files with 133 additions and 18 deletions
|
@ -1449,7 +1449,7 @@ KoRelease(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
KSDDKAPI
|
KSDDKAPI
|
||||||
VOID
|
VOID
|
||||||
|
@ -1457,9 +1457,33 @@ NTAPI
|
||||||
KsAcquireControl(
|
KsAcquireControl(
|
||||||
IN PVOID Object)
|
IN PVOID Object)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)Object - sizeof(KSBASIC_HEADER));
|
||||||
|
|
||||||
|
/* sanity check */
|
||||||
|
ASSERT(BasicHeader->Type == KsObjectTypeFilter || BasicHeader->Type == KsObjectTypePin);
|
||||||
|
|
||||||
|
KeWaitForSingleObject(&BasicHeader->ControlMutex, Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
KsReleaseControl(
|
||||||
|
IN PVOID Object)
|
||||||
|
{
|
||||||
|
PKSBASIC_HEADER BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)Object - sizeof(KSBASIC_HEADER));
|
||||||
|
|
||||||
|
/* sanity check */
|
||||||
|
ASSERT(BasicHeader->Type == KsObjectTypeFilter || BasicHeader->Type == KsObjectTypePin);
|
||||||
|
|
||||||
|
KeReleaseMutex(&BasicHeader->ControlMutex, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@implemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
|
@ -1793,17 +1817,6 @@ KsRegisterAggregatedClientUnknown(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
KsReleaseControl(
|
|
||||||
IN PVOID Object)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -683,7 +683,6 @@ KsInitializeDevice(
|
||||||
Header->KsDevice.Descriptor = Descriptor;
|
Header->KsDevice.Descriptor = Descriptor;
|
||||||
KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject);
|
KsSetDevicePnpAndBaseObject(Header, PhysicalDeviceObject, NextDeviceObject);
|
||||||
|
|
||||||
|
|
||||||
/* FIXME Power state */
|
/* FIXME Power state */
|
||||||
|
|
||||||
if (Descriptor)
|
if (Descriptor)
|
||||||
|
|
|
@ -899,6 +899,60 @@ IKsFilter_CopyFilterDescriptor(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IKsFilter_DispatchCreatePin(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This;
|
||||||
|
PKSOBJECT_CREATE_ITEM CreateItem;
|
||||||
|
PKSPIN_CONNECT Connect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* get the create item */
|
||||||
|
CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
|
||||||
|
|
||||||
|
/* get the filter object */
|
||||||
|
This = (IKsFilterImpl*)CreateItem->Context;
|
||||||
|
|
||||||
|
/* acquire control mutex */
|
||||||
|
KeWaitForSingleObject(&This->Header.ControlMutex, Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
|
/* now validate the connect request */
|
||||||
|
Status = KsValidateConnectRequest(Irp, This->PinDescriptorCount, This->PinDescriptors, &Connect);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* create the pin */
|
||||||
|
Status = KspCreatePin(DeviceObject, Irp, This->Header.KsDevice, This->FilterFactory, (IKsFilter*)&This->lpVtbl, Connect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* release control mutex */
|
||||||
|
KeReleaseMutex(&This->Header.ControlMutex, FALSE);
|
||||||
|
|
||||||
|
if (Status != STATUS_PENDING)
|
||||||
|
{
|
||||||
|
/* complete request */
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
}
|
||||||
|
/* done */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IKsFilter_DispatchCreateNode(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -913,6 +967,7 @@ KspCreateFilter(
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PKSOBJECT_CREATE_ITEM CreateItem;
|
||||||
|
|
||||||
/* get device extension */
|
/* get device extension */
|
||||||
DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
@ -943,7 +998,6 @@ KspCreateFilter(
|
||||||
/* get current irp stack */
|
/* get current irp stack */
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
|
||||||
/* initialize object bag */
|
/* initialize object bag */
|
||||||
This->Filter.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
|
This->Filter.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
|
||||||
if (!This->Filter.Bag)
|
if (!This->Filter.Bag)
|
||||||
|
@ -953,6 +1007,25 @@ KspCreateFilter(
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* allocate create items */
|
||||||
|
CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * 2);
|
||||||
|
if (!CreateItem)
|
||||||
|
{
|
||||||
|
/* no memory */
|
||||||
|
FreeItem(This);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize pin create item */
|
||||||
|
CreateItem[0].Create = IKsFilter_DispatchCreatePin;
|
||||||
|
CreateItem[0].Context = (PVOID)This;
|
||||||
|
CreateItem[0].Flags = KSCREATE_ITEM_FREEONSTOP;
|
||||||
|
RtlInitUnicodeString(&CreateItem[0].ObjectClass, KSSTRING_Pin);
|
||||||
|
/* initialize node create item */
|
||||||
|
CreateItem[1].Create = IKsFilter_DispatchCreateNode;
|
||||||
|
CreateItem[1].Context = (PVOID)This;
|
||||||
|
CreateItem[1].Flags = KSCREATE_ITEM_FREEONSTOP;
|
||||||
|
RtlInitUnicodeString(&CreateItem[1].ObjectClass, KSSTRING_TopologyNode);
|
||||||
|
|
||||||
|
|
||||||
KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice;
|
KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->lpVtblIKsDevice;
|
||||||
|
@ -970,6 +1043,7 @@ KspCreateFilter(
|
||||||
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
|
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
|
||||||
This->Header.Parent.KsFilterFactory = iface->lpVtbl->GetStruct(iface);
|
This->Header.Parent.KsFilterFactory = iface->lpVtbl->GetStruct(iface);
|
||||||
This->Header.Type = KsObjectTypeFilter;
|
This->Header.Type = KsObjectTypeFilter;
|
||||||
|
KeInitializeMutex(&This->Header.ControlMutex, 0);
|
||||||
KeInitializeMutex(&This->ProcessingMutex, 0);
|
KeInitializeMutex(&This->ProcessingMutex, 0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -979,6 +1053,7 @@ KspCreateFilter(
|
||||||
{
|
{
|
||||||
/* what can go wrong, goes wrong */
|
/* what can go wrong, goes wrong */
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
|
FreeItem(CreateItem);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +1064,7 @@ KspCreateFilter(
|
||||||
{
|
{
|
||||||
/* failed to add filter */
|
/* failed to add filter */
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
|
FreeItem(CreateItem);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,12 +1081,12 @@ KspCreateFilter(
|
||||||
|
|
||||||
/* free filter instance */
|
/* free filter instance */
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
|
FreeItem(CreateItem);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now allocate the object header */
|
/* now allocate the object header */
|
||||||
Status = KsAllocateObjectHeader((PVOID*)&This->ObjectHeader, 0, NULL, Irp, &DispatchTable);
|
Status = KsAllocateObjectHeader((PVOID*)&This->ObjectHeader, 2, CreateItem, Irp, &DispatchTable);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* failed to allocate object header */
|
/* failed to allocate object header */
|
||||||
|
|
|
@ -192,6 +192,9 @@ IKsFilterFactory_fnInitialize(
|
||||||
InitializeListHead(&This->SymbolicLinkList);
|
InitializeListHead(&This->SymbolicLinkList);
|
||||||
InitializeListHead(&This->FilterInstanceList);
|
InitializeListHead(&This->FilterInstanceList);
|
||||||
|
|
||||||
|
/* initialize filter factory control mutex */
|
||||||
|
KeInitializeMutex(&This->Header.ControlMutex, 0);
|
||||||
|
|
||||||
/* does the device use a reference string */
|
/* does the device use a reference string */
|
||||||
if (RefString || !Descriptor->ReferenceGuid)
|
if (RefString || !Descriptor->ReferenceGuid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,4 +114,14 @@ KspCopyCreateRequest(
|
||||||
IN OUT PULONG Size,
|
IN OUT PULONG Size,
|
||||||
OUT PVOID * Result);
|
OUT PVOID * Result);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
KspCreatePin(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp,
|
||||||
|
IN PKSDEVICE KsDevice,
|
||||||
|
IN IKsFilterFactory * FilterFactory,
|
||||||
|
IN IKsFilter* Filter,
|
||||||
|
IN PKSPIN_CONNECT Connect);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
KSOBJECTTYPE Type;
|
KSOBJECTTYPE Type;
|
||||||
PKSDEVICE KsDevice;
|
PKSDEVICE KsDevice;
|
||||||
|
KMUTEX ControlMutex;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
PKSDEVICE KsDevice;
|
PKSDEVICE KsDevice;
|
||||||
|
|
|
@ -519,3 +519,17 @@ KsStreamPointerGetNextClone(
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
KspCreatePin(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp,
|
||||||
|
IN PKSDEVICE KsDevice,
|
||||||
|
IN IKsFilterFactory * FilterFactory,
|
||||||
|
IN IKsFilter* Filter,
|
||||||
|
IN PKSPIN_CONNECT Connect)
|
||||||
|
{
|
||||||
|
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue