[RegistryPreview]Accept more valid formats for the root keys (#31552)

* Added validation for HKEY path root abbreviations

* Added abbreviations
This commit is contained in:
e-t-l 2024-03-12 12:17:22 -04:00 committed by GitHub
parent 38e34aa615
commit a36e119204
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1192,7 +1192,19 @@ namespace RegistryPreview
key.StartsWith(@"[HKEY_CURRENT_USER\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKEY_USERS\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKEY_LOCAL_MACHINE\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKEY_CURRENT_CONFIG\", StringComparison.InvariantCultureIgnoreCase) == false))
key.StartsWith(@"[HKEY_CURRENT_CONFIG\", StringComparison.InvariantCultureIgnoreCase) == false)
&&
(key.StartsWith("[HKCR]", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith("[HKCU]", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith("[HKU]", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith("[HKLM]", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith("[HKCC]", StringComparison.InvariantCultureIgnoreCase) == false)
&&
(key.StartsWith(@"[HKCR\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKCU\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKU\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKLM\", StringComparison.InvariantCultureIgnoreCase) == false &&
key.StartsWith(@"[HKCC\", StringComparison.InvariantCultureIgnoreCase) == false))
{
return false;
}