diff --git a/SafeExamBrowser.SystemComponents/Registry/Registry.cs b/SafeExamBrowser.SystemComponents/Registry/Registry.cs index 9e30aaa5..43b67ddd 100644 --- a/SafeExamBrowser.SystemComponents/Registry/Registry.cs +++ b/SafeExamBrowser.SystemComponents/Registry/Registry.cs @@ -161,14 +161,6 @@ namespace SafeExamBrowser.SystemComponents.Registry } } - /// - /// Parses a keyName and returns the basekey for it. - /// It will also store the subkey name in the out parameter. - /// If the keyName is not valid, we will return false. - /// Does not raise Exceptions. - /// Supports shortcuts. - /// - // yoinked (and partially modified to follow SEB conventions) private Win32 function: https://stackoverflow.com/a/58547945 private bool TryGetBaseKeyFromKeyName(string keyName, out RegistryKey baseKey, out string subKeyName) { baseKey = default; @@ -185,7 +177,6 @@ namespace SafeExamBrowser.SystemComponents.Registry basekeyName = keyName.ToUpper(System.Globalization.CultureInfo.InvariantCulture); } - // add shortcuts as well to be implicit switch (basekeyName) { case "HKEY_CURRENT_USER": diff --git a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs index cab97671..d693fb9f 100644 --- a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs +++ b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs @@ -76,9 +76,6 @@ namespace SafeExamBrowser.SystemComponents return isVirtualMachine; } - /// - /// Scans parameters for disallowed strings (signatures) - /// private bool IsVirtualSystemInfo(string biosInfo, string manufacturer, string model) { var isVirtualMachine = false; @@ -107,17 +104,13 @@ namespace SafeExamBrowser.SystemComponents var isVirtualMachine = false; // the resulting IsVirtualRegistry() would be massive so split it - isVirtualMachine |= IsVirtualRegistryHardwareConfig(); - isVirtualMachine |= IsVirtualRegistryDeviceCache(); + isVirtualMachine |= HasHistoricVirtualMachineHardwareConfiguration(); + isVirtualMachine |= HasLocalVirtualMachineDeviceCache(); return isVirtualMachine; } - - /// - /// Scans (historic) hardware configurations in the registry. - /// - private bool IsVirtualRegistryHardwareConfig() + private bool HasHistoricVirtualMachineHardwareConfiguration() { var isVirtualMachine = false; @@ -134,10 +127,10 @@ namespace SafeExamBrowser.SystemComponents return false; } - foreach (string configId in hardwareConfigSubkeys) + foreach (var configId in hardwareConfigSubkeys) { var hwConfigKey = $"{hwConfigParentKey}\\{configId}"; - bool didReadKeys = true; + var didReadKeys = true; // collect system values for IsVirtualSystemInfo() didReadKeys &= registry.TryRead(hwConfigKey, "BIOSVendor", out var biosVendor); @@ -179,7 +172,7 @@ namespace SafeExamBrowser.SystemComponents /// /// Scans (synced) device cache for hardware info of the current device. /// - private bool IsVirtualRegistryDeviceCache() + private bool HasLocalVirtualMachineDeviceCache() { var isVirtualMachine = false;