mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[KS]
- Merge from audio branch - Perform irp completion in dedicated function - Move Software Bus function into own file - Remove debugging code which caused crashes - Partly implement IKsProcessingObject interface for filter - Fix check in FindMatchingCreateItem function - Implement software bus enumerator functions [SWENUM] - Implement SwDispatchPower, SwDispatchPower svn path=/trunk/; revision=50531
This commit is contained in:
commit
c6b26fa452
18 changed files with 2788 additions and 435 deletions
|
@ -4,8 +4,8 @@
|
||||||
<directory name="ks">
|
<directory name="ks">
|
||||||
<xi:include href="ks/ks.rbuild" />
|
<xi:include href="ks/ks.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
<!--<directory name="swenum">
|
<directory name="swenum">
|
||||||
<xi:include href="swenum/swenum.rbuild" />
|
<xi:include href="swenum/swenum.rbuild" />
|
||||||
</directory>-->
|
</directory>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
|
|
||||||
/* complete and forget irps */
|
/* complete and forget irps */
|
||||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
{
|
{
|
||||||
/* invalid request */
|
/* invalid request */
|
||||||
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE);
|
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE);
|
||||||
/* complete and forget irp */
|
/* complete and forget irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
if (!(Property->Flags & KSPROPERTY_TYPE_GET))
|
if (!(Property->Flags & KSPROPERTY_TYPE_GET))
|
||||||
|
@ -198,7 +198,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
/* only support retrieving the property */
|
/* only support retrieving the property */
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
/* complete and forget irp */
|
/* complete and forget irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE);
|
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_FUNCTIONTABLE);
|
||||||
/* complete request */
|
/* complete request */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (Property->Id == KSPROPERTY_STREAMALLOCATOR_STATUS)
|
else if (Property->Id == KSPROPERTY_STREAMALLOCATOR_STATUS)
|
||||||
|
@ -223,7 +223,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
Irp->IoStatus.Information = sizeof(KSPROPERTY_STREAMALLOCATOR_STATUS);
|
Irp->IoStatus.Information = sizeof(KSPROPERTY_STREAMALLOCATOR_STATUS);
|
||||||
/* complete and forget irp */
|
/* complete and forget irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
if (!(Property->Flags & KSPROPERTY_TYPE_GET))
|
if (!(Property->Flags & KSPROPERTY_TYPE_GET))
|
||||||
|
@ -231,7 +231,7 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
/* only support retrieving the property */
|
/* only support retrieving the property */
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
/* complete and forget irp */
|
/* complete and forget irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,14 +246,14 @@ IKsAllocator_fnDeviceIoControl(
|
||||||
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_STATUS);
|
Irp->IoStatus.Information = sizeof(KSSTREAMALLOCATOR_STATUS);
|
||||||
|
|
||||||
/* complete request */
|
/* complete request */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unhandled request */
|
/* unhandled request */
|
||||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ IKsAllocator_DispatchDeviceIoControl(
|
||||||
|
|
||||||
/* complete request */
|
/* complete request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ IKsAllocator_DispatchClose(
|
||||||
|
|
||||||
/* complete request */
|
/* complete request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1332,7 +1332,7 @@ KopDispatchClose(
|
||||||
|
|
||||||
/* complete request */
|
/* complete request */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1416,7 +1416,7 @@ KopDispatchCreate(
|
||||||
IoStack->FileObject->FsContext2 = (PVOID)Header;
|
IoStack->FileObject->FsContext2 = (PVOID)Header;
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
|
@ -1429,7 +1429,7 @@ cleanup:
|
||||||
FreeItem(Header);
|
FreeItem(Header);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ KsCompletePendingRequest(
|
||||||
if (IoStack->MajorFunction != IRP_MJ_CLOSE)
|
if (IoStack->MajorFunction != IRP_MJ_CLOSE)
|
||||||
{
|
{
|
||||||
/* can be completed immediately */
|
/* can be completed immediately */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1711,7 +1711,7 @@ KsCompletePendingRequest(
|
||||||
if (!NT_SUCCESS(Irp->IoStatus.Status))
|
if (!NT_SUCCESS(Irp->IoStatus.Status))
|
||||||
{
|
{
|
||||||
/* closing failed, complete irp */
|
/* closing failed, complete irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1723,136 +1723,8 @@ KsCompletePendingRequest(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@implemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
KsCreateBusEnumObject(
|
|
||||||
IN PWCHAR BusIdentifier,
|
|
||||||
IN PDEVICE_OBJECT BusDeviceObject,
|
|
||||||
IN PDEVICE_OBJECT PhysicalDeviceObject,
|
|
||||||
IN PDEVICE_OBJECT PnpDeviceObject OPTIONAL,
|
|
||||||
IN REFGUID InterfaceGuid OPTIONAL,
|
|
||||||
IN PWCHAR ServiceRelativePath OPTIONAL)
|
|
||||||
{
|
|
||||||
ULONG Length;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
UNICODE_STRING ServiceKeyPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\");
|
|
||||||
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
|
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
|
||||||
|
|
||||||
/* calculate sizeof bus enum device extension */
|
|
||||||
Length = wcslen(BusIdentifier) * sizeof(WCHAR);
|
|
||||||
Length += sizeof(BUS_ENUM_DEVICE_EXTENSION);
|
|
||||||
|
|
||||||
BusDeviceExtension = AllocateItem(NonPagedPool, Length);
|
|
||||||
if (!BusDeviceExtension)
|
|
||||||
{
|
|
||||||
/* not enough memory */
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* zero device extension */
|
|
||||||
RtlZeroMemory(BusDeviceExtension, sizeof(BUS_ENUM_DEVICE_EXTENSION));
|
|
||||||
|
|
||||||
/* initialize bus device extension */
|
|
||||||
wcscpy(BusDeviceExtension->BusIdentifier, BusIdentifier);
|
|
||||||
|
|
||||||
/* allocate service path string */
|
|
||||||
Length = ServiceKeyPath.MaximumLength;
|
|
||||||
Length += BusDeviceObject->DriverObject->DriverExtension->ServiceKeyName.MaximumLength;
|
|
||||||
|
|
||||||
if (ServiceRelativePath)
|
|
||||||
{
|
|
||||||
/* relative path for devices */
|
|
||||||
Length += wcslen(ServiceRelativePath) + 2 * sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
BusDeviceExtension->ServicePath.Length = 0;
|
|
||||||
BusDeviceExtension->ServicePath.MaximumLength = Length;
|
|
||||||
BusDeviceExtension->ServicePath.Buffer = AllocateItem(NonPagedPool, Length);
|
|
||||||
|
|
||||||
if (!BusDeviceExtension->ServicePath.Buffer)
|
|
||||||
{
|
|
||||||
/* not enough memory */
|
|
||||||
FreeItem(BusDeviceExtension);
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlAppendUnicodeStringToString(&BusDeviceExtension->ServicePath, &ServiceKeyPath);
|
|
||||||
RtlAppendUnicodeStringToString(&BusDeviceExtension->ServicePath, &BusDeviceObject->DriverObject->DriverExtension->ServiceKeyName);
|
|
||||||
|
|
||||||
if (ServiceRelativePath)
|
|
||||||
{
|
|
||||||
RtlAppendUnicodeToString(&BusDeviceExtension->ServicePath, L"\\");
|
|
||||||
RtlAppendUnicodeToString(&BusDeviceExtension->ServicePath, ServiceRelativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InterfaceGuid)
|
|
||||||
{
|
|
||||||
/* register an device interface */
|
|
||||||
Status = IoRegisterDeviceInterface(PhysicalDeviceObject, InterfaceGuid, NULL, &BusDeviceExtension->SymbolicLinkName);
|
|
||||||
|
|
||||||
/* check for success */
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
FreeItem(BusDeviceExtension->ServicePath.Buffer);
|
|
||||||
FreeItem(BusDeviceExtension);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now enable device interface */
|
|
||||||
Status = IoSetDeviceInterfaceState(&BusDeviceExtension->SymbolicLinkName, TRUE);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
FreeItem(BusDeviceExtension->ServicePath.Buffer);
|
|
||||||
FreeItem(BusDeviceExtension);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set state enabled */
|
|
||||||
BusDeviceExtension->Enabled = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* store device objects */
|
|
||||||
BusDeviceExtension->BusDeviceObject = BusDeviceObject;
|
|
||||||
BusDeviceExtension->PnpDeviceObject = PnpDeviceObject;
|
|
||||||
BusDeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
|
|
||||||
|
|
||||||
if (!PnpDeviceObject)
|
|
||||||
{
|
|
||||||
BusDeviceExtension->PnpDeviceObject = IoAttachDeviceToDeviceStack(BusDeviceObject, PhysicalDeviceObject);
|
|
||||||
|
|
||||||
if (!BusDeviceExtension->PnpDeviceObject)
|
|
||||||
{
|
|
||||||
/* failed to attach device */
|
|
||||||
if (BusDeviceExtension->Enabled)
|
|
||||||
{
|
|
||||||
IoSetDeviceInterfaceState(&BusDeviceExtension->SymbolicLinkName, FALSE);
|
|
||||||
RtlFreeUnicodeString(&BusDeviceExtension->SymbolicLinkName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free device extension */
|
|
||||||
FreeItem(BusDeviceExtension->ServicePath.Buffer);
|
|
||||||
FreeItem(BusDeviceExtension);
|
|
||||||
|
|
||||||
return STATUS_DEVICE_REMOVED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* attach device extension */
|
|
||||||
DeviceExtension = (PDEVICE_EXTENSION)BusDeviceObject->DeviceExtension;
|
|
||||||
DeviceExtension->DeviceHeader = (PKSIDEVICE_HEADER)BusDeviceExtension;
|
|
||||||
|
|
||||||
/* FIXME scan bus and invalidate device relations */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KspSetGetBusDataCompletion(
|
KspSetGetBusDataCompletion(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
|
@ -1979,47 +1851,6 @@ KsDeviceRegisterAdapterObject(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsGetBusEnumIdentifier(
|
|
||||||
IN PIRP Irp)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsGetBusEnumParentFDOFromChildPDO(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
OUT PDEVICE_OBJECT *FunctionalDeviceObject)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsGetBusEnumPnpDeviceObject(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PDEVICE_OBJECT *PnpDeviceObject)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@implemented
|
@implemented
|
||||||
|
@ -2061,33 +1892,6 @@ KsGetNextSibling(
|
||||||
return (PVOID)BasicHeader->Next.Pin;
|
return (PVOID)BasicHeader->Next.Pin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsInstallBusEnumInterface(
|
|
||||||
PIRP Irp)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsIsBusEnumChildDevice(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
OUT PBOOLEAN ChildDevice)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
KspCountMethodSets(
|
KspCountMethodSets(
|
||||||
IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL,
|
IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL,
|
||||||
|
@ -2598,104 +2402,6 @@ cleanup:
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsServiceBusEnumCreateRequest(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN OUT PIRP Irp)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsServiceBusEnumPnpRequest(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN OUT PIRP Irp)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
KspRemoveBusInterface(
|
|
||||||
PVOID Ctx)
|
|
||||||
{
|
|
||||||
PKSREMOVE_BUS_INTERFACE_CTX Context =(PKSREMOVE_BUS_INTERFACE_CTX)Ctx;
|
|
||||||
|
|
||||||
/* TODO
|
|
||||||
* get SWENUM_INSTALL_INTERFACE struct
|
|
||||||
* open device key and delete the keys
|
|
||||||
*/
|
|
||||||
|
|
||||||
UNIMPLEMENTED
|
|
||||||
|
|
||||||
/* set status */
|
|
||||||
Context->Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
|
||||||
|
|
||||||
/* signal completion */
|
|
||||||
KeSetEvent(&Context->Event, IO_NO_INCREMENT, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@unimplemented
|
|
||||||
*/
|
|
||||||
KSDDKAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
KsRemoveBusEnumInterface(
|
|
||||||
IN PIRP Irp)
|
|
||||||
{
|
|
||||||
KPROCESSOR_MODE Mode;
|
|
||||||
LUID luid;
|
|
||||||
KSREMOVE_BUS_INTERFACE_CTX Ctx;
|
|
||||||
WORK_QUEUE_ITEM WorkItem;
|
|
||||||
|
|
||||||
/* get previous mode */
|
|
||||||
Mode = ExGetPreviousMode();
|
|
||||||
|
|
||||||
/* convert to luid */
|
|
||||||
luid = RtlConvertUlongToLuid(SE_LOAD_DRIVER_PRIVILEGE);
|
|
||||||
|
|
||||||
/* perform access check */
|
|
||||||
if (!SeSinglePrivilegeCheck(luid, Mode))
|
|
||||||
{
|
|
||||||
/* insufficient privileges */
|
|
||||||
return STATUS_PRIVILEGE_NOT_HELD;
|
|
||||||
}
|
|
||||||
/* initialize event */
|
|
||||||
KeInitializeEvent(&Ctx.Event, NotificationEvent, FALSE);
|
|
||||||
|
|
||||||
/* store irp in ctx */
|
|
||||||
Ctx.Irp = Irp;
|
|
||||||
|
|
||||||
/* initialize work item */
|
|
||||||
ExInitializeWorkItem(&WorkItem, KspRemoveBusInterface, (PVOID)&Ctx);
|
|
||||||
|
|
||||||
/* now queue the work item */
|
|
||||||
ExQueueWorkItem(&WorkItem, DelayedWorkQueue);
|
|
||||||
|
|
||||||
/* wait for completion */
|
|
||||||
KeWaitForSingleObject(&Ctx.Event, Executive, KernelMode, FALSE, NULL);
|
|
||||||
|
|
||||||
/* return result */
|
|
||||||
return Ctx.Irp->IoStatus.Status;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -339,7 +339,7 @@ IKsClock_DispatchDeviceIoControl(
|
||||||
|
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ IKsClock_DispatchClose(
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,8 +282,6 @@ IKsDevice_PnpStartDevice(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCM_RESOURCE_LIST TranslatedResourceList;
|
PCM_RESOURCE_LIST TranslatedResourceList;
|
||||||
PCM_RESOURCE_LIST UntranslatedResourceList;
|
PCM_RESOURCE_LIST UntranslatedResourceList;
|
||||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor, UnPartialDescriptor;
|
|
||||||
ULONG Index;
|
|
||||||
|
|
||||||
/* get current stack location */
|
/* get current stack location */
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
@ -302,42 +300,14 @@ IKsDevice_PnpStartDevice(
|
||||||
{
|
{
|
||||||
DPRINT1("NextDevice object failed to start with %x\n", Status);
|
DPRINT1("NextDevice object failed to start with %x\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResourcesTranslated;
|
TranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResourcesTranslated;
|
||||||
UntranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResources;
|
UntranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResources;
|
||||||
|
|
||||||
DPRINT("ResourceDescriptorCount %lu\n", TranslatedResourceList->List[0].PartialResourceList.Count);
|
|
||||||
for (Index = 0; Index < TranslatedResourceList->List[0].PartialResourceList.Count; Index ++ )
|
|
||||||
{
|
|
||||||
PartialDescriptor = &TranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
|
|
||||||
UnPartialDescriptor = &UntranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
|
|
||||||
DPRINT("Descriptor Type %u\n", PartialDescriptor->Type);
|
|
||||||
|
|
||||||
if (PartialDescriptor->Type == CmResourceTypeInterrupt)
|
|
||||||
{
|
|
||||||
DPRINT("CmResourceTypeInterrupt Index %u TRANS Interrupt Number Affinity %x Level %u Vector %u Flags %x Share %x\n", Index, PartialDescriptor->u.Interrupt.Affinity, PartialDescriptor->u.Interrupt.Level, PartialDescriptor->u.Interrupt.Vector, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
|
|
||||||
DPRINT("CmResourceTypeInterrupt Index %u UNTRANS Interrupt Number Affinity %x Level %u Vector %u Flags %x Share %x\\n", Index, UnPartialDescriptor->u.Interrupt.Affinity, UnPartialDescriptor->u.Interrupt.Level, UnPartialDescriptor->u.Interrupt.Vector, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (PartialDescriptor->Type == CmResourceTypePort)
|
|
||||||
{
|
|
||||||
DPRINT("CmResourceTypePort Index %u TRANS Port Length %u Start %u %u Flags %x Share %x\n", Index, PartialDescriptor->u.Port.Length, PartialDescriptor->u.Port.Start.HighPart, PartialDescriptor->u.Port.Start.LowPart, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
|
|
||||||
DPRINT("CmResourceTypePort Index %u UNTRANS Port Length %u Start %u %u Flags %x Share %x\n", Index, UnPartialDescriptor->u.Port.Length, UnPartialDescriptor->u.Port.Start.HighPart, UnPartialDescriptor->u.Port.Start.LowPart, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
|
|
||||||
}
|
|
||||||
else if (PartialDescriptor->Type == CmResourceTypeMemory)
|
|
||||||
{
|
|
||||||
DPRINT("CmResourceTypeMemory Index %u TRANS Start %x Length %u Flags %x Share %x\n", Index, PartialDescriptor->u.Memory.Start.LowPart, PartialDescriptor->u.Memory.Length, PartialDescriptor->Flags, PartialDescriptor->ShareDisposition);
|
|
||||||
DPRINT("CmResourceTypeMemory Index %u TRANS Start %x Length %u Flags %x Share %x\n", Index, UnPartialDescriptor->u.Memory.Start.LowPart, UnPartialDescriptor->u.Memory.Length, UnPartialDescriptor->Flags, UnPartialDescriptor->ShareDisposition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(DeviceHeader->KsDevice.Descriptor);
|
ASSERT(DeviceHeader->KsDevice.Descriptor);
|
||||||
ASSERT(DeviceHeader->KsDevice.Descriptor->Dispatch);
|
|
||||||
ASSERT(DeviceHeader->KsDevice.Descriptor->Dispatch->Start);
|
|
||||||
|
|
||||||
|
|
||||||
/* do we have a device descriptor */
|
/* do we have a device descriptor */
|
||||||
if (DeviceHeader->KsDevice.Descriptor)
|
if (DeviceHeader->KsDevice.Descriptor)
|
||||||
|
@ -361,7 +331,7 @@ IKsDevice_PnpStartDevice(
|
||||||
{
|
{
|
||||||
DPRINT1("Driver: failed to start %x\n", Status);
|
DPRINT1("Driver: failed to start %x\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,12 +376,17 @@ IKsDevice_PnpStartDevice(
|
||||||
Status = KspSetFilterFactoriesState(DeviceHeader, TRUE);
|
Status = KspSetFilterFactoriesState(DeviceHeader, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* set state to run */
|
||||||
|
DeviceHeader->KsDevice.Started = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store result */
|
/* store result */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
/* complete request */
|
/* complete request */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
if (Ctx)
|
if (Ctx)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +395,7 @@ IKsDevice_PnpStartDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return result */
|
/* return result */
|
||||||
DPRINT1("IKsDevice_PnpStartDevice Status %x PostStartRoutine %p\n", Status, Ctx);
|
DPRINT("IKsDevice_PnpStartDevice Status %x PostStartRoutine %p\n", Status, Ctx);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +452,7 @@ IKsDevice_Pnp(
|
||||||
{
|
{
|
||||||
DPRINT1("Driver: query stop failed %x\n", Status);
|
DPRINT1("Driver: query stop failed %x\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +462,7 @@ IKsDevice_Pnp(
|
||||||
DPRINT("Next Device: Status %x\n", Status);
|
DPRINT("Next Device: Status %x\n", Status);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +488,7 @@ IKsDevice_Pnp(
|
||||||
|
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_INTERFACE:
|
case IRP_MN_QUERY_INTERFACE:
|
||||||
|
@ -536,7 +511,7 @@ IKsDevice_Pnp(
|
||||||
/* driver supports a private interface */
|
/* driver supports a private interface */
|
||||||
DPRINT1("IRP_MN_QUERY_INTERFACE Device supports interface\n");
|
DPRINT1("IRP_MN_QUERY_INTERFACE Device supports interface\n");
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +520,7 @@ IKsDevice_Pnp(
|
||||||
|
|
||||||
DPRINT1("IRP_MN_QUERY_INTERFACE Next Device: Status %x\n", Status);
|
DPRINT1("IRP_MN_QUERY_INTERFACE Next Device: Status %x\n", Status);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
|
@ -556,7 +531,7 @@ IKsDevice_Pnp(
|
||||||
DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS Next Device: Status %x\n", Status);
|
DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS Next Device: Status %x\n", Status);
|
||||||
|
|
||||||
//Irp->IoStatus.Status = Status;
|
//Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
|
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
|
||||||
|
@ -567,7 +542,7 @@ IKsDevice_Pnp(
|
||||||
DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
|
DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
|
||||||
|
|
||||||
//Irp->IoStatus.Status = Status;
|
//Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
||||||
|
@ -578,7 +553,7 @@ IKsDevice_Pnp(
|
||||||
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
|
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS Next Device: Status %x\n", Status);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -587,7 +562,7 @@ IKsDevice_Pnp(
|
||||||
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
|
Status = KspForwardIrpSynchronous(DeviceObject, Irp);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,7 +579,7 @@ IKsDevice_Power(
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -669,17 +644,10 @@ IKsDevice_Create(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* acquire list lock */
|
/* release list lock */
|
||||||
IKsDevice_fnReleaseDevice((IKsDevice*)&DeviceHeader->BasicHeader.OuterUnknown);
|
IKsDevice_fnReleaseDevice((IKsDevice*)&DeviceHeader->BasicHeader.OuterUnknown);
|
||||||
|
|
||||||
if (Status != STATUS_PENDING)
|
/* done */
|
||||||
{
|
|
||||||
Irp->IoStatus.Information = 0;
|
|
||||||
/* set return status */
|
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
|
|
||||||
|
@ -703,7 +671,7 @@ KsInitializeDevice(
|
||||||
PKSIOBJECT_BAG Bag;
|
PKSIOBJECT_BAG Bag;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
DPRINT("KsInitializeDevice Descriptor %p\n", Descriptor);
|
DPRINT1("KsInitializeDevice Descriptor %p\n", Descriptor);
|
||||||
|
|
||||||
/* get device extension */
|
/* get device extension */
|
||||||
DeviceExtension = (PDEVICE_EXTENSION)FunctionalDeviceObject->DeviceExtension;
|
DeviceExtension = (PDEVICE_EXTENSION)FunctionalDeviceObject->DeviceExtension;
|
||||||
|
@ -714,7 +682,7 @@ KsInitializeDevice(
|
||||||
/* point to allocated header */
|
/* point to allocated header */
|
||||||
Header = DeviceExtension->DeviceHeader;
|
Header = DeviceExtension->DeviceHeader;
|
||||||
|
|
||||||
DPRINT("DeviceHeader %p\n", DeviceExtension->DeviceHeader);
|
DPRINT1("DeviceHeader %p\n", DeviceExtension->DeviceHeader);
|
||||||
|
|
||||||
if (Descriptor && Descriptor->Dispatch)
|
if (Descriptor && Descriptor->Dispatch)
|
||||||
{
|
{
|
||||||
|
@ -896,7 +864,7 @@ KsDereferenceSoftwareBusObject(
|
||||||
IKsDevice * Device;
|
IKsDevice * Device;
|
||||||
PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
|
PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
|
||||||
|
|
||||||
DPRINT1("KsDereferenceSoftwareBusObject DeviceHeader %p\n", Header);
|
DPRINT("KsDereferenceSoftwareBusObject DeviceHeader %p\n", Header);
|
||||||
|
|
||||||
/* get device interface */
|
/* get device interface */
|
||||||
Device = (IKsDevice*)DeviceHeader->BasicHeader.OuterUnknown;
|
Device = (IKsDevice*)DeviceHeader->BasicHeader.OuterUnknown;
|
||||||
|
|
|
@ -16,6 +16,7 @@ typedef struct
|
||||||
|
|
||||||
IKsControlVtbl *lpVtblKsControl;
|
IKsControlVtbl *lpVtblKsControl;
|
||||||
IKsFilterFactory * FilterFactory;
|
IKsFilterFactory * FilterFactory;
|
||||||
|
IKsProcessingObjectVtbl * lpVtblKsProcessingObject;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
PKSIOBJECT_HEADER ObjectHeader;
|
PKSIOBJECT_HEADER ObjectHeader;
|
||||||
|
@ -25,6 +26,9 @@ typedef struct
|
||||||
KMUTEX ControlMutex;
|
KMUTEX ControlMutex;
|
||||||
KMUTEX ProcessingMutex;
|
KMUTEX ProcessingMutex;
|
||||||
|
|
||||||
|
PKSWORKER Worker;
|
||||||
|
WORK_QUEUE_ITEM WorkItem;
|
||||||
|
KSGATE Gate;
|
||||||
|
|
||||||
PFNKSFILTERPOWER Sleep;
|
PFNKSFILTERPOWER Sleep;
|
||||||
PFNKSFILTERPOWER Wake;
|
PFNKSFILTERPOWER Wake;
|
||||||
|
@ -70,6 +74,196 @@ KSPROPERTY_SET FilterPropertySet[] =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnQueryInterface(
|
||||||
|
IKsProcessingObject * iface,
|
||||||
|
IN REFIID refiid,
|
||||||
|
OUT PVOID* Output)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
if (IsEqualGUIDAligned(refiid, &IID_IUnknown))
|
||||||
|
{
|
||||||
|
*Output = &This->Header.OuterUnknown;
|
||||||
|
_InterlockedIncrement(&This->ref);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnAddRef(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
return InterlockedIncrement(&This->ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnRelease(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
/* Return new reference count */
|
||||||
|
return This->ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnProcessingObjectWork(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
LARGE_INTEGER TimeOut;
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
DPRINT1("processing object\n");
|
||||||
|
/* first check if running at passive level */
|
||||||
|
if (KeGetCurrentIrql() == PASSIVE_LEVEL)
|
||||||
|
{
|
||||||
|
/* acquire processing mutex */
|
||||||
|
KeWaitForSingleObject(&This->ControlMutex, Executive, KernelMode, FALSE, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* dispatch level processing */
|
||||||
|
if (KeReadStateMutex(&This->ControlMutex) == 0)
|
||||||
|
{
|
||||||
|
/* some thread was faster */
|
||||||
|
DPRINT1("processing object too slow\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* acquire processing mutex */
|
||||||
|
TimeOut.QuadPart = 0LL;
|
||||||
|
Status = KeWaitForSingleObject(&This->ControlMutex, Executive, KernelMode, FALSE, &TimeOut);
|
||||||
|
|
||||||
|
if (Status == STATUS_TIMEOUT)
|
||||||
|
{
|
||||||
|
/* some thread was faster */
|
||||||
|
DPRINT1("processing object too slow\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
/* check if the and-gate has been enabled again */
|
||||||
|
if (&This->Gate.Count != 0)
|
||||||
|
{
|
||||||
|
/* gate is open */
|
||||||
|
DPRINT1("processing object gate open\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT1("IKsProcessingObject_fnProcessingObjectWork not implemented\n");
|
||||||
|
ASSERT(0);
|
||||||
|
|
||||||
|
}while(TRUE);
|
||||||
|
|
||||||
|
/* release process mutex */
|
||||||
|
KeReleaseMutex(&This->ProcessingMutex, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
PKSGATE
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnGetAndGate(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
/* return and gate */
|
||||||
|
return &This->Gate;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnProcess(
|
||||||
|
IKsProcessingObject * iface,
|
||||||
|
IN BOOLEAN Asynchronous)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
/* should the action be asynchronous */
|
||||||
|
if (Asynchronous)
|
||||||
|
{
|
||||||
|
/* queue work item */
|
||||||
|
KsQueueWorkItem(This->Worker, &This->WorkItem);
|
||||||
|
DPRINT1("queueing\n");
|
||||||
|
/* done */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* does the filter require explicit deferred processing */
|
||||||
|
if ((This->Filter.Descriptor->Flags & (KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING | KSFILTER_FLAG_CRITICAL_PROCESSING | KSFILTER_FLAG_HYPERCRITICAL_PROCESSING)) &&
|
||||||
|
KeGetCurrentIrql() > PASSIVE_LEVEL)
|
||||||
|
{
|
||||||
|
/* queue work item */
|
||||||
|
KsQueueWorkItem(This->Worker, &This->WorkItem);
|
||||||
|
DPRINT1("queueing\n");
|
||||||
|
/* done */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DPRINT1("invoke\n");
|
||||||
|
/* call worker routine directly */
|
||||||
|
iface->lpVtbl->ProcessingObjectWork(iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnReset(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(iface, IKsFilterImpl, lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
/* acquire processing mutex */
|
||||||
|
KeWaitForSingleObject(&This->ProcessingMutex, Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
|
/* check if the filter supports dispatch routines */
|
||||||
|
if (This->Filter.Descriptor->Dispatch)
|
||||||
|
{
|
||||||
|
/* has the filter a reset routine */
|
||||||
|
if (This->Filter.Descriptor->Dispatch->Reset)
|
||||||
|
{
|
||||||
|
/* reset filter */
|
||||||
|
This->Filter.Descriptor->Dispatch->Reset(&This->Filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* release process mutex */
|
||||||
|
KeReleaseMutex(&This->ProcessingMutex, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
IKsProcessingObject_fnTriggerNotification(
|
||||||
|
IKsProcessingObject * iface)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static IKsProcessingObjectVtbl vt_IKsProcessingObject =
|
||||||
|
{
|
||||||
|
IKsProcessingObject_fnQueryInterface,
|
||||||
|
IKsProcessingObject_fnAddRef,
|
||||||
|
IKsProcessingObject_fnRelease,
|
||||||
|
IKsProcessingObject_fnProcessingObjectWork,
|
||||||
|
IKsProcessingObject_fnGetAndGate,
|
||||||
|
IKsProcessingObject_fnProcess,
|
||||||
|
IKsProcessingObject_fnReset,
|
||||||
|
IKsProcessingObject_fnTriggerNotification
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
IKsControl_fnQueryInterface(
|
IKsControl_fnQueryInterface(
|
||||||
|
@ -485,7 +679,7 @@ IKsFilter_GetFilterFromIrp(
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
||||||
/* complete and forget irp */
|
/* complete and forget irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -522,7 +716,7 @@ IKsFilter_DispatchClose(
|
||||||
/* save the result */
|
/* save the result */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
/* complete irp */
|
/* complete irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
/* remove our instance from the filter factory */
|
/* remove our instance from the filter factory */
|
||||||
IKsFilter_RemoveFilterFromFilterFactory(This, This->Factory);
|
IKsFilter_RemoveFilterFromFilterFactory(This, This->Factory);
|
||||||
|
@ -535,7 +729,7 @@ IKsFilter_DispatchClose(
|
||||||
/* complete and forget */
|
/* complete and forget */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
/* complete irp */
|
/* complete irp */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
@ -881,7 +1075,7 @@ IKsFilter_DispatchDeviceIoControl(
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
@ -1227,7 +1421,7 @@ IKsFilter_DispatchCreatePin(
|
||||||
{
|
{
|
||||||
/* complete request */
|
/* complete request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
@ -1243,7 +1437,7 @@ IKsFilter_DispatchCreateNode(
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1356,6 +1550,20 @@ IKsFilter_RemoveFilterFromFilterFactory(
|
||||||
}while(TRUE);
|
}while(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
IKsFilter_FilterCentricWorker(
|
||||||
|
IN PVOID Ctx)
|
||||||
|
{
|
||||||
|
IKsProcessingObject * Object = (IKsProcessingObject*)Ctx;
|
||||||
|
|
||||||
|
/* sanity check */
|
||||||
|
ASSERT(Object);
|
||||||
|
|
||||||
|
/* perform work */
|
||||||
|
Object->lpVtbl->ProcessingObjectWork(Object);
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
KspCreateFilter(
|
KspCreateFilter(
|
||||||
|
@ -1377,17 +1585,27 @@ KspCreateFilter(
|
||||||
/* get the filter factory */
|
/* get the filter factory */
|
||||||
Factory = iface->lpVtbl->GetStruct(iface);
|
Factory = iface->lpVtbl->GetStruct(iface);
|
||||||
|
|
||||||
if (!Factory || !Factory->FilterDescriptor || !Factory->FilterDescriptor->Dispatch || !Factory->FilterDescriptor->Dispatch->Create)
|
if (!Factory || !Factory->FilterDescriptor)
|
||||||
{
|
{
|
||||||
/* Sorry it just will not work */
|
/* Sorry it just will not work */
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Factory->FilterDescriptor->Flags & KSFILTER_FLAG_DENY_USERMODE_ACCESS)
|
||||||
|
{
|
||||||
|
if (Irp->RequestorMode == UserMode)
|
||||||
|
{
|
||||||
|
/* filter not accessible from user mode */
|
||||||
|
DPRINT1("Access denied\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate filter instance */
|
/* allocate filter instance */
|
||||||
This = AllocateItem(NonPagedPool, sizeof(IKsFilterImpl));
|
This = AllocateItem(NonPagedPool, sizeof(IKsFilterImpl));
|
||||||
if (!This)
|
if (!This)
|
||||||
{
|
{
|
||||||
DPRINT("KspCreateFilter OutOfMemory\n");
|
DPRINT1("KspCreateFilter OutOfMemory\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,7 +1615,7 @@ KspCreateFilter(
|
||||||
{
|
{
|
||||||
/* no memory */
|
/* no memory */
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
DPRINT("KspCreateFilter OutOfMemory\n");
|
DPRINT1("KspCreateFilter OutOfMemory\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
|
KsDevice = (IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
|
||||||
|
@ -1424,12 +1642,10 @@ KspCreateFilter(
|
||||||
/* no memory */
|
/* no memory */
|
||||||
FreeItem(This->Filter.Bag);
|
FreeItem(This->Filter.Bag);
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
DPRINT("KspCreateFilter OutOfMemory\n");
|
DPRINT1("KspCreateFilter OutOfMemory\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("KspCreateFilter Flags %lx\n", Factory->FilterDescriptor->Flags);
|
|
||||||
|
|
||||||
/* initialize pin create item */
|
/* initialize pin create item */
|
||||||
CreateItem[0].Create = IKsFilter_DispatchCreatePin;
|
CreateItem[0].Create = IKsFilter_DispatchCreatePin;
|
||||||
CreateItem[0].Context = (PVOID)This;
|
CreateItem[0].Context = (PVOID)This;
|
||||||
|
@ -1446,11 +1662,13 @@ KspCreateFilter(
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
This->Header.OuterUnknown = (PUNKNOWN)&vt_IKsFilter;
|
This->Header.OuterUnknown = (PUNKNOWN)&vt_IKsFilter;
|
||||||
This->lpVtblKsControl = &vt_IKsControl;
|
This->lpVtblKsControl = &vt_IKsControl;
|
||||||
|
This->lpVtblKsProcessingObject = &vt_IKsProcessingObject;
|
||||||
|
|
||||||
This->Factory = Factory;
|
This->Factory = Factory;
|
||||||
This->FilterFactory = iface;
|
This->FilterFactory = iface;
|
||||||
This->FileObject = IoStack->FileObject;
|
This->FileObject = IoStack->FileObject;
|
||||||
KeInitializeMutex(&This->ProcessingMutex, 0);
|
KeInitializeMutex(&This->ProcessingMutex, 0);
|
||||||
|
|
||||||
/* initialize basic header */
|
/* initialize basic header */
|
||||||
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);
|
||||||
|
@ -1460,17 +1678,39 @@ KspCreateFilter(
|
||||||
InitializeListHead(&This->Header.EventList);
|
InitializeListHead(&This->Header.EventList);
|
||||||
KeInitializeSpinLock(&This->Header.EventListLock);
|
KeInitializeSpinLock(&This->Header.EventListLock);
|
||||||
|
|
||||||
|
/* initialize and gate */
|
||||||
|
KsGateInitializeAnd(&This->Gate, NULL);
|
||||||
|
|
||||||
|
/* FIXME initialize and gate based on pin flags */
|
||||||
|
|
||||||
|
/* initialize work item */
|
||||||
|
ExInitializeWorkItem(&This->WorkItem, IKsFilter_FilterCentricWorker, (PVOID)This->lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
/* allocate counted work item */
|
||||||
|
Status = KsRegisterCountedWorker(HyperCriticalWorkQueue, &This->WorkItem, &This->Worker);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* what can go wrong, goes wrong */
|
||||||
|
DPRINT1("KsRegisterCountedWorker failed with %lx\n", Status);
|
||||||
|
FreeItem(This);
|
||||||
|
FreeItem(CreateItem);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate the stream descriptors */
|
/* allocate the stream descriptors */
|
||||||
Status = IKsFilter_CreateDescriptors(This, (PKSFILTER_DESCRIPTOR)Factory->FilterDescriptor);
|
Status = IKsFilter_CreateDescriptors(This, (PKSFILTER_DESCRIPTOR)Factory->FilterDescriptor);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* what can go wrong, goes wrong */
|
/* what can go wrong, goes wrong */
|
||||||
|
DPRINT1("IKsFilter_CreateDescriptors failed with %lx\n", Status);
|
||||||
|
KsUnregisterWorker(This->Worker);
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
FreeItem(CreateItem);
|
FreeItem(CreateItem);
|
||||||
DPRINT("IKsFilter_CreateDescriptors failed with %lx\n", Status);
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* does the filter have a filter dispatch */
|
/* does the filter have a filter dispatch */
|
||||||
if (Factory->FilterDescriptor->Dispatch)
|
if (Factory->FilterDescriptor->Dispatch)
|
||||||
{
|
{
|
||||||
|
@ -1489,6 +1729,7 @@ KspCreateFilter(
|
||||||
DPRINT1("Driver: Status %x\n", Status);
|
DPRINT1("Driver: Status %x\n", Status);
|
||||||
|
|
||||||
/* free filter instance */
|
/* free filter instance */
|
||||||
|
KsUnregisterWorker(This->Worker);
|
||||||
FreeItem(This);
|
FreeItem(This);
|
||||||
FreeItem(CreateItem);
|
FreeItem(CreateItem);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1515,7 +1756,7 @@ KspCreateFilter(
|
||||||
IKsFilter_AttachFilterToFilterFactory(This, This->Header.Parent.KsFilterFactory);
|
IKsFilter_AttachFilterToFilterFactory(This, This->Header.Parent.KsFilterFactory);
|
||||||
|
|
||||||
/* completed initialization */
|
/* completed initialization */
|
||||||
DPRINT("KspCreateFilter done %lx KsDevice %p\n", Status, This->Header.KsDevice);
|
DPRINT1("KspCreateFilter done %lx KsDevice %p\n", Status, This->Header.KsDevice);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1599,7 +1840,7 @@ KsFilterAddTopologyConnections (
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
KSDDKAPI
|
KSDDKAPI
|
||||||
VOID
|
VOID
|
||||||
|
@ -1608,7 +1849,20 @@ KsFilterAttemptProcessing(
|
||||||
IN PKSFILTER Filter,
|
IN PKSFILTER Filter,
|
||||||
IN BOOLEAN Asynchronous)
|
IN BOOLEAN Asynchronous)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PKSGATE Gate;
|
||||||
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter);
|
||||||
|
|
||||||
|
/* get gate */
|
||||||
|
Gate = This->lpVtblKsProcessingObject->GetAndGate((IKsProcessingObject*)This->lpVtblKsProcessingObject);
|
||||||
|
|
||||||
|
if (!KsGateCaptureThreshold(Gate))
|
||||||
|
{
|
||||||
|
/* filter control gate is closed */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DPRINT1("processing\n");
|
||||||
|
/* try initiate processing */
|
||||||
|
This->lpVtblKsProcessingObject->Process((IKsProcessingObject*)This->lpVtblKsProcessingObject, Asynchronous);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1710,8 +1964,10 @@ NTAPI
|
||||||
KsFilterGetAndGate(
|
KsFilterGetAndGate(
|
||||||
IN PKSFILTER Filter)
|
IN PKSFILTER Filter)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
IKsFilterImpl * This = (IKsFilterImpl*)CONTAINING_RECORD(Filter, IKsFilterImpl, Filter);
|
||||||
return NULL;
|
|
||||||
|
/* return and-gate */
|
||||||
|
return &This->Gate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -69,7 +69,7 @@ IKsFilterFactory_Create(
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -34,7 +34,7 @@ KsDispatchQuerySecurity(
|
||||||
{
|
{
|
||||||
/* no create item */
|
/* no create item */
|
||||||
Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
|
Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_NO_SECURITY_ON_OBJECT;
|
return STATUS_NO_SECURITY_ON_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ KsDispatchQuerySecurity(
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = Length;
|
Irp->IoStatus.Information = Length;
|
||||||
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ KsDispatchSetSecurity(
|
||||||
{
|
{
|
||||||
/* no create item */
|
/* no create item */
|
||||||
Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
|
Irp->IoStatus.Status = STATUS_NO_SECURITY_ON_OBJECT;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_NO_SECURITY_ON_OBJECT;
|
return STATUS_NO_SECURITY_ON_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ KsDispatchSetSecurity(
|
||||||
|
|
||||||
/* store result */
|
/* store result */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1154,7 @@ KsDispatchInvalidDeviceRequest(
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
@ -1198,7 +1198,7 @@ KsDefaultDeviceIoCompletion(
|
||||||
|
|
||||||
/* complete request */
|
/* complete request */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1643,14 +1643,15 @@ KsAddIrpToCancelableQueue(
|
||||||
/* get current irp stack */
|
/* get current irp stack */
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
DPRINT("KsAddIrpToCancelableQueue QueueHead %p SpinLock %p Irp %p ListLocation %x DriverCancel %p\n", QueueHead, SpinLock, Irp, ListLocation, DriverCancel);
|
DPRINT1("KsAddIrpToCancelableQueue QueueHead %p SpinLock %p Irp %p ListLocation %x DriverCancel %p\n", QueueHead, SpinLock, Irp, ListLocation, DriverCancel);
|
||||||
|
|
||||||
// HACK for ms portcls
|
// HACK for ms portcls
|
||||||
if (IoStack->MajorFunction == IRP_MJ_CREATE)
|
if (IoStack->MajorFunction == IRP_MJ_CREATE)
|
||||||
{
|
{
|
||||||
// complete the request
|
// complete the request
|
||||||
|
DPRINT1("MS HACK\n");
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1736,7 +1737,7 @@ KsCancelRoutine(
|
||||||
{
|
{
|
||||||
/* let's complete it */
|
/* let's complete it */
|
||||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1795,14 +1796,12 @@ FindMatchingCreateItem(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(CreateItemEntry->CreateItem->ObjectClass.Buffer);
|
|
||||||
|
|
||||||
DPRINT("CreateItem %S Length %u Request %wZ %u\n", CreateItemEntry->CreateItem->ObjectClass.Buffer,
|
DPRINT("CreateItem %S Length %u Request %wZ %u\n", CreateItemEntry->CreateItem->ObjectClass.Buffer,
|
||||||
CreateItemEntry->CreateItem->ObjectClass.Length,
|
CreateItemEntry->CreateItem->ObjectClass.Length,
|
||||||
&RefString,
|
&RefString,
|
||||||
BufferSize);
|
RefString.Length);
|
||||||
|
|
||||||
if (CreateItemEntry->CreateItem->ObjectClass.Length > BufferSize)
|
if (CreateItemEntry->CreateItem->ObjectClass.Length > RefString.Length)
|
||||||
{
|
{
|
||||||
/* create item doesnt match in length */
|
/* create item doesnt match in length */
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
|
@ -1853,7 +1852,7 @@ KspCreate(
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
/* set return status */
|
/* set return status */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,7 +1892,7 @@ KspCreate(
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
/* set return status */
|
/* set return status */
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1929,7 +1928,7 @@ KspDispatchIrp(
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
/* complete and forget */
|
/* complete and forget */
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2036,6 +2035,7 @@ KsDispatchIrp(
|
||||||
|
|
||||||
/* get device extension */
|
/* get device extension */
|
||||||
DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
/* get device header */
|
/* get device header */
|
||||||
DeviceHeader = DeviceExtension->DeviceHeader;
|
DeviceHeader = DeviceExtension->DeviceHeader;
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,5 @@
|
||||||
<file>unknown.c</file>
|
<file>unknown.c</file>
|
||||||
<file>worker.c</file>
|
<file>worker.c</file>
|
||||||
<file>kcom.c</file>
|
<file>kcom.c</file>
|
||||||
|
<file>swenum.c</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -6,6 +6,13 @@
|
||||||
#define TAG_KSDEVICE 'DESK'
|
#define TAG_KSDEVICE 'DESK'
|
||||||
#define TAG_KSOBJECT_TAG 'HOSK'
|
#define TAG_KSOBJECT_TAG 'HOSK'
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CompleteRequest(
|
||||||
|
PIRP Irp,
|
||||||
|
CCHAR PriorityBoost);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
KspCreateObjectType(
|
KspCreateObjectType(
|
||||||
|
|
|
@ -307,3 +307,34 @@ DECLARE_INTERFACE_(IKsDevice, IUnknown)
|
||||||
STDMETHOD_(NTSTATUS, CheckIoCapability)(THIS_
|
STDMETHOD_(NTSTATUS, CheckIoCapability)(THIS_
|
||||||
IN ULONG Unknown)PURE;
|
IN ULONG Unknown)PURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* IKsProcessingObject
|
||||||
|
*****************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef INTERFACE
|
||||||
|
#define INTERFACE IKsProcessingObject
|
||||||
|
|
||||||
|
DECLARE_INTERFACE_(IKsProcessingObject, IUnknown)
|
||||||
|
{
|
||||||
|
DEFINE_ABSTRACT_UNKNOWN()
|
||||||
|
|
||||||
|
STDMETHOD_(VOID, ProcessingObjectWork)(THIS) PURE;
|
||||||
|
|
||||||
|
STDMETHOD_(PKSGATE, GetAndGate)(THIS) PURE;
|
||||||
|
|
||||||
|
STDMETHOD_(VOID, Process)(THIS_
|
||||||
|
IN BOOLEAN Asynchronous)PURE;
|
||||||
|
|
||||||
|
STDMETHOD_(VOID, Reset)(THIS) PURE;
|
||||||
|
|
||||||
|
STDMETHOD_(VOID, TriggerNotification)(THIS) PURE;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,6 @@ typedef struct
|
||||||
PIO_WORKITEM WorkItem;
|
PIO_WORKITEM WorkItem;
|
||||||
}PNP_POSTSTART_CONTEXT, *PPNP_POSTSTART_CONTEXT;
|
}PNP_POSTSTART_CONTEXT, *PPNP_POSTSTART_CONTEXT;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
PIRP Irp;
|
|
||||||
KEVENT Event;
|
|
||||||
}KSREMOVE_BUS_INTERFACE_CTX, *PKSREMOVE_BUS_INTERFACE_CTX;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PLIST_ENTRY List;
|
PLIST_ENTRY List;
|
||||||
|
@ -150,20 +144,97 @@ typedef struct
|
||||||
|
|
||||||
typedef BOOLEAN (NTAPI *PKSEVENT_SYNCHRONIZED_ROUTINE)(PKSEVENT_CTX Context);
|
typedef BOOLEAN (NTAPI *PKSEVENT_SYNCHRONIZED_ROUTINE)(PKSEVENT_CTX Context);
|
||||||
|
|
||||||
|
struct __BUS_ENUM_DEVICE_EXTENSION__;
|
||||||
|
struct __BUS_DEVICE_ENTRY__;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
BOOLEAN Enabled;
|
LIST_ENTRY Entry;
|
||||||
|
ULONG IsBus;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT DeviceObject;
|
||||||
|
ULONG DeviceReferenceCount;
|
||||||
|
};
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct __BUS_DEVICE_ENTRY__* DeviceEntry;
|
||||||
|
ULONG Dummy1;
|
||||||
|
};
|
||||||
|
struct __BUS_ENUM_DEVICE_EXTENSION__ *BusDeviceExtension;
|
||||||
|
ULONG DeviceObjectReferenceCount;
|
||||||
|
}COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
||||||
|
|
||||||
PDEVICE_OBJECT PnpDeviceObject;
|
typedef struct
|
||||||
|
{
|
||||||
|
PCOMMON_DEVICE_EXTENSION Ext;
|
||||||
|
}DEV_EXTENSION, *PDEV_EXTENSION;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
LIST_ENTRY Entry;
|
||||||
|
GUID InterfaceGuid;
|
||||||
|
UNICODE_STRING SymbolicLink;
|
||||||
|
}BUS_INSTANCE_ENTRY, *PBUS_INSTANCE_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NotStarted = 0, // Not started yet
|
||||||
|
Started, // Device has received the START_DEVICE IRP
|
||||||
|
StopPending, // Device has received the QUERY_STOP IRP
|
||||||
|
Stopped, // Device has received the STOP_DEVICE IRP
|
||||||
|
RemovePending, // Device has received the QUERY_REMOVE IRP
|
||||||
|
SurpriseRemovePending, // Device has received the SURPRISE_REMOVE IRP
|
||||||
|
Deleted
|
||||||
|
}DEVICE_STATE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct __BUS_DEVICE_ENTRY__
|
||||||
|
{
|
||||||
|
LIST_ENTRY Entry;
|
||||||
|
LIST_ENTRY DeviceInterfaceList;
|
||||||
|
LIST_ENTRY IrpPendingList;
|
||||||
|
PDEVICE_OBJECT PDO;
|
||||||
|
DEVICE_STATE DeviceState;
|
||||||
|
GUID DeviceGuid;
|
||||||
|
LPWSTR PDODeviceName;
|
||||||
|
LPWSTR DeviceName;
|
||||||
|
LPWSTR BusId;
|
||||||
|
LARGE_INTEGER TimeCreated;
|
||||||
|
LARGE_INTEGER TimeExpired;
|
||||||
|
LPWSTR Instance;
|
||||||
|
}BUS_DEVICE_ENTRY, *PBUS_DEVICE_ENTRY;
|
||||||
|
|
||||||
|
typedef struct __BUS_ENUM_DEVICE_EXTENSION__
|
||||||
|
{
|
||||||
|
COMMON_DEVICE_EXTENSION Common;
|
||||||
|
KSPIN_LOCK Lock;
|
||||||
|
KEVENT Event;
|
||||||
|
UNICODE_STRING DeviceInterfaceLink;
|
||||||
PDEVICE_OBJECT PhysicalDeviceObject;
|
PDEVICE_OBJECT PhysicalDeviceObject;
|
||||||
|
PDEVICE_OBJECT PnpDeviceObject;
|
||||||
PDEVICE_OBJECT BusDeviceObject;
|
PDEVICE_OBJECT BusDeviceObject;
|
||||||
|
ULONG PdoCreated;
|
||||||
|
KTIMER Timer;
|
||||||
|
KDPC Dpc;
|
||||||
|
WORK_QUEUE_ITEM WorkItem;
|
||||||
|
ULONG DeviceAttached;
|
||||||
UNICODE_STRING ServicePath;
|
UNICODE_STRING ServicePath;
|
||||||
UNICODE_STRING SymbolicLinkName;
|
|
||||||
|
|
||||||
WCHAR BusIdentifier[1];
|
WCHAR BusIdentifier[1];
|
||||||
}BUS_ENUM_DEVICE_EXTENSION, *PBUS_ENUM_DEVICE_EXTENSION;
|
}BUS_ENUM_DEVICE_EXTENSION, *PBUS_ENUM_DEVICE_EXTENSION;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PIRP Irp;
|
||||||
|
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
|
||||||
|
KEVENT Event;
|
||||||
|
NTSTATUS Status;
|
||||||
|
WORK_QUEUE_ITEM WorkItem;
|
||||||
|
}BUS_INSTALL_ENUM_CONTEXT, *PBUS_INSTALL_ENUM_CONTEXT;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PUCHAR FilterData;
|
PUCHAR FilterData;
|
||||||
|
|
|
@ -9,6 +9,19 @@
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CompleteRequest(
|
||||||
|
PIRP Irp,
|
||||||
|
CCHAR PriorityBoost)
|
||||||
|
{
|
||||||
|
DPRINT("Completing IRP %p Status %x\n", Irp, Irp->IoStatus.Status);
|
||||||
|
|
||||||
|
ASSERT(Irp->IoStatus.Status != STATUS_PENDING);
|
||||||
|
|
||||||
|
|
||||||
|
IoCompleteRequest(Irp, PriorityBoost);
|
||||||
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
AllocateItem(
|
AllocateItem(
|
||||||
IN POOL_TYPE PoolType,
|
IN POOL_TYPE PoolType,
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ IKsPin_DispatchKsStream(
|
||||||
DPRINT1("KsProbeStreamIrp failed with %x\n", Status);
|
DPRINT1("KsProbeStreamIrp failed with %x\n", Status);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1888,7 +1888,7 @@ IKsPin_DispatchKsStream(
|
||||||
{
|
{
|
||||||
DPRINT("NoHeader Canceling Irp %p\n", Irp);
|
DPRINT("NoHeader Canceling Irp %p\n", Irp);
|
||||||
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
|
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1911,7 +1911,7 @@ IKsPin_DispatchKsStream(
|
||||||
{
|
{
|
||||||
DPRINT("NoHeader->Data Canceling Irp %p\n", Irp);
|
DPRINT("NoHeader->Data Canceling Irp %p\n", Irp);
|
||||||
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
|
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1960,7 +1960,7 @@ IKsPin_DispatchKsStream(
|
||||||
/* invalid device request */
|
/* invalid device request */
|
||||||
DPRINT("Filter Centric Processing No Process Routine\n");
|
DPRINT("Filter Centric Processing No Process Routine\n");
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2095,7 +2095,7 @@ IKsPin_DispatchDeviceIoControl(
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
@ -2135,7 +2135,7 @@ IKsPin_Close(
|
||||||
{
|
{
|
||||||
/* abort closing */
|
/* abort closing */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2145,7 +2145,7 @@ IKsPin_Close(
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2162,7 +2162,7 @@ IKsPin_DispatchCreateAllocator(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2244,7 +2244,7 @@ IKsPin_DispatchCreateClock(
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2257,7 +2257,7 @@ IKsPin_DispatchCreateNode(
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
CompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "ksmedia.h"
|
#include "ksmedia.h"
|
||||||
#include "bdamedia.h"
|
#include "bdamedia.h"
|
||||||
|
#include <swenum.h>
|
||||||
|
|
||||||
|
|
||||||
#define TAG_DEVICE_HEADER 'KSDH'
|
#define TAG_DEVICE_HEADER 'KSDH'
|
||||||
#define REG_PINFLAG_B_MANY 0x4 /* strmif.h */
|
#define REG_PINFLAG_B_MANY 0x4 /* strmif.h */
|
||||||
|
|
2174
reactos/drivers/ksfilter/ks/swenum.c
Normal file
2174
reactos/drivers/ksfilter/ks/swenum.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -18,8 +18,56 @@ SwDispatchPower(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Status, PnpStatus;
|
||||||
|
BOOLEAN ChildDevice;
|
||||||
|
PIO_STACK_LOCATION IoStack;
|
||||||
|
PDEVICE_OBJECT PnpDeviceObject = NULL;
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
/* get current stack location */
|
||||||
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
/* check if the device object is a child device */
|
||||||
|
Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice);
|
||||||
|
|
||||||
|
/* get bus enum pnp object */
|
||||||
|
PnpStatus = KsGetBusEnumPnpDeviceObject(DeviceObject, &PnpDeviceObject);
|
||||||
|
|
||||||
|
/* check for success */
|
||||||
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(PnpStatus))
|
||||||
|
{
|
||||||
|
/* start next power irp */
|
||||||
|
PoStartNextPowerIrp(Irp);
|
||||||
|
|
||||||
|
/* just complete the irp */
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* complete the irp */
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IoStack->MinorFunction == IRP_MN_SET_POWER || IoStack->MinorFunction == IRP_MN_QUERY_POWER)
|
||||||
|
{
|
||||||
|
/* fake success */
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ChildDevice)
|
||||||
|
{
|
||||||
|
/* forward to pnp device object */
|
||||||
|
PoStartNextPowerIrp(Irp);
|
||||||
|
|
||||||
|
/* skip current location */
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
return PoCallDriver(PnpDeviceObject, Irp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* start next power irp */
|
||||||
|
PoStartNextPowerIrp(Irp);
|
||||||
|
|
||||||
/* just complete the irp */
|
/* just complete the irp */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
@ -29,7 +77,6 @@ SwDispatchPower(
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -43,6 +90,9 @@ SwDispatchPnp(
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
PDEVICE_OBJECT PnpDeviceObject = NULL;
|
PDEVICE_OBJECT PnpDeviceObject = NULL;
|
||||||
|
|
||||||
|
/* get current stack location */
|
||||||
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
/* check if the device object is a child device */
|
/* check if the device object is a child device */
|
||||||
Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice);
|
Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice);
|
||||||
|
|
||||||
|
@ -55,10 +105,30 @@ SwDispatchPnp(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("SwDispatchPnp ChildDevice %u Request %x\n", ChildDevice, IoStack->MinorFunction);
|
||||||
|
|
||||||
/* let ks handle it */
|
/* let ks handle it */
|
||||||
Status = KsServiceBusEnumPnpRequest(DeviceObject, Irp);
|
Status = KsServiceBusEnumPnpRequest(DeviceObject, Irp);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
/* check if the request was for a pdo */
|
||||||
|
if (!ChildDevice)
|
||||||
|
{
|
||||||
|
if (Status != STATUS_NOT_SUPPORTED)
|
||||||
|
{
|
||||||
|
/* store result */
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* complete request */
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("SwDispatchPnp KsServiceBusEnumPnpRequest Status %x\n", Status);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* invalid request or not supported */
|
/* invalid request or not supported */
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
@ -69,6 +139,8 @@ SwDispatchPnp(
|
||||||
/* get bus enum pnp object */
|
/* get bus enum pnp object */
|
||||||
Status = KsGetBusEnumPnpDeviceObject(DeviceObject, &PnpDeviceObject);
|
Status = KsGetBusEnumPnpDeviceObject(DeviceObject, &PnpDeviceObject);
|
||||||
|
|
||||||
|
DPRINT("SwDispatchPnp KsGetBusEnumPnpDeviceObject Status %x\n", Status);
|
||||||
|
|
||||||
/* check for success */
|
/* check for success */
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -89,11 +161,49 @@ SwDispatchPnp(
|
||||||
/* delete the device */
|
/* delete the device */
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCES || IoStack->MinorFunction == IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
|
||||||
|
{
|
||||||
|
/* no resources required */
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* skip current location */
|
/* skip current location */
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
/* call the pnp device object */
|
|
||||||
return IoCallDriver(PnpDeviceObject, Irp);
|
/* call the pnp device object */
|
||||||
|
return IoCallDriver(PnpDeviceObject, Irp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IoStack->MajorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE)
|
||||||
|
{
|
||||||
|
/* device cannot be disabled */
|
||||||
|
Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* skip current location */
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
/* call the pnp device object */
|
||||||
|
return IoCallDriver(PnpDeviceObject, Irp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Status == STATUS_NOT_SUPPORTED)
|
||||||
|
{
|
||||||
|
/* skip current location */
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
/* call the pnp device object */
|
||||||
|
return IoCallDriver(PnpDeviceObject, Irp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* complete the request */
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -149,7 +259,7 @@ SwDispatchDeviceControl(
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* get current stack location */
|
/* get current stack location */
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
@ -158,16 +268,25 @@ SwDispatchDeviceControl(
|
||||||
{
|
{
|
||||||
/* install interface */
|
/* install interface */
|
||||||
Status = KsInstallBusEnumInterface(Irp);
|
Status = KsInstallBusEnumInterface(Irp);
|
||||||
|
DPRINT("SwDispatchDeviceControl IOCTL_SWENUM_INSTALL_INTERFACE %x\n", Status);
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SWENUM_REMOVE_INTERFACE)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SWENUM_REMOVE_INTERFACE)
|
||||||
{
|
{
|
||||||
/* remove interface */
|
/* remove interface */
|
||||||
Status = KsRemoveBusEnumInterface(Irp);
|
Status = KsRemoveBusEnumInterface(Irp);
|
||||||
|
DPRINT("SwDispatchDeviceControl IOCTL_SWENUM_REMOVE_INTERFACE %x\n", Status);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SWENUM_GET_BUS_ID)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SWENUM_GET_BUS_ID)
|
||||||
{
|
{
|
||||||
/* get bus id */
|
/* get bus id */
|
||||||
return KsGetBusEnumIdentifier(Irp);
|
Status = KsGetBusEnumIdentifier(Irp);
|
||||||
|
DPRINT("SwDispatchDeviceControl IOCTL_SWENUM_GET_BUS_ID %x\n", Status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("SwDispatchDeviceControl Unknown IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store result */
|
/* store result */
|
||||||
|
@ -193,6 +312,8 @@ SwDispatchCreate(
|
||||||
/* check if the device object is a child device */
|
/* check if the device object is a child device */
|
||||||
Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice);
|
Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice);
|
||||||
|
|
||||||
|
DPRINT("SwDispatchCreate %x\n", Status);
|
||||||
|
|
||||||
/* check for success */
|
/* check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -205,6 +326,7 @@ SwDispatchCreate(
|
||||||
}
|
}
|
||||||
/* perform the create request */
|
/* perform the create request */
|
||||||
Status = KsServiceBusEnumCreateRequest(DeviceObject, Irp);
|
Status = KsServiceBusEnumCreateRequest(DeviceObject, Irp);
|
||||||
|
DPRINT("SwDispatchCreate %x\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check the irp is pending */
|
/* check the irp is pending */
|
||||||
|
@ -245,6 +367,7 @@ SwAddDevice(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_OBJECT FunctionalDeviceObject;
|
PDEVICE_OBJECT FunctionalDeviceObject;
|
||||||
|
|
||||||
|
DPRINT("SWENUM AddDevice\n");
|
||||||
/* create the device */
|
/* create the device */
|
||||||
Status = IoCreateDevice(DriverObject, sizeof(KSDEVICE_HEADER), NULL, FILE_DEVICE_BUS_EXTENDER, 0, FALSE, &FunctionalDeviceObject);
|
Status = IoCreateDevice(DriverObject, sizeof(KSDEVICE_HEADER), NULL, FILE_DEVICE_BUS_EXTENDER, 0, FALSE, &FunctionalDeviceObject);
|
||||||
|
|
||||||
|
@ -303,7 +426,7 @@ DriverEntry(
|
||||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SwDispatchDeviceControl;
|
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SwDispatchDeviceControl;
|
||||||
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = SwDispatchSystemControl;
|
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = SwDispatchSystemControl;
|
||||||
|
|
||||||
|
DPRINT("SWENUM loaded\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
<module name="swenum" type="kernelmodedriver" installbase="system32/drivers" installname="swenum.sys">
|
<module name="swenum" type="kernelmodedriver" installbase="system32/drivers" installname="swenum.sys">
|
||||||
|
<bootstrap installbase="$(CDOUTPUT)" />
|
||||||
<library>ntoskrnl</library>
|
<library>ntoskrnl</library>
|
||||||
<library>ks</library>
|
<library>ks</library>
|
||||||
<file>swenum.c</file>
|
<file>swenum.c</file>
|
||||||
|
|
Loading…
Reference in a new issue