diff --git a/README.md b/README.md
index 48a4cb6..3583540 100644
--- a/README.md
+++ b/README.md
@@ -24,4 +24,24 @@ All you have to do is clone this repository, change the `ReferenceBasePath`s in
Set `ReferenceBasePath` to your SEB installation (SafeExamBrowser\Application). You also need to copy the MonoMod files into your SEB installation.
-If you want to separate your development/testing files from your actual SEB installation, I recommend copying the files in SafeExamBrowser\Application and the MonoMod files to their own directory.
\ No newline at end of file
+If you want to separate your development/testing files from your actual SEB installation, I recommend copying the files in SafeExamBrowser\Application and the MonoMod files to their own directory.
+
+## Resources
+
+This depends on MonoMod and SafeExamBrowser.
+
+**Download Resources**
+
+SafeExamBrowser: [https://safeexambrowser.org/download_en.html](https://safeexambrowser.org/download_en.html)
+
+MonoMod: [https://github.com/MonoMod/MonoMod](https://github.com/MonoMod/MonoMod)
+
+**Learning Resources**
+
+SafeExamBrowser sourcecode: [https://github.com/SafeExamBrowser/seb-win-refactoring](https://github.com/SafeExamBrowser/seb-win-refactoring)
+
+MonoMod API documentation: [https://monomod.github.io/api/index.html](https://monomod.github.io/api/index.html)
+
+MonoMod step-by-step example implementation: [https://github.com/TROYTRON/ti-mods/blob/main/tutorials/MonoMod%20Guide.md](https://github.com/TROYTRON/ti-mods/blob/main/tutorials/MonoMod%20Guide.md)
+
+dnSpy decomp/analysis tool: [https://github.com/dnSpyEx/dnSpy](https://github.com/dnSpyEx/dnSpy)
diff --git a/SEBPatcher.Configuration/SEBPatcher.Configuration.csproj b/SEBPatcher.Configuration/SEBPatcher.Configuration.csproj
index 5793204..4cf1611 100644
--- a/SEBPatcher.Configuration/SEBPatcher.Configuration.csproj
+++ b/SEBPatcher.Configuration/SEBPatcher.Configuration.csproj
@@ -6,7 +6,7 @@
{6E7CE06E-5C8A-40F9-8DCA-0C72D30A4AEF}
Library
SEBPatcher.Configuration
- SEBPatcher.Configuration
+ SafeExamBrowser.Configuration.SEBPatcher.mm
v4.7
diff --git a/SEBPatcher.Configuration/patch_IntegrityModule.cs b/SEBPatcher.Configuration/patch_IntegrityModule.cs
index a6d6f0b..1031b56 100644
--- a/SEBPatcher.Configuration/patch_IntegrityModule.cs
+++ b/SEBPatcher.Configuration/patch_IntegrityModule.cs
@@ -6,5 +6,15 @@ namespace SafeExamBrowser.Configuration.Integrity
public class patch_IntegrityModule : IntegrityModule
{
[MonoModIgnore] public patch_IntegrityModule(Configuration.Contracts.AppConfig appConfig, SafeExamBrowser.Logging.Contracts.ILogger logger) : base(appConfig, logger) { }
+
+ [MonoModOriginal] public extern bool orig_TryVerifyCodeSignature(out bool isValid);
+#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
+ public bool TryVerifyCodeSignature(out bool isValid)
+#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
+ {
+ bool result = orig_TryVerifyCodeSignature(out isValid);
+ isValid = true;
+ return true;
+ }
}
}
diff --git a/SEBPatcher.Monitoring/Applications/ApplicationMonitor.cs b/SEBPatcher.Monitoring/Applications/ApplicationMonitor.cs
deleted file mode 100644
index f19c54b..0000000
--- a/SEBPatcher.Monitoring/Applications/ApplicationMonitor.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-namespace SEBPatcher.Monitoring.Applications
-{
- public class ApplicationMonitor
- {
- public ApplicationMonitor()
- {
- }
- }
-}
diff --git a/SEBPatcher.Monitoring/Display/patch_DisplayMonitor.cs b/SEBPatcher.Monitoring/Display/patch_DisplayMonitor.cs
new file mode 100644
index 0000000..34df7a3
--- /dev/null
+++ b/SEBPatcher.Monitoring/Display/patch_DisplayMonitor.cs
@@ -0,0 +1,34 @@
+using System;
+using MonoMod;
+using SafeExamBrowser.Logging.Contracts;
+using SafeExamBrowser.SystemComponents.Contracts;
+using SafeExamBrowser.Monitoring.Contracts.Display;
+using SafeExamBrowser.Settings.Monitoring;
+using SafeExamBrowser.WindowsApi.Contracts;
+
+namespace SafeExamBrowser.Monitoring.Display
+{
+#pragma warning disable IDE1006 // Naming Styles
+ public class patch_DisplayMonitor : DisplayMonitor
+#pragma warning restore IDE1006 // Naming Styles
+ {
+ [MonoModIgnore] public patch_DisplayMonitor(ILogger logger, INativeMethods nativeMethods, ISystemInfo systemInfo) : base(logger, nativeMethods, systemInfo) { }
+
+#pragma warning disable IDE1006 // Naming Styles
+ [MonoModOriginal] public extern ValidationResult orig_ValidateConfiguration(DisplaySettings settings);
+#pragma warning restore IDE1006 // Naming Styles
+#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
+ public ValidationResult ValidateConfiguration(DisplaySettings settings)
+#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
+ {
+ ValidationResult result = orig_ValidateConfiguration(settings);
+
+ return new ValidationResult
+ {
+ ExternalDisplays = 0,
+ InternalDisplays = 1,
+ IsAllowed = true
+ };
+ }
+ }
+}
diff --git a/SEBPatcher.Monitoring/SEBPatcher.Monitoring.csproj b/SEBPatcher.Monitoring/SEBPatcher.Monitoring.csproj
index 6d28a9f..cc50be5 100644
--- a/SEBPatcher.Monitoring/SEBPatcher.Monitoring.csproj
+++ b/SEBPatcher.Monitoring/SEBPatcher.Monitoring.csproj
@@ -73,16 +73,25 @@
$(ReferenceBasePath)\SafeExamBrowser.Settings.dll
+
+ $(ReferenceBasePath)\SafeExamBrowser.Monitoring.Contracts.dll
+
-
+
-
+
+
+
+
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}
+ SEBPatcherUtils
+
diff --git a/SEBPatcher.Monitoring/patch_VirtualMachineDetector.cs b/SEBPatcher.Monitoring/patch_VirtualMachineDetector.cs
index 232947b..93ab2f7 100644
--- a/SEBPatcher.Monitoring/patch_VirtualMachineDetector.cs
+++ b/SEBPatcher.Monitoring/patch_VirtualMachineDetector.cs
@@ -1,6 +1,5 @@
-using System;
-using SafeExamBrowser.Monitoring;
-using MonoMod;
+using MonoMod;
+using SEBPatcherUtils;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Registry;
@@ -12,11 +11,11 @@ namespace SafeExamBrowser.Monitoring
#pragma warning restore IDE1006 // Naming Styles
{
[MonoModIgnore] public patch_VirtualMachineDetector(ILogger logger, IRegistry registry, ISystemInfo systemInfo) : base(logger, registry, systemInfo) { }
- //[MonoModOriginal] public extern void orig_VirtualMachineDetector();
- //[MonoModConstructor] public void VirtualMachineDetector()
- //{
- // orig_VirtualMachineDetector();
- //}
+ [MonoModOriginal] public extern void orig_VirtualMachineDetector();
+ [MonoModConstructor] public void VirtualMachineDetector()
+ {
+ orig_VirtualMachineDetector();
+ }
#pragma warning disable IDE1006 // Naming Styles
[MonoModOriginal] public extern bool orig_IsVirtualMachine();
diff --git a/SEBPatcher.sln b/SEBPatcher.sln
index eefca68..6956a1b 100644
--- a/SEBPatcher.sln
+++ b/SEBPatcher.sln
@@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SEBPatcher.Monitoring", "SE
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SEBPatcher.Configuration", "SEBPatcher.Configuration\SEBPatcher.Configuration.csproj", "{6E7CE06E-5C8A-40F9-8DCA-0C72D30A4AEF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SEBPatcherUtils", "SEBPatcherUtils\SEBPatcherUtils.csproj", "{82F861DC-D8C7-46F9-AA60-B67CF43712D5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,5 +21,9 @@ Global
{6E7CE06E-5C8A-40F9-8DCA-0C72D30A4AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E7CE06E-5C8A-40F9-8DCA-0C72D30A4AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E7CE06E-5C8A-40F9-8DCA-0C72D30A4AEF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/SEBPatcherUtils/Constants.cs b/SEBPatcherUtils/Constants.cs
new file mode 100644
index 0000000..37a6b58
--- /dev/null
+++ b/SEBPatcherUtils/Constants.cs
@@ -0,0 +1,11 @@
+namespace SEBPatcherUtils
+{
+ public class Constants
+ {
+ public string patcherVersion = "1.0.0";
+
+ public string sebTargetVersion = "3.8.0";
+
+ public string monomodNetVersion = "4.5.2";
+ }
+}
diff --git a/SEBPatcherUtils/PatchLogger.cs b/SEBPatcherUtils/PatchLogger.cs
new file mode 100644
index 0000000..b0c1d5d
--- /dev/null
+++ b/SEBPatcherUtils/PatchLogger.cs
@@ -0,0 +1,55 @@
+using System;
+using System.IO;
+
+namespace SEBPatcherUtils
+{
+ public class PatchLogger
+ {
+ private readonly string _logFilePath;
+ private readonly string _logModule;
+
+ public PatchLogger(string logModule, string logFilePath)
+ {
+ _logFilePath = logFilePath;
+ _logModule = logModule;
+ }
+
+ public void Log(string message, string logLevel = "INFO")
+ {
+ string logEntry = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [SEBPatcher] [{_logModule}] [{logLevel}] {message}";
+ AppendToFile(logEntry);
+ }
+
+ public void Info(string message)
+ {
+ Log(message, "INFO");
+ }
+
+ public void Error(string message)
+ {
+ Log(message, "ERROR");
+ }
+
+ public void Warning(string message)
+ {
+ Log(message, "WARNING");
+ }
+
+ public void Debug(string message)
+ {
+ Log(message, "DEBUG");
+ }
+
+ public void AppendToFile(string logEntry)
+ {
+ try
+ {
+ File.AppendAllText(_logFilePath, logEntry + Environment.NewLine);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[SEBPatcher] Failed to write to log file: {ex.Message}");
+ }
+ }
+ }
+}
diff --git a/SEBPatcherUtils/Properties/AssemblyInfo.cs b/SEBPatcherUtils/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..67490a0
--- /dev/null
+++ b/SEBPatcherUtils/Properties/AssemblyInfo.cs
@@ -0,0 +1,26 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("SEBPatcherUtils")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("${AuthorCopyright}")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
diff --git a/SEBPatcherUtils/SEBPatcherUtils.csproj b/SEBPatcherUtils/SEBPatcherUtils.csproj
new file mode 100644
index 0000000..7d81480
--- /dev/null
+++ b/SEBPatcherUtils/SEBPatcherUtils.csproj
@@ -0,0 +1,38 @@
+
+
+
+ Debug
+ AnyCPU
+ {82F861DC-D8C7-46F9-AA60-B67CF43712D5}
+ Library
+ SEBPatcherUtils
+ SEBPatcherUtils
+ v4.7
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ false
+
+
+ true
+ bin\Release
+ prompt
+ 4
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file