[NTOSKRNL]

- Also create the instance key when we create a new device object

svn path=/trunk/; revision=53253
This commit is contained in:
Cameron Gutman 2011-08-15 05:03:53 +00:00
parent 4f39606d60
commit ee731ff6d9

View file

@ -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;