From 8b3f9b083827eacc28f41e2490f0a75d0bf5cef0 Mon Sep 17 00:00:00 2001 From: Lau <68616630+Notselwyn@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:26:20 +0200 Subject: [PATCH] Update VirtualMachineDetector.cs --- .../VirtualMachineDetector.cs | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs index 6e6e530e..cec40df6 100644 --- a/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs +++ b/SafeExamBrowser.SystemComponents/VirtualMachineDetector.cs @@ -105,7 +105,6 @@ namespace SafeExamBrowser.SystemComponents { var isVirtualRegistry = false; - isVirtualRegistry |= HasHistoricVirtualMachineHardwareConfiguration(); isVirtualRegistry |= HasLocalVirtualMachineDeviceCache(); return isVirtualRegistry; @@ -134,46 +133,6 @@ namespace SafeExamBrowser.SystemComponents return isVirtualSystem; } - private bool HasHistoricVirtualMachineHardwareConfiguration() - { - var hasHistoricConfiguration = false; - - if (registry.TryGetSubKeys(RegistryValue.MachineHive.HardwareConfig_Key, out var hardwareConfigSubkeys)) - { - foreach (var configId in hardwareConfigSubkeys) - { - var hardwareConfigKey = $@"{RegistryValue.MachineHive.HardwareConfig_Key}\{configId}"; - var computerIdsKey = $@"{hardwareConfigKey}\ComputerIds"; - var success = true; - - success &= registry.TryRead(hardwareConfigKey, "BIOSVendor", out var biosVendor); - success &= registry.TryRead(hardwareConfigKey, "BIOSVersion", out var biosVersion); - success &= registry.TryRead(hardwareConfigKey, "SystemManufacturer", out var systemManufacturer); - success &= registry.TryRead(hardwareConfigKey, "SystemProductName", out var systemProductName); - - if (success) - { - var biosInfo = $"{(string) biosVendor} {(string) biosVersion}"; - - hasHistoricConfiguration |= IsVirtualSystem(biosInfo, (string) systemManufacturer, (string) systemProductName); - - if (registry.TryGetNames(computerIdsKey, out var computerIdNames)) - { - foreach (var computerIdName in computerIdNames) - { - if (registry.TryRead(computerIdsKey, computerIdName, out var computerSummary)) - { - hasHistoricConfiguration |= IsVirtualSystem((string) computerSummary, (string) systemManufacturer, (string) systemProductName); - } - } - } - } - } - } - - return hasHistoricConfiguration; - } - private bool HasLocalVirtualMachineDeviceCache() { var deviceName = System.Environment.GetEnvironmentVariable("COMPUTERNAME");