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

@ -105,7 +105,15 @@ namespace DSInternals.DataStore
{ {
using (var ccsKey = systemKey.OpenSubKey(CurrentControlSetKey)) using (var ccsKey = systemKey.OpenSubKey(CurrentControlSetKey))
{ {
return (int)ccsKey.GetValue(CurrentControlSetValue, DefaultControlSetId); 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;
}
} }
} }