using MonoMod; using SEBPatcherUtils; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.SystemComponents.Contracts.Registry; namespace SafeExamBrowser.Monitoring { #pragma warning disable IDE1006 // Naming Styles public class patch_VirtualMachineDetector : VirtualMachineDetector #pragma warning restore IDE1006 // Naming Styles { public PatchLogger patchlogger; [MonoModIgnore] public patch_VirtualMachineDetector(ILogger logger, IRegistry registry, ISystemInfo systemInfo) : base(logger, registry, systemInfo) { } #pragma warning disable IDE1006 // Naming Styles [MonoModOriginal] public extern void orig_VirtualMachineDetector(ILogger logger, IRegistry registry, ISystemInfo systemInfo); #pragma warning restore IDE1006 // Naming Styles [MonoModConstructor] public void VirtualMachineDetector(ILogger logger, IRegistry registry, ISystemInfo systemInfo) { orig_VirtualMachineDetector(logger, registry, systemInfo); patchlogger = new PatchLogger("Monitoring.VirtualMachineDetector"); } #pragma warning disable IDE1006 // Naming Styles [MonoModOriginal] public extern bool orig_IsVirtualMachine(); #pragma warning restore IDE1006 // Naming Styles #pragma warning disable CS0108 // Member hides inherited member; missing new keyword public bool IsVirtualMachine() #pragma warning restore CS0108 // Member hides inherited member; missing new keyword { bool isVirtualMachine = orig_IsVirtualMachine(); if (isVirtualMachine) { patchlogger.Info("SEB detected host as virtual machine! (will be ignored, ofcourse ;D)"); } else { patchlogger.Info("SEB did not detect host as virtual machine."); } return false; } } }