- hardware ids must be terminated by 2 zero bytes
[KS]
- more fixes to software bus pnp enumerator
[MMIXER]
- dont assert on buggy topology lines
[NTOS]
- keys must be REG_OPTION_VOLATILE
- allocate file object with correct tag
[INF]
- register wdmaudio as pnp software device (not yet ready)

svn path=/trunk/; revision=66684
This commit is contained in:
Johannes Anderwald 2015-03-14 11:12:32 +00:00
parent 7236b07eec
commit 11164521c3
7 changed files with 139 additions and 30 deletions

View file

@ -544,7 +544,7 @@ MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
} }
wcscpy(pBuffer, L"inf\\machine.inf"); wcscpy(pBuffer, L"inf\\machine.inf");
InstallSoftwareBusPnpEnumerator(szBuffer, L"ROOT\\SWENUM"); InstallSoftwareBusPnpEnumerator(szBuffer, L"ROOT\\SWENUM\0");
} }
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);

View file

@ -98,7 +98,7 @@ KspRegisterDeviceAssociation(
RtlInitUnicodeString(&ReferenceString, DeviceEntry->DeviceName); RtlInitUnicodeString(&ReferenceString, DeviceEntry->DeviceName);
/* register device interface */ /* register device interface */
Status = IoRegisterDeviceInterface(BusDeviceExtension->PhysicalDeviceObject, &DeviceEntry->DeviceGuid, NULL, &BusInstanceEntry->SymbolicLink); Status = IoRegisterDeviceInterface(BusDeviceExtension->PhysicalDeviceObject, &BusInstanceEntry->InterfaceGuid, &ReferenceString, &BusInstanceEntry->SymbolicLink);
/* check for success */ /* check for success */
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -255,8 +255,8 @@ KspCreateDeviceAssociation(
IN PHANDLE hKey, IN PHANDLE hKey,
IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension,
IN PBUS_DEVICE_ENTRY DeviceEntry, IN PBUS_DEVICE_ENTRY DeviceEntry,
IN LPWSTR ReferenceString, IN LPWSTR InterfaceString,
IN LPWSTR InterfaceString) IN LPWSTR ReferenceString)
{ {
GUID InterfaceGUID; GUID InterfaceGUID;
NTSTATUS Status; NTSTATUS Status;
@ -699,8 +699,8 @@ KspDoReparseForIrp(
/* construct buffer */ /* construct buffer */
swprintf(Buffer, L"%s\\%s", DeviceEntry->PDODeviceName, DeviceEntry->Instance); swprintf(Buffer, L"%s\\%s", DeviceEntry->PDODeviceName, DeviceEntry->Instance);
// HACK
ExFreePool(IoStack->FileObject->FileName.Buffer); //ExFreePool(IoStack->FileObject->FileName.Buffer);
/* store new file name */ /* store new file name */
RtlInitUnicodeString(&IoStack->FileObject->FileName, Buffer); RtlInitUnicodeString(&IoStack->FileObject->FileName, Buffer);
@ -906,7 +906,7 @@ KspQueryId(
ASSERT(DeviceEntry->Instance); ASSERT(DeviceEntry->Instance);
/* calculate length */ /* calculate length */
Length = wcslen(DeviceEntry->Instance) + 1; Length = wcslen(DeviceEntry->Instance) + 2;
/* allocate buffer */ /* allocate buffer */
Name = AllocateItem(PagedPool, Length * sizeof(WCHAR)); Name = AllocateItem(PagedPool, Length * sizeof(WCHAR));
@ -945,11 +945,11 @@ KspQueryId(
Length = wcslen(BusDeviceExtension->BusIdentifier); Length = wcslen(BusDeviceExtension->BusIdentifier);
Length += wcslen(DeviceEntry->BusId); Length += wcslen(DeviceEntry->BusId);
/* extra length for '\\' and zero byte */ /* extra length for '\\' and 2 zero bytes */
Length += 2; Length += 4;
/* allocate buffer */ /* allocate buffer */
Name = ExAllocatePool(PagedPool, Length * sizeof(WCHAR)); Name = AllocateItem(PagedPool, Length * sizeof(WCHAR));
if (!Name) if (!Name)
{ {
/* failed to allocate buffer */ /* failed to allocate buffer */
@ -957,7 +957,10 @@ KspQueryId(
} }
/* construct id */ /* construct id */
swprintf(Name, L"%s\\%s", BusDeviceExtension->BusIdentifier, DeviceEntry->BusId); wcscpy(Name, BusDeviceExtension->BusIdentifier);
wcscat(Name, L"\\");
wcscat(Name, DeviceEntry->BusId);
//swprintf(Name, L"%s\\%s", BusDeviceExtension->BusIdentifier, DeviceEntry->BusId);
/* store result */ /* store result */
Irp->IoStatus.Information = (ULONG_PTR)Name; Irp->IoStatus.Information = (ULONG_PTR)Name;
@ -1205,7 +1208,7 @@ KspBusWorkerRoutine(
if (Diff.QuadPart > Int32x32To64(15000, 10000)) if (Diff.QuadPart > Int32x32To64(15000, 10000))
{ {
DPRINT1("DeviceID %S Instance %S TimeCreated %I64u Now %I64u Diff %I64u hung\n", DeviceEntry->DeviceName, DeviceEntry->Instance, DeviceEntry->TimeCreated.QuadPart, Time.QuadPart, Diff.QuadPart); //DPRINT1("DeviceID %S Instance %S TimeCreated %I64u Now %I64u Diff %I64u hung\n", DeviceEntry->DeviceName, DeviceEntry->Instance, DeviceEntry->TimeCreated.QuadPart, Time.QuadPart, Diff.QuadPart);
/* release spin lock */ /* release spin lock */
KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel); KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel);
@ -1509,6 +1512,9 @@ KsCreateBusEnumObject(
UNICODE_STRING ServiceKeyPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\"); UNICODE_STRING ServiceKeyPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\");
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension; PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
PDEV_EXTENSION DeviceExtension; PDEV_EXTENSION DeviceExtension;
PBUS_DEVICE_ENTRY DeviceEntry;
PLIST_ENTRY Entry;
KIRQL OldLevel;
DPRINT1("KsCreateBusEnumObject %S BusDeviceObject %p\n", ServiceRelativePath, BusDeviceObject); DPRINT1("KsCreateBusEnumObject %S BusDeviceObject %p\n", ServiceRelativePath, BusDeviceObject);
@ -1677,6 +1683,39 @@ KsCreateBusEnumObject(
FreeItem(BusDeviceExtension); FreeItem(BusDeviceExtension);
} }
/* acquire device entry lock */
KeAcquireSpinLock(&BusDeviceExtension->Lock, &OldLevel);
/* now iterate all device entries */
Entry = BusDeviceExtension->Common.Entry.Flink;
while(Entry != &BusDeviceExtension->Common.Entry)
{
/* get device entry */
DeviceEntry = (PBUS_DEVICE_ENTRY)CONTAINING_RECORD(Entry, BUS_DEVICE_ENTRY, Entry);
if (!DeviceEntry->PDO)
{
/* release device entry lock */
KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel);
/* create pdo */
Status = KspCreatePDO(BusDeviceExtension, DeviceEntry, &DeviceEntry->PDO);
/* acquire device entry lock */
KeAcquireSpinLock(&BusDeviceExtension->Lock, &OldLevel);
/* done */
break;
}
/* move to next entry */
Entry = Entry->Flink;
}
/* release device entry lock */
KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel);
/* invalidate device relations */
IoInvalidateDeviceRelations(BusDeviceExtension->PhysicalDeviceObject, BusRelations);
DPRINT("KsCreateBusEnumObject Status %x\n", Status); DPRINT("KsCreateBusEnumObject Status %x\n", Status);
/* done */ /* done */
return Status; return Status;
@ -1909,6 +1948,7 @@ KsServiceBusEnumCreateRequest(
DPRINT("REPARSE Irp %p '%wZ'\n", Irp, &IoStack->FileObject->FileName); DPRINT("REPARSE Irp %p '%wZ'\n", Irp, &IoStack->FileObject->FileName);
Irp->IoStatus.Status = Status; Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = IO_REPARSE;
return Status; return Status;
} }
@ -2051,11 +2091,8 @@ KsServiceBusEnumPnpRequest(
/* set state no notstarted */ /* set state no notstarted */
DeviceEntry->DeviceState = NotStarted; DeviceEntry->DeviceState = NotStarted;
/* time to create PDO */ /* complete pending irps */
KspCreatePDO(BusDeviceExtension, DeviceEntry, &DeviceEntry->PDO); KspCompletePendingIrps(DeviceEntry, STATUS_DEVICE_REMOVED);
/* invalidate device relations */
IoInvalidateDeviceRelations(BusDeviceExtension->PhysicalDeviceObject, BusRelations);
/* done */ /* done */
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;

View file

@ -110,7 +110,7 @@ SwDispatchPnp(
Status = KsServiceBusEnumPnpRequest(DeviceObject, Irp); Status = KsServiceBusEnumPnpRequest(DeviceObject, Irp);
/* check if the request was for a pdo */ /* check if the request was for a pdo */
if (!ChildDevice) if (ChildDevice)
{ {
if (Status != STATUS_NOT_SUPPORTED) if (Status != STATUS_NOT_SUPPORTED)
{ {
@ -144,9 +144,9 @@ SwDispatchPnp(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* failed to get pnp object */ /* failed to get pnp object */
Irp->IoStatus.Status = Status; Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IoCompleteRequest(Irp, IO_NO_INCREMENT); IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status; return STATUS_NOT_SUPPORTED;
} }
/* sanity check */ /* sanity check */

View file

@ -1358,7 +1358,10 @@ MMixerHandlePhysicalConnection(
/* sanity checks */ /* sanity checks */
ASSERT(PinsCount != 0); ASSERT(PinsCount != 0);
ASSERT(PinsCount == 1); if (PinsCount != 1)
{
DPRINT1("MMixerHandlePhysicalConnection Expected 1 pin but got %lu\n", PinsCount);
}
/* create destination line */ /* create destination line */
Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Pins[0], bInput); Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Pins[0], bInput);

View file

@ -25,8 +25,11 @@ ExcludeFromSelect = SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE}
ExcludeFromSelect = WDMAUDIO_CopyFilesOnlyId ExcludeFromSelect = WDMAUDIO_CopyFilesOnlyId
[GenericMfg] [GenericMfg]
;%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_WDMAUD.DeviceDesc% = WDM_WDMAUD, SW\{CD171DE3-69E5-11D2-B56D-0000F8754380}
%WDM_DRMKAUD.DeviceDesc% = WDM_DRMKAUD, SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE} ;%WDM_DRMKAUD.DeviceDesc% = WDM_DRMKAUD, SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE}
%WDMAUDIO_CopyFilesOnlyId.DeviceDesc% = WDMAUDIO.CopyFilesOnly, WDMAUDIO_CopyFilesOnlyId %WDMAUDIO_CopyFilesOnlyId.DeviceDesc% = WDMAUDIO.CopyFilesOnly, WDMAUDIO_CopyFilesOnlyId
[WDMAUDIO.CopyFilesOnly] [WDMAUDIO.CopyFilesOnly]
@ -43,11 +46,69 @@ AddReg = DeviceRegistration
CopyFiles = WDM.CopyFiles CopyFiles = WDM.CopyFiles
[DeviceRegistration] [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"
; 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"
; WDMAud 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" 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
;HKLM,%RunOnce%,"WDM_DRMKAUD",,"rundll32.exe streamci,StreamingDeviceSetup %WDM_DRMKAUD.DeviceId%,%KSNAME_DRMKAUD%,%KSCATEGORY_DRM_DESCRAMBLE%,%17%\WDMAUDIO.inf,WDM_DRMKAUD.Interface.Install"
;--------------------------------------------------------------------------------
; SysAudio Install
[WDM_SYSAUDIO.Interface.Install]
AddReg=WDM_SYSAUDIO.Interface.AddReg
[WDM_SYSAUDIO.Interface.AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%WDM_SYSAUDIO.FriendlyName%
[WDM_SYSAUDIO]
CopyFiles = WDM_SYSAUDIO.CopyFiles
[WDM_SYSAUDIO.CopyFiles]
sysaudio.sys
[WDM_SYSAUDIO.Services]
AddService = sysaudio,0x00000002, sysaudio_Service_Inst
[sysaudio_Service_Inst]
DisplayName = %sysaudio.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\sysaudio.sys
;--------------------------------------------------------------------------------
; KMixer Install
[WDM_KMIXER.Interface.Install]
AddReg=WDM_KMIXER.Interface.AddReg
[WDM_KMIXER.Interface.AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%WDM_KMIXER.FriendlyName%
[WDM_KMIXER]
CopyFiles = WDM_KMIXER.CopyFiles
[WDM_KMIXER.CopyFiles]
kmixer.sys
[WDM_KMIXER.Services]
AddService = kmixer, 0x00000002, kmixer_Service_Inst
[kmixer_Service_Inst]
DisplayName = %kmixer.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\kmixer.sys
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; WDMAUD Install ; WDMAUD Install
[WDM_WDMAUD.Interface.Install] [WDM_WDMAUD.Interface.Install]
@ -119,6 +180,8 @@ RunOnce = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
Proxy.CLSID = "{17CCA71B-ECD7-11D0-B908-00A0C9223196}" Proxy.CLSID = "{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSNAME_Filter = "{9B365890-165F-11D0-A195-0020AFD156E4}" KSNAME_Filter = "{9B365890-165F-11D0-A195-0020AFD156E4}"
KSNAME_DRMKAUD = "{ABD61E00-9350-47e2-A632-4438B90C6641}" KSNAME_DRMKAUD = "{ABD61E00-9350-47e2-A632-4438B90C6641}"
WDM_SYSAUDIO.DeviceId = "{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407}"
KSCATEGORY_SYSAUDIO = "{A7C7A5B1-5AF3-11D1-9CED-00A024BF0407}"
WDM_DRMKAUD.DeviceId = "{EEC12DB6-AD9C-4168-8658-B03DAEF417FE}" WDM_DRMKAUD.DeviceId = "{EEC12DB6-AD9C-4168-8658-B03DAEF417FE}"
KSCATEGORY_DRM_DESCRAMBLE = "{FFBB6E3F-CCFE-4D84-90D9-421418B03A8E}" KSCATEGORY_DRM_DESCRAMBLE = "{FFBB6E3F-CCFE-4D84-90D9-421418B03A8E}"
KSCATEGORY_DATATRANSFORM = "{2EB07EA0-7E70-11D0-A5D6-28DB04C10000}" KSCATEGORY_DATATRANSFORM = "{2EB07EA0-7E70-11D0-A5D6-28DB04C10000}"
@ -129,6 +192,12 @@ KSCATEGORY_WDMAUD = "{3E227E76-690D-11D2-8161-0000F8775BF1}"
;Localizable ;Localizable
WDM_KMIXER.DeviceDesc = "ReactOS Wave Audio Mixer"
WDM_KMIXER.FriendlyName = "ReactOS Wave Audio Mixer"
kmixer.SvcDesc = "ReactOS Wave Audio Mixer"
WDM_SYSAUDIO.DeviceDesc = "ReactOS System audio device"
WDM_SYSAUDIO.FriendlyName = "ReactOS System audio device"
sysaudio.SvcDesc = "ReactOS System audio device"
WDM_DRMKAUD.DeviceDesc = "ReactOS Trusted Audio Drivers" WDM_DRMKAUD.DeviceDesc = "ReactOS Trusted Audio Drivers"
WDM_DRMKAUD.FriendlyName = "ReactOS Trusted Audio Drivers" WDM_DRMKAUD.FriendlyName = "ReactOS Trusted Audio Drivers"
drmkaud.SvcDesc = "ReactOS Trusted Audio Drivers" drmkaud.SvcDesc = "ReactOS Trusted Audio Drivers"

View file

@ -103,7 +103,7 @@ OpenRegistryHandlesFromSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
REG_OPTION_NON_VOLATILE, REG_OPTION_VOLATILE,
NULL); NULL);
ZwClose(ClassesKey); ZwClose(ClassesKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -154,11 +154,11 @@ OpenRegistryHandlesFromSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
REG_OPTION_NON_VOLATILE, REG_OPTION_VOLATILE,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Failed to open %wZ%wZ\\%wZ\n", &BaseKeyU, &GuidString, &SubKeyName); DPRINT1("Failed to open %wZ%wZ\\%wZ Status %x\n", &BaseKeyU, &GuidString, &SubKeyName, Status);
goto cleanup; goto cleanup;
} }
@ -172,7 +172,7 @@ OpenRegistryHandlesFromSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
REG_OPTION_NON_VOLATILE, REG_OPTION_VOLATILE,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -452,7 +452,7 @@ ObpParseSymbolicLink(IN PVOID ParsedObject,
MaximumLength = LengthUsed + sizeof(WCHAR); MaximumLength = LengthUsed + sizeof(WCHAR);
NewTargetPath = ExAllocatePoolWithTag(NonPagedPool, NewTargetPath = ExAllocatePoolWithTag(NonPagedPool,
MaximumLength, MaximumLength,
TAG_SYMLINK_TTARGET); OB_NAME_TAG);
if (!NewTargetPath) return STATUS_INSUFFICIENT_RESOURCES; if (!NewTargetPath) return STATUS_INSUFFICIENT_RESOURCES;
} }
else else