Testing Client patch

This commit is contained in:
zervo 2024-11-15 08:01:26 +01:00
parent 31e2fa1264
commit 13d584a24c
4 changed files with 16 additions and 11 deletions

3
.gitignore vendored
View file

@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# Personally customizable settings
Directory.Build.props
# User-specific files
*.suo
*.user

View file

@ -10,11 +10,15 @@ In order to use the patches, do the following:
1. Get the patch DLLs: build them or get them from releases.
2. Put patch DLLs into SafeExamBrowser\Application.
2. Put patch DLLs into %appdata%\SafeExamBrowser\Application.
3. Get MonoMod and put all its files into SafeExamBrowser\Application.
3. Get MonoMod and put all its files into %appdata%\SafeExamBrowser\Application.
4. Run MonoMod on all relevant DLLs, eg. `.\MonoMod.exe SafeExamBrowser.Monitoring.dll`
4. Run MonoMod on all target DLLs, eg. `.\MonoMod.exe SafeExamBrowser.Monitoring.dll`.
Note that you might get an error about not being able to find dependencies, in this case you should set the environment variable 'MONOMOD_DEPENDENCY_MISSING_THROW' to '1'.
If you have to do this, make sure to doublecheck the patched DLLs with something like dnSpy so that they are correct.
5. Rename the patched DLLs once they have been patched correctly (MONOMODDED_xxxxx) and remove the MONOMODDED prefix, replacing the original files.
## Development
@ -26,6 +30,8 @@ Set `ReferenceBasePath` to your SEB installation (SafeExamBrowser\Application).
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.
Some targets (namely SafeExamBrowser.Client.exe) has private/internal members that we need to deal with, to do this we first publicize it using n-strip, and then reference to the stripped binary instead.
## Resources
This depends on MonoMod and SafeExamBrowser.

View file

@ -94,10 +94,6 @@
<HintPath>$(ReferenceBasePath)\SafeExamBrowser.Logging.Contracts.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SafeExamBrowser.SystemComponents">
<HintPath>$(ReferenceBasePath)\SafeExamBrowser.SystemComponents.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SafeExamBrowser.SystemComponents.Contracts">
<HintPath>$(ReferenceBasePath)\SafeExamBrowser.SystemComponents.Contracts.dll</HintPath>
<Private>False</Private>

View file

@ -11,19 +11,19 @@ using SafeExamBrowser.Client.Contracts;
namespace SafeExamBrowser.Client
{
#pragma warning disable IDE1006 // Naming Styles
internal class patch_ClientController : ClientController
public class patch_ClientController : ClientController
#pragma warning restore IDE1006 // Naming Styles
{
public PatchLogger patchlogger;
[MonoModIgnore] internal patch_ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory) : base(actionCenter, applicationMonitor, context, coordinator, displayMonitor, explorerShell, fileSystemDialog, hashAlgorithm, logger, messageBox, networkAdapter, operations, runtime, shutdown, splashScreen, sentinel, taskbar, text, uiFactory) { }
[MonoModIgnore] public patch_ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory) : base(actionCenter, applicationMonitor, context, coordinator, displayMonitor, explorerShell, fileSystemDialog, hashAlgorithm, logger, messageBox, networkAdapter, operations, runtime, shutdown, splashScreen, sentinel, taskbar, text, uiFactory) { }
#pragma warning disable IDE1006 // Naming Styles
#pragma warning disable RECS0082 // Parameter has the same name as a member and hides it
[MonoModOriginal] internal extern void orig_ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory);
[MonoModOriginal] public extern void orig_ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory);
#pragma warning restore RECS0082 // Parameter has the same name as a member and hides it
#pragma warning restore IDE1006 // Naming Styles
#pragma warning disable RECS0082 // Parameter has the same name as a member and hides it
[MonoModConstructor] internal void ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory)
[MonoModConstructor] public void ClientController(SafeExamBrowser.UserInterface.Contracts.Shell.IActionCenter actionCenter, SafeExamBrowser.Monitoring.Contracts.Applications.IApplicationMonitor applicationMonitor, ClientContext context, ICoordinator coordinator, SafeExamBrowser.Monitoring.Contracts.Display.IDisplayMonitor displayMonitor, SafeExamBrowser.WindowsApi.Contracts.IExplorerShell explorerShell, SafeExamBrowser.UserInterface.Contracts.FileSystemDialog.IFileSystemDialog fileSystemDialog, SafeExamBrowser.Configuration.Contracts.Cryptography.IHashAlgorithm hashAlgorithm, SafeExamBrowser.Logging.Contracts.ILogger logger, SafeExamBrowser.UserInterface.Contracts.MessageBox.IMessageBox messageBox, SafeExamBrowser.SystemComponents.Contracts.Network.INetworkAdapter networkAdapter, SafeExamBrowser.Core.Contracts.OperationModel.IOperationSequence operations, SafeExamBrowser.Communication.Contracts.Proxies.IRuntimeProxy runtime, Action shutdown, SafeExamBrowser.UserInterface.Contracts.Windows.ISplashScreen splashScreen, SafeExamBrowser.Monitoring.Contracts.System.ISystemSentinel sentinel, SafeExamBrowser.UserInterface.Contracts.Shell.ITaskbar taskbar, SafeExamBrowser.I18n.Contracts.IText text, SafeExamBrowser.UserInterface.Contracts.IUserInterfaceFactory uiFactory)
#pragma warning restore RECS0082 // Parameter has the same name as a member and hides it
{
orig_ClientController(actionCenter, applicationMonitor, context, coordinator, displayMonitor, explorerShell, fileSystemDialog, hashAlgorithm, logger, messageBox, networkAdapter, operations, runtime, shutdown, splashScreen, sentinel, taskbar, text, uiFactory);