mirror of
https://github.com/reactos/reactos.git
synced 2025-05-24 19:56:38 +00:00
- Remove hacks for bug 4566
svn path=/trunk/; revision=42820
This commit is contained in:
parent
5fb02a865b
commit
67d71e67d5
5 changed files with 30 additions and 197 deletions
|
@ -74,7 +74,7 @@ KspRegisterDeviceInterfaces(
|
|||
/* now register device interface */
|
||||
Status = IoRegisterDeviceInterface(PhysicalDeviceObject,
|
||||
&Categories[Index],
|
||||
ReferenceString, /* see damn bug 4566 */
|
||||
ReferenceString,
|
||||
&SymEntry->SymbolicLink);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -635,7 +635,7 @@ KsStreamIo(
|
|||
}
|
||||
|
||||
/*
|
||||
@unimplemented
|
||||
@implemented
|
||||
*/
|
||||
KSDDKAPI
|
||||
NTSTATUS
|
||||
|
@ -1781,9 +1781,10 @@ KspCreate(
|
|||
/* get device header */
|
||||
DeviceHeader = DeviceExtension->DeviceHeader;
|
||||
|
||||
/* hack for bug 4566 */
|
||||
|
||||
if (IoStack->FileObject->FileName.Buffer == NULL)
|
||||
{
|
||||
/* FIXME Pnp-Issue */
|
||||
DPRINT("Using reference string hack\n");
|
||||
Irp->IoStatus.Information = 0;
|
||||
/* set return status */
|
||||
|
@ -1833,116 +1834,6 @@ KspCreate(
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
RosDeviceInterfaceReferenceStringHack(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PKSIDEVICE_HEADER DeviceHeader;
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PCREATE_ITEM_ENTRY CreateItemEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
LPWSTR Buffer;
|
||||
ULONG Length;
|
||||
|
||||
/* get current stack location */
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
/* get device extension */
|
||||
DeviceExtension = (PDEVICE_EXTENSION)IoStack->DeviceObject->DeviceExtension;
|
||||
/* get device header */
|
||||
DeviceHeader = DeviceExtension->DeviceHeader;
|
||||
|
||||
/* retrieve all available reference strings registered */
|
||||
Length = 0;
|
||||
Entry = DeviceHeader->ItemList.Flink;
|
||||
while(Entry != &DeviceHeader->ItemList)
|
||||
{
|
||||
CreateItemEntry = (PCREATE_ITEM_ENTRY)CONTAINING_RECORD(Entry, CREATE_ITEM_ENTRY, Entry);
|
||||
|
||||
ASSERT(CreateItemEntry->CreateItem);
|
||||
if (CreateItemEntry->CreateItem->Create && CreateItemEntry->CreateItem->ObjectClass.Buffer)
|
||||
Length += wcslen(CreateItemEntry->CreateItem->ObjectClass.Buffer) + 1;
|
||||
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
|
||||
/* add extra zero */
|
||||
Length += 1;
|
||||
|
||||
/* allocate the buffer */
|
||||
Buffer = ExAllocatePool(NonPagedPool, Length * sizeof(WCHAR));
|
||||
if (!Buffer)
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
*((LPWSTR*)Irp->UserBuffer) = Buffer;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = sizeof(LPWSTR);
|
||||
|
||||
Entry = DeviceHeader->ItemList.Flink;
|
||||
while(Entry != &DeviceHeader->ItemList)
|
||||
{
|
||||
CreateItemEntry = (PCREATE_ITEM_ENTRY)CONTAINING_RECORD(Entry, CREATE_ITEM_ENTRY, Entry);
|
||||
|
||||
ASSERT(CreateItemEntry->CreateItem);
|
||||
if (CreateItemEntry->CreateItem->Create && CreateItemEntry->CreateItem->ObjectClass.Buffer)
|
||||
{
|
||||
wcscpy(Buffer, CreateItemEntry->CreateItem->ObjectClass.Buffer);
|
||||
Buffer += wcslen(Buffer) + 1;
|
||||
}
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
|
||||
|
||||
|
||||
*Buffer = L'\0';
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
KspDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PKSIOBJECT_HEADER ObjectHeader;
|
||||
PKSIDEVICE_HEADER DeviceHeader;
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
|
||||
|
||||
|
||||
/* get current stack location */
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
/* get device extension */
|
||||
DeviceExtension = (PDEVICE_EXTENSION)IoStack->DeviceObject->DeviceExtension;
|
||||
/* get device header */
|
||||
DeviceHeader = DeviceExtension->DeviceHeader;
|
||||
|
||||
if (IoStack->MajorFunction == IRP_MJ_DEVICE_CONTROL && IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_OBJECT_CLASS)
|
||||
{
|
||||
/* hack for bug 4566 */
|
||||
return RosDeviceInterfaceReferenceStringHack(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext;
|
||||
|
||||
ASSERT(ObjectHeader);
|
||||
//KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem;
|
||||
|
||||
return ObjectHeader->DispatchTable.DeviceIoControl(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
KspDispatchIrp(
|
||||
|
@ -1969,7 +1860,7 @@ KspDispatchIrp(
|
|||
|
||||
if (!ObjectHeader)
|
||||
{
|
||||
/* hack for bug 4566 */
|
||||
/* FIXME Pnp-Issue*/
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
/* complete and forget */
|
||||
|
@ -2045,8 +1936,6 @@ KsSetMajorFunctionHandler(
|
|||
break;
|
||||
break;
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
DriverObject->MajorFunction[MajorFunction] = KspDeviceControl;
|
||||
break;
|
||||
case IRP_MJ_CLOSE:
|
||||
case IRP_MJ_READ:
|
||||
case IRP_MJ_WRITE:
|
||||
|
@ -2102,12 +1991,6 @@ KsDispatchIrp(
|
|||
}
|
||||
}
|
||||
|
||||
if (IoStack->MajorFunction == IRP_MJ_DEVICE_CONTROL)
|
||||
{
|
||||
/* handle device requests */
|
||||
return KspDeviceControl(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
switch (IoStack->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CLOSE:
|
||||
|
@ -2117,6 +2000,7 @@ KsDispatchIrp(
|
|||
case IRP_MJ_QUERY_SECURITY:
|
||||
case IRP_MJ_SET_SECURITY:
|
||||
case IRP_MJ_PNP:
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
return KspDispatchIrp(DeviceObject, Irp);
|
||||
default:
|
||||
return KsDispatchInvalidDeviceRequest(DeviceObject, Irp);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
#define TAG_DEVICE_HEADER TAG('H','D','S','K')
|
||||
|
||||
#define IOCTL_KS_OBJECT_CLASS CTL_CODE(FILE_DEVICE_KS, 0x7, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
|
||||
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
|
||||
PropGeneral, PropInstances, PropIntersection)\
|
||||
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||
|
|
|
@ -312,8 +312,9 @@ PcRegisterSubdevice(
|
|||
*/
|
||||
Status = IoRegisterDeviceInterface(DeviceExt->PhysicalDeviceObject,
|
||||
&SubDeviceDescriptor->Interfaces[Index],
|
||||
NULL, //&RefName,
|
||||
&RefName,
|
||||
&SymbolicLinkName);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* activate device interface */
|
||||
|
|
|
@ -14,8 +14,6 @@ const GUID KS_CATEGORY_AUDIO = {0x6994AD04L, 0x93EF, 0x11D0, {
|
|||
const GUID KS_CATEGORY_TOPOLOGY = {0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}};
|
||||
const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL = {0xBF963D80L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
|
||||
|
||||
#define IOCTL_KS_OBJECT_CLASS CTL_CODE(FILE_DEVICE_KS, 0x7, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
NTSTATUS
|
||||
BuildPinDescriptor(
|
||||
IN PKSAUDIO_DEVICE_ENTRY DeviceEntry,
|
||||
|
@ -198,14 +196,15 @@ OpenDevice(
|
|||
NTSTATUS
|
||||
InsertAudioDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PUNICODE_STRING DeviceName,
|
||||
IN LPWSTR ReferenceString)
|
||||
IN PUNICODE_STRING DeviceName)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PFILTER_WORKER_CONTEXT Ctx = NULL;
|
||||
PIO_WORKITEM WorkItem = NULL;
|
||||
PSYSAUDIODEVEXT DeviceExtension;
|
||||
PKSAUDIO_DEVICE_ENTRY DeviceEntry = NULL;
|
||||
PDEVICE_OBJECT AudioDeviceObject;
|
||||
UNICODE_STRING ReferenceString, SymbolicLinkName;
|
||||
|
||||
/* a new device has arrived */
|
||||
DeviceEntry = ExAllocatePool(NonPagedPool, sizeof(KSAUDIO_DEVICE_ENTRY));
|
||||
|
@ -240,12 +239,6 @@ InsertAudioDevice(
|
|||
DeviceEntry->DeviceName.Length = 0;
|
||||
DeviceEntry->DeviceName.MaximumLength = DeviceName->MaximumLength + 10 * sizeof(WCHAR);
|
||||
|
||||
/* hack for bug 4566 */
|
||||
if (ReferenceString)
|
||||
{
|
||||
DeviceEntry->DeviceName.MaximumLength += (wcslen(ReferenceString) + 2) * sizeof(WCHAR);
|
||||
}
|
||||
|
||||
DeviceEntry->DeviceName.Buffer = ExAllocatePool(NonPagedPool, DeviceEntry->DeviceName.MaximumLength);
|
||||
|
||||
if (!DeviceEntry->DeviceName.Buffer)
|
||||
|
@ -257,12 +250,6 @@ InsertAudioDevice(
|
|||
RtlAppendUnicodeToString(&DeviceEntry->DeviceName, L"\\??\\");
|
||||
RtlAppendUnicodeStringToString(&DeviceEntry->DeviceName, DeviceName);
|
||||
|
||||
if (ReferenceString)
|
||||
{
|
||||
RtlAppendUnicodeToString(&DeviceEntry->DeviceName, L"\\");
|
||||
RtlAppendUnicodeToString(&DeviceEntry->DeviceName, ReferenceString);
|
||||
}
|
||||
|
||||
Status = OpenDevice(&DeviceEntry->DeviceName, &DeviceEntry->Handle, &DeviceEntry->FileObject);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -273,6 +260,24 @@ InsertAudioDevice(
|
|||
Ctx->DeviceEntry = DeviceEntry;
|
||||
Ctx->WorkItem = WorkItem;
|
||||
|
||||
/* HACK
|
||||
* sysaudio should register the device object for itself
|
||||
*/
|
||||
AudioDeviceObject = IoGetRelatedDeviceObject(DeviceEntry->FileObject);
|
||||
RtlInitUnicodeString(&ReferenceString, L"sad0");
|
||||
Status = IoRegisterDeviceInterface(AudioDeviceObject, &KSCATEGORY_AUDIO_DEVICE, &ReferenceString, &SymbolicLinkName);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Failed to open %wZ with Status %x\n", &DeviceEntry->DeviceName, Status);
|
||||
DbgBreakPoint();
|
||||
|
||||
}
|
||||
|
||||
/* fetch device extension */
|
||||
DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension;
|
||||
/* insert new audio device */
|
||||
|
@ -312,13 +317,6 @@ DeviceInterfaceChangeCallback(
|
|||
DEVICE_INTERFACE_CHANGE_NOTIFICATION * Event;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PSYSAUDIODEVEXT DeviceExtension;
|
||||
UNICODE_STRING DeviceName;
|
||||
HANDLE Handle;
|
||||
PFILE_OBJECT FileObject;
|
||||
LPWSTR ReferenceString;
|
||||
ULONG BytesReturned;
|
||||
|
||||
|
||||
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context;
|
||||
|
||||
DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension;
|
||||
|
@ -328,54 +326,7 @@ DeviceInterfaceChangeCallback(
|
|||
if (IsEqualGUIDAligned(&Event->Event,
|
||||
&GUID_DEVICE_INTERFACE_ARRIVAL))
|
||||
{
|
||||
/*<HACK>
|
||||
* 1) Open the filter w/o reference string
|
||||
* 2) Retrieve reference strings with our private IOCTL_KS_OBJECT_CLASS
|
||||
* 3) Append these reference strings to symbolic link we got
|
||||
* * see bug 4566
|
||||
*/
|
||||
|
||||
DeviceName.Length = 0;
|
||||
DeviceName.MaximumLength = Event->SymbolicLinkName->Length + 10 * sizeof(WCHAR);
|
||||
|
||||
DeviceName.Buffer = ExAllocatePool(NonPagedPool, DeviceName.MaximumLength);
|
||||
|
||||
if (!DeviceName.Buffer)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlAppendUnicodeToString(&DeviceName, L"\\??\\");
|
||||
RtlAppendUnicodeStringToString(&DeviceName, Event->SymbolicLinkName);
|
||||
|
||||
|
||||
Status = OpenDevice(&DeviceName, &Handle, &FileObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(DeviceName.Buffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_OBJECT_CLASS, NULL, 0, &ReferenceString, sizeof(LPWSTR), &BytesReturned);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("failed Status %x\n", Status);
|
||||
|
||||
ExFreePool(DeviceName.Buffer);
|
||||
ObDereferenceObject(FileObject);
|
||||
ZwClose(Handle);
|
||||
return Status;
|
||||
}
|
||||
|
||||
while(*ReferenceString)
|
||||
{
|
||||
Status = InsertAudioDevice(DeviceObject, Event->SymbolicLinkName, ReferenceString);
|
||||
ReferenceString += wcslen(ReferenceString) + 1;
|
||||
}
|
||||
//ExFreePool(ReferenceString);
|
||||
ObDereferenceObject(FileObject);
|
||||
ZwClose(Handle);
|
||||
ExFreePool(DeviceName.Buffer);
|
||||
Status = InsertAudioDevice(DeviceObject, Event->SymbolicLinkName);
|
||||
return Status;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue