[NTOS:IO] Remove final NULL char of PDO name before writing to registry

Otherwise, if a PDO has no name (bad!), you'll see two "(Default)" entries
in HKLM\HARDWARE\RESOURCEMAP\PnP Manager\PnpManager
This commit is contained in:
Hervé Poussineau
2021-10-07 20:50:38 +02:00
parent 500f00de6a
commit a86c3794a6

View File

@@ -915,7 +915,7 @@ IopUpdateResourceMap(
ASSERT(FALSE);
}
NameU.Length = (USHORT)OldLength;
NameU.Length = (USHORT)OldLength - sizeof(UNICODE_NULL); /* Remove final NULL */
RtlAppendUnicodeStringToString(&NameU, &RawSuffix);
@@ -933,7 +933,7 @@ IopUpdateResourceMap(
}
/* "Remove" the suffix by setting the length back to what it used to be */
NameU.Length = (USHORT)OldLength;
NameU.Length = (USHORT)OldLength - sizeof(UNICODE_NULL); /* Remove final NULL */
RtlAppendUnicodeStringToString(&NameU, &TranslatedSuffix);