Author: janderwald
Date: Fri Aug 21 12:06:29 2009
New Revision: 42820
URL:
http://svn.reactos.org/svn/reactos?rev=42820&view=rev
Log:
- Remove hacks for bug 4566
Modified:
trunk/reactos/drivers/ksfilter/ks/deviceinterface.c
trunk/reactos/drivers/ksfilter/ks/irp.c
trunk/reactos/drivers/ksfilter/ks/priv.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c
Modified: trunk/reactos/drivers/ksfilter/ks/deviceinterface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/device…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/deviceinterface.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/deviceinterface.c [iso-8859-1] Fri Aug 21 12:06:29
2009
@@ -74,7 +74,7 @@
/* now register device interface */
Status = IoRegisterDeviceInterface(PhysicalDeviceObject,
&Categories[Index],
- ReferenceString, /* see damn bug 4566 */
+ ReferenceString,
&SymEntry->SymbolicLink);
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/drivers/ksfilter/ks/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Fri Aug 21 12:06:29 2009
@@ -635,7 +635,7 @@
}
/*
- @unimplemented
+ @implemented
*/
KSDDKAPI
NTSTATUS
@@ -1781,9 +1781,10 @@
/* 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 */
@@ -1834,116 +1835,6 @@
}
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(
IN PDEVICE_OBJECT DeviceObject,
@@ -1969,7 +1860,7 @@
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 @@
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 @@
}
}
- 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 @@
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);
Modified: trunk/reactos/drivers/ksfilter/ks/priv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/priv.h…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/priv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/priv.h [iso-8859-1] Fri Aug 21 12:06:29 2009
@@ -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) {\
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] Fri Aug 21
12:06:29 2009
@@ -312,8 +312,9 @@
*/
Status = IoRegisterDeviceInterface(DeviceExt->PhysicalDeviceObject,
&SubDeviceDescriptor->Interfaces[Index],
- NULL, //&RefName,
+ &RefName,
&SymbolicLinkName);
+
if (NT_SUCCESS(Status))
{
/* activate device interface */
Modified: trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c [iso-8859-1] Fri Aug 21 12:06:29
2009
@@ -13,8 +13,6 @@
const GUID KS_CATEGORY_AUDIO = {0x6994AD04L, 0x93EF, 0x11D0, {0xA3,
0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
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(
@@ -198,14 +196,15 @@
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 @@
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)
@@ -256,12 +249,6 @@
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);
@@ -272,6 +259,24 @@
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;
@@ -312,13 +317,6 @@
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 @@
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