UNICODE_STRING HardwareIdKey;
PUNICODE_STRING pHardwareId;
ULONG DeviceIndex = 0;
+ BOOLEAN IsDeviceDesc;
if (RelativePath)
{
{
pHardwareId = &HardwareIdSerial;
DeviceIndex = DeviceIndexSerial++;
+ IsDeviceDesc = TRUE;
}
else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierKeyboard, FALSE) == 0)
{
pHardwareId = &HardwareIdKeyboard;
DeviceIndex = DeviceIndexKeyboard++;
+ IsDeviceDesc = FALSE;
}
else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierMouse, FALSE) == 0)
{
pHardwareId = &HardwareIdMouse;
DeviceIndex = DeviceIndexMouse++;
+ IsDeviceDesc = FALSE;
}
else if (NT_SUCCESS(Status))
{
{
pHardwareId = &HardwareIdPci;
DeviceIndex = DeviceIndexPci++;
+ IsDeviceDesc = FALSE;
}
else if (RtlCompareUnicodeString(&ValueName, &IdentifierIsa, FALSE) == 0)
{
pHardwareId = &HardwareIdIsa;
DeviceIndex = DeviceIndexIsa++;
+ IsDeviceDesc = FALSE;
}
#ifdef ENABLE_ACPI
else if (RtlCompareUnicodeString(&ValueName, &IdentifierAcpi, FALSE) == 0)
{
pHardwareId = &HardwareIdAcpi;
DeviceIndex = DeviceIndexAcpi++;
+ IsDeviceDesc = FALSE;
}
#endif
else /* Now let's detect devices with a device number at the end */
{
pHardwareId = &HardwareIdFloppy;
DeviceIndex = DeviceIndexFloppy++;
+ IsDeviceDesc = FALSE;
}
/* Nope, is it a parallel port? */
else if (RtlCompareUnicodeString(&ValueName, &IdentifierParallel, FALSE) == 0)
{
pHardwareId = &HardwareIdParallel;
DeviceIndex = DeviceIndexParallel++;
+ IsDeviceDesc = FALSE;
}
/* Nope, out of ideas so let's skip this one */
else
goto nextdevice;
}
DPRINT("Found %wZ #%lu (%wZ)\n", &ValueName, DeviceIndex, &HardwareIdKey);
- Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer, ValueName.MaximumLength);
- if (!NT_SUCCESS(Status))
+ if (IsDeviceDesc)
{
- DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
- ZwDeleteKey(hLevel2Key);
- goto nextdevice;
+ Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer, ValueName.MaximumLength);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
+ ZwDeleteKey(hLevel2Key);
+ goto nextdevice;
+ }
}
Status = ZwSetValueKey(hLevel2Key, &HardwareIDU, 0, REG_MULTI_SZ, pHardwareId->Buffer, pHardwareId->MaximumLength);
if (!NT_SUCCESS(Status))