Author: janderwald Date: Sat Mar 7 18:01:03 2015 New Revision: 66600 URL: http://svn.reactos.org/svn/reactos?rev=66600&view=rev Log: [KS] - fix multiple bugs in software bus pnp enumerator [INF] - add wdmaud.sys as a client of the software bus pnp enumerator
Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c trunk/reactos/media/inf/wdmaudio.inf Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/swenum.c?rev=66600&r1=66599&r2=66600&view=diff ============================================================================== --- trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] Sat Mar 7 18:01:03 2015 @@ -98,7 +98,7 @@ RtlInitUnicodeString(&ReferenceString, DeviceEntry->DeviceName); /* register device interface */ - Status = IoRegisterDeviceInterface(BusDeviceExtension->PhysicalDeviceObject, &BusInstanceEntry->InterfaceGuid, &ReferenceString, &BusInstanceEntry->SymbolicLink); + Status = IoRegisterDeviceInterface(BusDeviceExtension->PhysicalDeviceObject, &DeviceEntry->DeviceGuid, NULL, &BusInstanceEntry->SymbolicLink); /* check for success */ if (!NT_SUCCESS(Status)) @@ -231,7 +231,7 @@ if (NT_SUCCESS(Status)) { /* perform callback */ - Status = Callback(hNewKey, BusDeviceExtension, DeviceEntry, ReferenceString, KeyInfo->Name); + Status = Callback(hNewKey, BusDeviceExtension, DeviceEntry, KeyInfo->Name, ReferenceString); /* should enumeration stop */ if (!NT_SUCCESS(Status)) @@ -272,6 +272,8 @@ /* check if the device is already present */ Entry = DeviceEntry->DeviceInterfaceList.Flink; + DPRINT1("KspCreateDeviceAssociation ReferenceString %S\n", ReferenceString); + DPRINT1("KspCreateDeviceAssociation InterfaceString %S\n", InterfaceString); while(Entry != &DeviceEntry->DeviceInterfaceList) { @@ -325,8 +327,8 @@ IN PHANDLE hKey, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DummyEntry, - IN LPWSTR DeviceCategory, - IN LPWSTR ReferenceString) + IN LPWSTR InterfaceId, + IN LPWSTR DeviceId) { LPWSTR DeviceName; SIZE_T Length; @@ -338,7 +340,7 @@ KIRQL OldLevel; /* first construct device name & reference guid */ - Length = wcslen(DeviceCategory) + wcslen(ReferenceString); + Length = wcslen(DeviceId) + wcslen(InterfaceId); /* append '&' and null byte */ Length += 2; @@ -353,7 +355,9 @@ } /* construct device name */ - swprintf(DeviceName, L"%s&%s", DeviceCategory, ReferenceString); + wcscpy(DeviceName, DeviceId); + wcscat(DeviceName, L"&"); + wcscat(DeviceName, InterfaceId); /* scan list and check if it is already present */ Entry = BusDeviceExtension->Common.Entry.Flink; @@ -391,15 +395,15 @@ InitializeListHead(&DeviceEntry->IrpPendingList); /* copy device guid */ - RtlInitUnicodeString(&String, DeviceCategory); + RtlInitUnicodeString(&String, DeviceId); RtlGUIDFromString(&String, &DeviceEntry->DeviceGuid); /* copy device names */ DeviceEntry->DeviceName = DeviceName; - DeviceEntry->Instance = (DeviceName + wcslen(DeviceCategory) + 1); + DeviceEntry->Instance = (DeviceName + wcslen(DeviceId) + 1); /* copy name */ - DeviceEntry->BusId = AllocateItem(NonPagedPool, (wcslen(DeviceCategory) + 1) * sizeof(WCHAR)); + DeviceEntry->BusId = AllocateItem(NonPagedPool, (wcslen(DeviceId) + 1) * sizeof(WCHAR)); if (!DeviceEntry->BusId) { /* no memory */ @@ -407,11 +411,11 @@ FreeItem(DeviceEntry); return STATUS_INSUFFICIENT_RESOURCES; } - wcscpy(DeviceEntry->BusId, DeviceCategory); - } - - /* now enumerate the devices */ - Status = KspEnumerateBusRegistryKeys(hKey, ReferenceString, KspCreateDeviceAssociation, BusDeviceExtension, DeviceEntry); + wcscpy(DeviceEntry->BusId, DeviceId); + } + + /* now enumerate the interfaces */ + Status = KspEnumerateBusRegistryKeys(hKey, InterfaceId, KspCreateDeviceAssociation, BusDeviceExtension, DeviceEntry); /* check if list is empty */ if (IsListEmpty(&DeviceEntry->DeviceInterfaceList)) @@ -466,7 +470,7 @@ IN LPWSTR DeviceCategory, IN LPWSTR ReferenceString) { - return KspEnumerateBusRegistryKeys(hKey, ReferenceString, KspCreateDeviceReference, BusDeviceExtension, DummyEntry); + return KspEnumerateBusRegistryKeys(hKey, DeviceCategory, KspCreateDeviceReference, BusDeviceExtension, DummyEntry); } @@ -1015,35 +1019,36 @@ Status = ZwCreateKey(&hDeviceKey, GENERIC_WRITE, &ObjectAttributes, 0, NULL, 0, NULL); if (NT_SUCCESS(Status)) { - /* initialize reference string */ - RtlInitUnicodeString(&ReferenceString, InstallInterface->ReferenceString); - - /* initialize object attributes */ - InitializeObjectAttributes(&ObjectAttributes, &ReferenceString, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hDeviceKey, NULL); - - /* construct device key */ - Status = ZwCreateKey(&hReferenceKey, GENERIC_WRITE, &ObjectAttributes, 0, NULL, 0, NULL); + /* convert interface guid to string */ + Status = RtlStringFromGUID(&InstallInterface->InterfaceId, &InterfaceString); if (NT_SUCCESS(Status)) { - /* convert interface guid to string */ - Status = RtlStringFromGUID(&InstallInterface->InterfaceId, &InterfaceString); + /* initialize object attributes */ + InitializeObjectAttributes(&ObjectAttributes, &InterfaceString, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hDeviceKey, NULL); + + /* construct device key */ + Status = ZwCreateKey(&hInterfaceKey, GENERIC_WRITE, &ObjectAttributes, 0, NULL, 0, NULL); if (NT_SUCCESS(Status)) { + /* initialize reference string */ + RtlInitUnicodeString(&ReferenceString, InstallInterface->ReferenceString); + /* initialize object attributes */ - InitializeObjectAttributes(&ObjectAttributes, &InterfaceString, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hReferenceKey, NULL); + InitializeObjectAttributes(&ObjectAttributes, &ReferenceString, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hInterfaceKey, NULL); /* construct device key */ - Status = ZwCreateKey(&hInterfaceKey, GENERIC_WRITE, &ObjectAttributes, 0, NULL, 0, NULL); + Status = ZwCreateKey(&hReferenceKey, GENERIC_WRITE, &ObjectAttributes, 0, NULL, 0, NULL); if (NT_SUCCESS(Status)) { /* close key */ - ZwClose(hInterfaceKey); + ZwClose(hReferenceKey); } - /* free interface string */ - RtlFreeUnicodeString(&InterfaceString); } + /* free interface string */ + RtlFreeUnicodeString(&InterfaceString); + /* close reference key */ - ZwClose(hReferenceKey); + ZwClose(hInterfaceKey); } /* close device key */ ZwClose(hDeviceKey); @@ -1123,14 +1128,18 @@ { /* get device entry */ DeviceEntry = (PBUS_DEVICE_ENTRY)CONTAINING_RECORD(Entry, BUS_DEVICE_ENTRY, Entry); - - if (IsEqualGUIDAligned(&DeviceEntry->DeviceGuid, &InstallInterface->DeviceId) && - !wcsicmp(DeviceEntry->Instance, InstallInterface->ReferenceString)) + if (IsEqualGUIDAligned(&DeviceEntry->DeviceGuid, &InstallInterface->DeviceId)) { if (!DeviceEntry->PDO) { + /* release device entry lock */ + KeReleaseSpinLock(&Context->BusDeviceExtension->Lock, OldLevel); + /* create pdo */ Status = KspCreatePDO(Context->BusDeviceExtension, DeviceEntry, &DeviceEntry->PDO); + + /* acquire device entry lock */ + KeAcquireSpinLock(&Context->BusDeviceExtension->Lock, &OldLevel); /* done */ break; Modified: trunk/reactos/media/inf/wdmaudio.inf URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/wdmaudio.inf?rev=66600&r1=66599&r2=66600&view=diff ============================================================================== --- trunk/reactos/media/inf/wdmaudio.inf [iso-8859-1] (original) +++ trunk/reactos/media/inf/wdmaudio.inf [iso-8859-1] Sat Mar 7 18:01:03 2015 @@ -25,6 +25,7 @@ ExcludeFromSelect = WDMAUDIO_CopyFilesOnlyId [GenericMfg] +%WDM_WDMAUD.DeviceDesc% = WDM_WDMAUD, SW\{CD171DE3-69E5-11D2-B56D-0000F8754380} %WDM_DRMKAUD.DeviceDesc% = WDM_DRMKAUD, SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE} %WDMAUDIO_CopyFilesOnlyId.DeviceDesc% = WDMAUDIO.CopyFilesOnly, WDMAUDIO_CopyFilesOnlyId @@ -42,10 +43,38 @@ CopyFiles = WDM.CopyFiles [DeviceRegistration] -;; DRMKAUD swenum 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" +; DRMKAUD install HKLM,%RunOnce%,"WDM_DRMKAUD",,"rundll32.exe streamci,StreamingDeviceSetup %WDM_DRMKAUD.DeviceId%,%KSNAME_DRMKAUD%,%KSCATEGORY_DRM_DESCRAMBLE%,%17%\WDMAUDIO.inf,WDM_DRMKAUD.Interface.Install" -;; DRMKAUD Install +;-------------------------------------------------------------------------------- +; WDMAUD Install +[WDM_WDMAUD.Interface.Install] +AddReg=WDM_WDMAUD.Interface.AddReg + +[WDM_WDMAUD.Interface.AddReg] +HKR,,CLSID,,%Proxy.CLSID% +HKR,,FriendlyName,,%WDM_WDMAUD.FriendlyName% + +[WDM_WDMAUD] +CopyFiles = WDM_WDMAUD.CopyFiles + +[WDM_WDMAUD.CopyFiles] +wdmaud.sys + +[WDM_WDMAUD.Services] +AddService = wdmaud,0x00000002, wdmaud_Service_Inst + +[wdmaud_Service_Inst] +DisplayName = %wdmaud.SvcDesc% +ServiceType = 1 ; SERVICE_KERNEL_DRIVER +StartType = 3 ; SERVICE_DEMAND_START +ErrorControl = 1 ; SERVICE_ERROR_NORMAL +ServiceBinary = %10%\system32\drivers\wdmaud.sys + +;-------------------------------------------------------------------------------- +; DRMKAUD Install [WDM_DRMKAUD.Interface.Install] AddReg=WDM_DRMKAUD.Interface.AddReg @@ -80,6 +109,7 @@ WDM.CopyFiles = 10,system32\drivers ; %SystemRoot%\system32\drivers WDM_DRMKAUD.CopyFiles = 10,system32\drivers +;--------------------------------------------------------------------------------- [Strings] ;Non-localizable ReactOS="ReactOS" @@ -87,18 +117,26 @@ RunOnce = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" Proxy.CLSID = "{17CCA71B-ECD7-11D0-B908-00A0C9223196}" +KSNAME_Filter = "{9B365890-165F-11D0-A195-0020AFD156E4}" KSNAME_DRMKAUD = "{ABD61E00-9350-47e2-A632-4438B90C6641}" WDM_DRMKAUD.DeviceId = "{EEC12DB6-AD9C-4168-8658-B03DAEF417FE}" KSCATEGORY_DRM_DESCRAMBLE = "{FFBB6E3F-CCFE-4D84-90D9-421418B03A8E}" KSCATEGORY_DATATRANSFORM = "{2EB07EA0-7E70-11D0-A5D6-28DB04C10000}" KSCATEGORY_AUDIO = "{6994AD04-93EF-11D0-A3CC-00A0C9223196}" PKEY_AudioEngine_OEMFormat = "{E4870E26-3CC5-4CD2-BA46-CA0A9A70ED04},3" +WDM_WDMAUD.DeviceId = "{CD171DE3-69E5-11D2-B56D-0000F8754380}" +KSCATEGORY_WDMAUD = "{3E227E76-690D-11D2-8161-0000F8775BF1}" + ;Localizable WDM_DRMKAUD.DeviceDesc = "ReactOS Trusted Audio Drivers" WDM_DRMKAUD.FriendlyName = "ReactOS Trusted Audio Drivers" drmkaud.SvcDesc = "ReactOS Trusted Audio Drivers" WDMAUDIO_CopyFilesOnlyId.DeviceDesc = "ReactOS WDM Audio Drivers" +WDM_WDMAUD.DeviceDesc = "Driver for ReactOS WINMM-WDM-Audio" +WDM_WDMAUD.FriendlyName = "Driver for ReactOS WINMM-WDM-Audio" +wdmaud.SvcDesc = "Driver for ReactOS WINMM-WDM-Audio" + [Strings.0418] WDM_DRMKAUD.DeviceDesc = "Module-pilot audio de încredere ale ReactOS"