Fixed #47: Error parsing corrupted registry hives

This commit is contained in:
Michael Grafnetter 2023-02-25 06:35:54 +01:00
parent 393e5af563
commit 3b1806c038
1 changed files with 9 additions and 1 deletions

View File

@ -104,9 +104,17 @@ namespace DSInternals.DataStore
private static int GetCurrentControlSetId(RegistryKey systemKey)
{
using (var ccsKey = systemKey.OpenSubKey(CurrentControlSetKey))
{
if(ccsKey != null)
{
return (int)ccsKey.GetValue(CurrentControlSetValue, DefaultControlSetId);
}
else
{
// The "Select" value may be absent in SYSTEM registry hives that were copied from live systems without the corresponding transaction logs.
return DefaultControlSetId;
}
}
}
private static byte[] DecodeKey(byte[] bootKey)