Update VirtualMachineDetector.cs
This commit is contained in:
		
							parent
							
								
									e4a82e2f63
								
							
						
					
					
						commit
						8b3f9b0838
					
				
					 1 changed files with 0 additions and 41 deletions
				
			
		| 
						 | 
				
			
			@ -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");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue