- Fix multiple REG_MULTI_SZ termination issues
- HardwareID is a REG_MULTI_SZ entry not REG_SZ

svn path=/trunk/; revision=53312
This commit is contained in:
Cameron Gutman 2011-08-19 03:56:28 +00:00
parent 1229fb9469
commit 8d7a669f59

View file

@ -259,16 +259,16 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
L"DETECTED%ls\\%wZ", L"DETECTED%ls\\%wZ",
IfString, IfString,
&ServiceName); &ServiceName);
HardwareId[IdLength++] = UNICODE_NULL; IdLength++;
/* Add DETECTED\DriverName */ /* Add DETECTED\DriverName */
IdLength += swprintf(&HardwareId[IdLength], IdLength += swprintf(&HardwareId[IdLength],
L"DETECTED\\%wZ", L"DETECTED\\%wZ",
&ServiceName); &ServiceName);
HardwareId[IdLength++] = UNICODE_NULL; IdLength++;
/* Terminate the string with another null */ /* Terminate the string with another null */
HardwareId[IdLength] = UNICODE_NULL; HardwareId[IdLength++] = UNICODE_NULL;
/* Store the value for CompatibleIDs */ /* Store the value for CompatibleIDs */
RtlInitUnicodeString(&ValueName, L"CompatibleIDs"); RtlInitUnicodeString(&ValueName, L"CompatibleIDs");
@ -290,10 +290,12 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
L"DETECTED%ls\\%wZ", L"DETECTED%ls\\%wZ",
IfString, IfString,
&ServiceName); &ServiceName);
HardwareId[++IdLength] = UNICODE_NULL; IdLength++;
HardwareId[IdLength++] = UNICODE_NULL;
/* Write the value to the registry */ /* Write the value to the registry */
Status = ZwSetValueKey(InstanceKey, &ValueName, 0, REG_SZ, HardwareId, IdLength * sizeof(WCHAR)); Status = ZwSetValueKey(InstanceKey, &ValueName, 0, REG_MULTI_SZ, HardwareId, IdLength * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Failed to write the hardware ID: 0x%x\n", Status); DPRINT("Failed to write the hardware ID: 0x%x\n", Status);