Author: hpoussin
Date: Tue Dec 11 23:07:04 2007
New Revision: 31165
URL:
http://svn.reactos.org/svn/reactos?rev=31165&view=rev
Log:
Don't create a key name with a final \0
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Tue Dec 11 23:07:04 2007
@@ -2704,6 +2704,7 @@
const UNICODE_STRING IdentifierMouse =
RTL_CONSTANT_STRING(L"PointerController");
UNICODE_STRING HardwareIdMouse = RTL_CONSTANT_STRING(L"*PNP0F13\0");
static ULONG DeviceIndexMouse = 0;
+ UNICODE_STRING HardwareIdKey;
PUNICODE_STRING pHardwareId;
ULONG DeviceIndex = 0;
@@ -2980,8 +2981,12 @@
goto nextdevice;
}
+ /* Prepare hardware id key (hardware id value without final \0) */
+ HardwareIdKey = *pHardwareId;
+ HardwareIdKey.Length -= sizeof(UNICODE_NULL);
+
/* Add the detected device to Root key */
- InitializeObjectAttributes(&ObjectAttributes, pHardwareId, OBJ_KERNEL_HANDLE,
hRootKey, NULL);
+ InitializeObjectAttributes(&ObjectAttributes, &HardwareIdKey,
OBJ_KERNEL_HANDLE, hRootKey, NULL);
Status = ZwCreateKey(
&hLevel1Key,
KEY_CREATE_SUB_KEY,
@@ -3012,7 +3017,7 @@
DPRINT("ZwCreateKey() failed with status 0x%08lx\n", Status);
goto nextdevice;
}
- DPRINT("Found %wZ #%lu (%wZ)\n", &ValueName, DeviceIndex,
pHardwareId);
+ DPRINT("Found %wZ #%lu (%wZ)\n", &ValueName, DeviceIndex,
&HardwareIdKey);
Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer,
ValueName.MaximumLength);
if (!NT_SUCCESS(Status))
{