chore: removed more unnecessary docs, and changed function names
This commit is contained in:
parent
c1307624d9
commit
5173bf3d6e
2 changed files with 6 additions and 22 deletions
|
@ -161,14 +161,6 @@ namespace SafeExamBrowser.SystemComponents.Registry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
// 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)
|
private bool TryGetBaseKeyFromKeyName(string keyName, out RegistryKey baseKey, out string subKeyName)
|
||||||
{
|
{
|
||||||
baseKey = default;
|
baseKey = default;
|
||||||
|
@ -185,7 +177,6 @@ namespace SafeExamBrowser.SystemComponents.Registry
|
||||||
basekeyName = keyName.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
|
basekeyName = keyName.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add shortcuts as well to be implicit
|
|
||||||
switch (basekeyName)
|
switch (basekeyName)
|
||||||
{
|
{
|
||||||
case "HKEY_CURRENT_USER":
|
case "HKEY_CURRENT_USER":
|
||||||
|
|
|
@ -76,9 +76,6 @@ namespace SafeExamBrowser.SystemComponents
|
||||||
return isVirtualMachine;
|
return isVirtualMachine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Scans parameters for disallowed strings (signatures)
|
|
||||||
/// </summary>
|
|
||||||
private bool IsVirtualSystemInfo(string biosInfo, string manufacturer, string model)
|
private bool IsVirtualSystemInfo(string biosInfo, string manufacturer, string model)
|
||||||
{
|
{
|
||||||
var isVirtualMachine = false;
|
var isVirtualMachine = false;
|
||||||
|
@ -107,17 +104,13 @@ namespace SafeExamBrowser.SystemComponents
|
||||||
var isVirtualMachine = false;
|
var isVirtualMachine = false;
|
||||||
|
|
||||||
// the resulting IsVirtualRegistry() would be massive so split it
|
// the resulting IsVirtualRegistry() would be massive so split it
|
||||||
isVirtualMachine |= IsVirtualRegistryHardwareConfig();
|
isVirtualMachine |= HasHistoricVirtualMachineHardwareConfiguration();
|
||||||
isVirtualMachine |= IsVirtualRegistryDeviceCache();
|
isVirtualMachine |= HasLocalVirtualMachineDeviceCache();
|
||||||
|
|
||||||
return isVirtualMachine;
|
return isVirtualMachine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HasHistoricVirtualMachineHardwareConfiguration()
|
||||||
/// <summary>
|
|
||||||
/// Scans (historic) hardware configurations in the registry.
|
|
||||||
/// </summary>
|
|
||||||
private bool IsVirtualRegistryHardwareConfig()
|
|
||||||
{
|
{
|
||||||
var isVirtualMachine = false;
|
var isVirtualMachine = false;
|
||||||
|
|
||||||
|
@ -134,10 +127,10 @@ namespace SafeExamBrowser.SystemComponents
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string configId in hardwareConfigSubkeys)
|
foreach (var configId in hardwareConfigSubkeys)
|
||||||
{
|
{
|
||||||
var hwConfigKey = $"{hwConfigParentKey}\\{configId}";
|
var hwConfigKey = $"{hwConfigParentKey}\\{configId}";
|
||||||
bool didReadKeys = true;
|
var didReadKeys = true;
|
||||||
|
|
||||||
// collect system values for IsVirtualSystemInfo()
|
// collect system values for IsVirtualSystemInfo()
|
||||||
didReadKeys &= registry.TryRead(hwConfigKey, "BIOSVendor", out var biosVendor);
|
didReadKeys &= registry.TryRead(hwConfigKey, "BIOSVendor", out var biosVendor);
|
||||||
|
@ -179,7 +172,7 @@ namespace SafeExamBrowser.SystemComponents
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scans (synced) device cache for hardware info of the current device.
|
/// Scans (synced) device cache for hardware info of the current device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool IsVirtualRegistryDeviceCache()
|
private bool HasLocalVirtualMachineDeviceCache()
|
||||||
{
|
{
|
||||||
var isVirtualMachine = false;
|
var isVirtualMachine = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue