From 8d7a669f59451be8087cf50dced6c084b683db4c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 19 Aug 2011 03:56:28 +0000 Subject: [PATCH] [PNPMGR] - Fix multiple REG_MULTI_SZ termination issues - HardwareID is a REG_MULTI_SZ entry not REG_SZ svn path=/trunk/; revision=53312 --- reactos/ntoskrnl/io/pnpmgr/pnpreport.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpreport.c b/reactos/ntoskrnl/io/pnpmgr/pnpreport.c index b871889c5d2..d63a7018ba6 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpreport.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpreport.c @@ -259,16 +259,16 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, L"DETECTED%ls\\%wZ", IfString, &ServiceName); - HardwareId[IdLength++] = UNICODE_NULL; + IdLength++; /* Add DETECTED\DriverName */ IdLength += swprintf(&HardwareId[IdLength], L"DETECTED\\%wZ", &ServiceName); - HardwareId[IdLength++] = UNICODE_NULL; + IdLength++; /* Terminate the string with another null */ - HardwareId[IdLength] = UNICODE_NULL; + HardwareId[IdLength++] = UNICODE_NULL; /* Store the value for CompatibleIDs */ RtlInitUnicodeString(&ValueName, L"CompatibleIDs"); @@ -290,10 +290,12 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, L"DETECTED%ls\\%wZ", IfString, &ServiceName); - HardwareId[++IdLength] = UNICODE_NULL; + IdLength++; + + HardwareId[IdLength++] = UNICODE_NULL; /* 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)) { DPRINT("Failed to write the hardware ID: 0x%x\n", Status);