From ee731ff6d9d762f26f4cf235f31dd0db9e786d05 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 15 Aug 2011 05:03:53 +0000 Subject: [PATCH] [NTOSKRNL] - Also create the instance key when we create a new device object svn path=/trunk/; revision=53253 --- reactos/ntoskrnl/io/pnpmgr/pnproot.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/io/pnpmgr/pnproot.c b/reactos/ntoskrnl/io/pnpmgr/pnproot.c index 638c66557b9..c2501cd14a5 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnproot.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnproot.c @@ -142,7 +142,7 @@ PnpRootCreateDevice( UNICODE_STRING PathSep = RTL_CONSTANT_STRING(L"\\"); ULONG NextInstance; UNICODE_STRING EnumKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM); - HANDLE EnumHandle, DeviceKeyHandle = INVALID_HANDLE_VALUE; + HANDLE EnumHandle, DeviceKeyHandle = INVALID_HANDLE_VALUE, InstanceKeyHandle; RTL_QUERY_REGISTRY_TABLE QueryTable[2]; OBJECT_ATTRIBUTES ObjectAttributes; @@ -241,6 +241,18 @@ tryagain: goto cleanup; } + /* Finish creating the instance path in the registry */ + InitializeObjectAttributes(&ObjectAttributes, &Device->InstanceID, OBJ_CASE_INSENSITIVE, DeviceKeyHandle, NULL); + Status = ZwCreateKey(&InstanceKeyHandle, KEY_QUERY_VALUE, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL); + if (NT_SUCCESS(Status)) + { + DPRINT1("Failed to create instance path (0x%x)\n", Status); + goto cleanup; + } + + /* Just close the handle */ + ZwClose(InstanceKeyHandle); + if (FullInstancePath) { FullInstancePath->MaximumLength = Device->DeviceID.Length + PathSep.Length + Device->InstanceID.Length;