Index: pnpmgr.c =================================================================== --- ntoskrnl/io/pnpmgr/pnpmgr.c (revision 74003) +++ ntoskrnl/io/pnpmgr/pnpmgr.c (working copy) @@ -1996,29 +1996,29 @@ &IoStatusBlock, IRP_MN_QUERY_ID, &Stack); - if (NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { - /* Append the instance id string */ - wcscat(InstancePath, L"\\"); - if (ParentIdPrefix.Length > 0) - { - /* Add information from parent bus device to InstancePath */ - wcscat(InstancePath, ParentIdPrefix.Buffer); - if (IoStatusBlock.Information && *(PWSTR)IoStatusBlock.Information) - wcscat(InstancePath, L"&"); - } - if (IoStatusBlock.Information) - wcscat(InstancePath, (PWSTR)IoStatusBlock.Information); + DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); + IoStatusBlock.Information = 0; + } - /* - * FIXME: Check for valid characters, if there is invalid characters - * then bugcheck - */ - } - else + /* Append the instance id string */ + wcscat(InstancePath, L"\\"); + if (ParentIdPrefix.Length > 0) { - DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); + /* Add information from parent bus device to InstancePath */ + wcscat(InstancePath, ParentIdPrefix.Buffer); + if (IoStatusBlock.Information && *(PWSTR)IoStatusBlock.Information) + wcscat(InstancePath, L"&"); } + if (IoStatusBlock.Information) + wcscat(InstancePath, (PWSTR)IoStatusBlock.Information); + + /* + * FIXME: Check for valid characters, if there is invalid characters + * then bugcheck + */ + RtlFreeUnicodeString(&ParentIdPrefix); if (!RtlCreateUnicodeString(&InstancePathU, InstancePath))