Restore SEBPatch
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.WindowsApi.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about the currently active application.
|
||||
/// </summary>
|
||||
public class ActiveApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// The process which owns the currently active window.
|
||||
/// </summary>
|
||||
public IProcess Process { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently active window (i.e. the window which currently has input focus).
|
||||
/// </summary>
|
||||
public IWindow Window { get; }
|
||||
|
||||
public ActiveApplication(IProcess process, IWindow window)
|
||||
{
|
||||
Process = process;
|
||||
Window = window;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the Windows Explorer has been started.
|
||||
/// </summary>
|
||||
public delegate void ExplorerStartedEventHandler();
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using SafeExamBrowser.WindowsApi.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that a new instance of a whitelisted application has been started.
|
||||
/// </summary>
|
||||
public delegate void InstanceStartedEventHandler(Guid applicationId, IProcess process);
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the given blacklisted applications could not be terminated.
|
||||
/// </summary>
|
||||
public delegate void TerminationFailedEventHandler(IEnumerable<RunningApplication> applications);
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.Monitoring.Contracts.Applications.Events;
|
||||
using SafeExamBrowser.Settings.Applications;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// Monitors applications running on the computer.
|
||||
/// </summary>
|
||||
public interface IApplicationMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// Event fired when a new instance of the Windows Explorer has been started.
|
||||
/// </summary>
|
||||
event ExplorerStartedEventHandler ExplorerStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when a new instance of a whitelisted application has been started.
|
||||
/// </summary>
|
||||
event InstanceStartedEventHandler InstanceStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the automatic termination of a blacklisted application failed.
|
||||
/// </summary>
|
||||
event TerminationFailedEventHandler TerminationFailed;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the application monitor.
|
||||
/// </summary>
|
||||
InitializationResult Initialize(ApplicationSettings settings);
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring all initialized applications. Windows Explorer will always be monitored.
|
||||
/// </summary>
|
||||
void Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stops the application monitoring.
|
||||
/// </summary>
|
||||
void Stop();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to retrieve the currently active application (i.e. the application which currently has input focus). Returns <c>true</c> if
|
||||
/// successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool TryGetActiveApplication(out ActiveApplication application);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to terminate all processes of the specified application. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool TryTerminate(RunningApplication application);
|
||||
}
|
||||
}
|
28
SafeExamBrowser.Monitoring.Contracts/Applications/IWindow.cs
Normal file
28
SafeExamBrowser.Monitoring.Contracts/Applications/IWindow.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a native window handled by the operating system.
|
||||
/// </summary>
|
||||
public interface IWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// The handle of the window.
|
||||
/// </summary>
|
||||
IntPtr Handle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The title of the window.
|
||||
/// </summary>
|
||||
string Title { get; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about the initialization of the <see cref="IApplicationMonitor"/>.
|
||||
/// </summary>
|
||||
public class InitializationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of currently running applications which could not be automatically terminated.
|
||||
/// </summary>
|
||||
public IList<RunningApplication> FailedAutoTerminations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of currently running applications which need to be terminated.
|
||||
/// </summary>
|
||||
public IList<RunningApplication> RunningApplications { get; }
|
||||
|
||||
public InitializationResult()
|
||||
{
|
||||
FailedAutoTerminations = new List<RunningApplication>();
|
||||
RunningApplications = new List<RunningApplication>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.WindowsApi.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about a running application.
|
||||
/// </summary>
|
||||
public class RunningApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the application.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of processes which belong to the application.
|
||||
/// </summary>
|
||||
public IList<IProcess> Processes { get; }
|
||||
|
||||
public RunningApplication(string name)
|
||||
{
|
||||
Name = name;
|
||||
Processes = new List<IProcess>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Display.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the configuration of a display has changed.
|
||||
/// </summary>
|
||||
public delegate void DisplayChangedEventHandler();
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.Monitoring.Contracts.Display.Events;
|
||||
using SafeExamBrowser.Settings.Monitoring;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Monitors the displays of the computer for changes and provides access to display-related functionality.
|
||||
/// </summary>
|
||||
public interface IDisplayMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// Event fired when the primary display or its settings have changed.
|
||||
/// </summary>
|
||||
event DisplayChangedEventHandler DisplayChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the desktop working area to accommodate to the taskbar's height and removes the configured wallpaper (if possible).
|
||||
/// </summary>
|
||||
void InitializePrimaryDisplay(int taskbarHeight);
|
||||
|
||||
/// <summary>
|
||||
/// Resets the desktop working area and wallpaper to their previous (initial) state.
|
||||
/// </summary>
|
||||
void ResetPrimaryDisplay();
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring for display changes, i.e. display changes will trigger the <c>DisplaySettingsChanged</c> event.
|
||||
/// </summary>
|
||||
void StartMonitoringDisplayChanges();
|
||||
|
||||
/// <summary>
|
||||
/// Stops monitoring for display changes.
|
||||
/// </summary>
|
||||
void StopMonitoringDisplayChanges();
|
||||
|
||||
/// <summary>
|
||||
/// Validates the currently active display configuration according to the given settings.
|
||||
/// </summary>
|
||||
ValidationResult ValidateConfiguration(DisplaySettings settings);
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Display
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the result of a display configuration validation.
|
||||
/// </summary>
|
||||
public class ValidationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the count of external displays detected.
|
||||
/// </summary>
|
||||
public int ExternalDisplays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the count of internal displays detected.
|
||||
/// </summary>
|
||||
public int InternalDisplays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the active display configuration is allowed.
|
||||
/// </summary>
|
||||
public bool IsAllowed { get; set; }
|
||||
}
|
||||
}
|
28
SafeExamBrowser.Monitoring.Contracts/IClipboard.cs
Normal file
28
SafeExamBrowser.Monitoring.Contracts/IClipboard.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.Settings.Security;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Monitors the system clipboard and provides related functionality.
|
||||
/// </summary>
|
||||
public interface IClipboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the system clipboard according to the given policy.
|
||||
/// </summary>
|
||||
void Initialize(ClipboardPolicy policy);
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes the system clipboard.
|
||||
/// </summary>
|
||||
void Terminate();
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides functionality related to remote session detection.
|
||||
/// </summary>
|
||||
public interface IRemoteSessionDetector
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the system is currently running in a remote session.
|
||||
/// </summary>
|
||||
bool IsRemoteSession();
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides functionality related to virtual machine detection.
|
||||
/// </summary>
|
||||
public interface IVirtualMachineDetector
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the computer is in fact a virtual machine.
|
||||
/// </summary>
|
||||
bool IsVirtualMachine();
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Keyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Intercepts all keyboard input (except the Secure Attention Sequence: https://en.wikipedia.org/wiki/Secure_attention_key).
|
||||
/// </summary>
|
||||
public interface IKeyboardInterceptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts intercepting keyboard input.
|
||||
/// </summary>
|
||||
void Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stops intercepting keyboard input.
|
||||
/// </summary>
|
||||
void Stop();
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.Mouse
|
||||
{
|
||||
/// <summary>
|
||||
/// Intercepts all mouse input.
|
||||
/// </summary>
|
||||
public interface IMouseInterceptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts intercepting mouse input.
|
||||
/// </summary>
|
||||
void Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stops intercepting mouse input.
|
||||
/// </summary>
|
||||
void Stop();
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SafeExamBrowser.Monitoring.Contracts")]
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.Monitoring.Contracts")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("6d563a30-366d-4c35-815b-2c9e6872278b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6D563A30-366D-4C35-815B-2C9E6872278B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SafeExamBrowser.Monitoring.Contracts</RootNamespace>
|
||||
<AssemblyName>SafeExamBrowser.Monitoring.Contracts</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Applications\ActiveApplication.cs" />
|
||||
<Compile Include="Applications\Events\InstanceStartedEventHandler.cs" />
|
||||
<Compile Include="Applications\Events\TerminationFailedEventHandler.cs" />
|
||||
<Compile Include="Applications\IWindow.cs" />
|
||||
<Compile Include="Applications\RunningApplication.cs" />
|
||||
<Compile Include="Display\Events\DisplayChangedEventHandler.cs" />
|
||||
<Compile Include="Applications\Events\ExplorerStartedEventHandler.cs" />
|
||||
<Compile Include="Display\IDisplayMonitor.cs" />
|
||||
<Compile Include="Display\ValidationResult.cs" />
|
||||
<Compile Include="IClipboard.cs" />
|
||||
<Compile Include="IRemoteSessionDetector.cs" />
|
||||
<Compile Include="IVirtualMachineDetector.cs" />
|
||||
<Compile Include="Keyboard\IKeyboardInterceptor.cs" />
|
||||
<Compile Include="Mouse\IMouseInterceptor.cs" />
|
||||
<Compile Include="Applications\InitializationResult.cs" />
|
||||
<Compile Include="Applications\IApplicationMonitor.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="System\Events\SentinelEventArgs.cs" />
|
||||
<Compile Include="System\Events\SentinelEventHandler.cs" />
|
||||
<Compile Include="System\Events\SessionChangedEventHandler.cs" />
|
||||
<Compile Include="System\ISystemSentinel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Settings\SafeExamBrowser.Settings.csproj">
|
||||
<Project>{30b2d907-5861-4f39-abad-c4abf1b3470e}</Project>
|
||||
<Name>SafeExamBrowser.Settings</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.WindowsApi.Contracts\SafeExamBrowser.WindowsApi.Contracts.csproj">
|
||||
<Project>{7016f080-9aa5-41b2-a225-385ad877c171}</Project>
|
||||
<Name>SafeExamBrowser.WindowsApi.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.System.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// The event arguments used for the <see cref="SentinelEventHandler"/> fired by the <see cref="ISystemSentinel"/>.
|
||||
/// </summary>
|
||||
public class SentinelEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether a configuration or state change shall be allowed.
|
||||
/// </summary>
|
||||
public bool Allow { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.System.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// The default handler for events of the <see cref="ISystemSentinel"/>. Normally indicates that a configuration or state has changed.
|
||||
/// </summary>
|
||||
public delegate void SentinelEventHandler(SentinelEventArgs args);
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.System.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the active user session of the operating system has changed.
|
||||
/// </summary>
|
||||
public delegate void SessionChangedEventHandler();
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.Monitoring.Contracts.System.Events;
|
||||
|
||||
namespace SafeExamBrowser.Monitoring.Contracts.System
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the possibility to suppress and surveil various system components and functionalities.
|
||||
/// </summary>
|
||||
public interface ISystemSentinel
|
||||
{
|
||||
/// <summary>
|
||||
/// Event fired when the cursor configuration has changed.
|
||||
/// </summary>
|
||||
event SentinelEventHandler CursorChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the ease of access configuration has changed.
|
||||
/// </summary>
|
||||
event SentinelEventHandler EaseOfAccessChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the active user session has changed.
|
||||
/// </summary>
|
||||
event SessionChangedEventHandler SessionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the sticky keys state has changed.
|
||||
/// </summary>
|
||||
event SentinelEventHandler StickyKeysChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to disable the sticky keys. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool DisableStickyKeys();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to enable the sticky keys. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool EnableStickyKeys();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to revert the sticky keys to their initial state. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool RevertStickyKeys();
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring the cursor configuration.
|
||||
/// </summary>
|
||||
void StartMonitoringCursors();
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring the ease of access configuration.
|
||||
/// </summary>
|
||||
void StartMonitoringEaseOfAccess();
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring the sticky keys state.
|
||||
/// </summary>
|
||||
void StartMonitoringStickyKeys();
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring the system events.
|
||||
/// </summary>
|
||||
void StartMonitoringSystemEvents();
|
||||
|
||||
/// <summary>
|
||||
/// Stops all monitoring operations.
|
||||
/// </summary>
|
||||
void StopMonitoring();
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the cursor configuration. Returns <c>true</c> if permitted, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool VerifyCursors();
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the ease of access configuration. Returns <c>true</c> if permitted, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool VerifyEaseOfAccess();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user