From a60fb0c766bae269035a766a4826811de9ac6134 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 22 Mar 2015 11:27:52 +0000 Subject: [PATCH] [SYSAUDIO][KMIXER] - convert to pnp software device svn path=/trunk/; revision=66853 --- .../drivers/wdm/audio/filters/kmixer/kmixer.c | 13 +++++++++--- reactos/drivers/wdm/audio/sysaudio/main.c | 21 ++++++++++++------- reactos/media/inf/wdmaudio.inf | 10 ++++----- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c b/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c index 17ff13f9de2..978e46565cd 100644 --- a/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c +++ b/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c @@ -40,13 +40,15 @@ KMix_Unload(IN PDRIVER_OBJECT DriverObject) NTSTATUS NTAPI -KMix_InstallDevice( - IN PDRIVER_OBJECT DriverObject) +KMix_AddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT PhysicalDeviceObject) { NTSTATUS Status; UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\kmixer"); PDEVICE_OBJECT DeviceObject; PKMIXER_DEVICE_EXT DeviceExtension; + PDEVICE_OBJECT NextDeviceObject; DPRINT1("KMix_InstallDevice called\n"); @@ -80,9 +82,13 @@ KMix_InstallDevice( /* set io flags */ DeviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE; + /* clear initializing flag */ DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; + NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject, PhysicalDeviceObject); + KsSetDevicePnpAndBaseObject(DeviceExtension->KsDeviceHeader, NextDeviceObject, DeviceObject); + DPRINT("KMix_InstallDevice result %x\n", Status); return STATUS_SUCCESS; @@ -110,6 +116,7 @@ DriverEntry( DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = KsDefaultForwardIrp; DriverObject->MajorFunction[IRP_MJ_PNP] = KMix_Pnp; DriverObject->DriverUnload = KMix_Unload; + DriverObject->DriverExtension->AddDevice = KMix_AddDevice; - return KMix_InstallDevice(DriverObject); + return STATUS_SUCCESS; } diff --git a/reactos/drivers/wdm/audio/sysaudio/main.c b/reactos/drivers/wdm/audio/sysaudio/main.c index d739d5c83f2..e350c0a9396 100644 --- a/reactos/drivers/wdm/audio/sysaudio/main.c +++ b/reactos/drivers/wdm/audio/sysaudio/main.c @@ -131,17 +131,17 @@ SysAudio_Pnp( NTSTATUS NTAPI -SysAudio_InstallDevice( - IN PDRIVER_OBJECT DriverObject) +SysAudio_AddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT PhysicalDeviceObject) { NTSTATUS Status; UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\sysaudio"); UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\DosDevices\\sysaudio"); - PDEVICE_OBJECT DeviceObject; + PDEVICE_OBJECT DeviceObject, NextDeviceObject; SYSAUDIODEVEXT *DeviceExtension; - - DPRINT("SysAudio_InstallDevice called\n"); + DPRINT("SysAudio_AddDevice called\n"); /* Create the device */ Status = IoCreateDevice(DriverObject, @@ -160,7 +160,7 @@ SysAudio_InstallDevice( } /* Register device interfaces */ - Status = SysAudioRegisterDeviceInterfaces(DeviceObject); + Status = SysAudioRegisterDeviceInterfaces(PhysicalDeviceObject); if (!NT_SUCCESS(Status)) { /* Failed to register @@ -215,6 +215,10 @@ SysAudio_InstallDevice( /* clear initializing flag */ DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; + /* atttach to device stack */ + NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject, PhysicalDeviceObject); + KsSetDevicePnpAndBaseObject(DeviceExtension->KsDeviceHeader, NextDeviceObject, DeviceObject); + /* register shutdown notfication */ IoRegisterShutdownNotification(DeviceObject); @@ -259,7 +263,8 @@ DriverEntry( /* Sysaudio needs to do work on pnp, so handle it */ DriverObject->MajorFunction[IRP_MJ_PNP] = SysAudio_Pnp; DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = SysAudio_Shutdown; + DriverObject->DriverExtension->AddDevice = SysAudio_AddDevice; - /* Call our initialization function */ - return SysAudio_InstallDevice(DriverObject); + /* done */ + return STATUS_SUCCESS; } diff --git a/reactos/media/inf/wdmaudio.inf b/reactos/media/inf/wdmaudio.inf index b66ba446c3b..b86aeeb2228 100644 --- a/reactos/media/inf/wdmaudio.inf +++ b/reactos/media/inf/wdmaudio.inf @@ -25,8 +25,8 @@ ExcludeFromSelect = SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE} ExcludeFromSelect = WDMAUDIO_CopyFilesOnlyId [GenericMfg] -;%WDM_KMIXER.DeviceDesc% = WDM_KMIXER, SW\{B7EAFDC0-A680-11D0-96D8-00AA0051E51D} -;%WDM_SYSAUDIO.DeviceDesc% = WDM_SYSAUDIO, SW\{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407} +%WDM_KMIXER.DeviceDesc% = WDM_KMIXER, SW\{B7EAFDC0-A680-11D0-96D8-00AA0051E51D} +%WDM_SYSAUDIO.DeviceDesc% = WDM_SYSAUDIO, SW\{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407} %WDM_WDMAUD.DeviceDesc% = WDM_WDMAUD, SW\{CD171DE3-69E5-11D2-B56D-0000F8754380} ;%WDM_DRMKAUD.DeviceDesc% = WDM_DRMKAUD, SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE} @@ -51,11 +51,11 @@ portcls.sys,,,0x0100 [DeviceRegistration] ; Kmixer swenum install -;HKLM,%RunOnce%,"WDM_KMIXER0",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_MIXER%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" -;HKLM,%RunOnce%,"WDM_KMIXER1",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_AUDIO%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" +HKLM,%RunOnce%,"WDM_KMIXER0",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_MIXER%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" +HKLM,%RunOnce%,"WDM_KMIXER1",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_AUDIO%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" ; Sysaudio swenum install -;HKLM,%RunOnce%,"WDM_SYSAUDIO",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_SYSAUDIO.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_SYSAUDIO%,%17%\WDMAUDIO.inf,WDM_SYSAUDIO.Interface.Install" +HKLM,%RunOnce%,"WDM_SYSAUDIO",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_SYSAUDIO.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_SYSAUDIO%,%17%\WDMAUDIO.inf,WDM_SYSAUDIO.Interface.Install" ; WDMAud install HKLM,%RunOnce%,"WDM_WDMAUD",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_WDMAUD.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_WDMAUD%,%17%\WDMAUDIO.inf,WDM_WDMAUD.Interface.Install"