Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/*
* 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.WindowsApi.Contracts.Events
{
/// <summary>
/// The key modifiers which can be detected by a keyboard hook.
/// </summary>
[Flags]
public enum KeyModifier
{
None = 0,
Alt = 0b1,
Ctrl = 0b10
}
}

View File

@@ -0,0 +1,20 @@
/*
* 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.WindowsApi.Contracts.Events
{
/// <summary>
/// The key states which can be detected by a keyboard hook.
/// </summary>
public enum KeyState
{
Unknown = 0,
Pressed,
Released
}
}

View File

@@ -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.WindowsApi.Contracts.Events
{
/// <summary>
/// The callback for a keyboard hook. Return <c>true</c> to consume (i.e. block) the user input, otherwise <c>false</c>.
/// </summary>
public delegate bool KeyboardHookCallback(int keyCode, KeyModifier modifier, KeyState state);
}

View File

@@ -0,0 +1,22 @@
/*
* 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.WindowsApi.Contracts.Events
{
/// <summary>
/// The mouse buttons which can be detected by a mouse hook.
/// </summary>
public enum MouseButton
{
Unknown = 0,
Auxiliary,
Left,
Middle,
Right
}
}

View File

@@ -0,0 +1,20 @@
/*
* 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.WindowsApi.Contracts.Events
{
/// <summary>
/// The mouse button states which can be detected by a mouse hook.
/// </summary>
public enum MouseButtonState
{
Unknown = 0,
Pressed,
Released
}
}

View File

@@ -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.WindowsApi.Contracts.Events
{
/// <summary>
/// The callback for a mouse hook. Return <c>true</c> to consume (i.e. block) the user input, otherwise <c>false</c>.
/// </summary>
public delegate bool MouseHookCallback(MouseButton button, MouseButtonState state, MouseInformation info);
}

View File

@@ -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.WindowsApi.Contracts.Events
{
/// <summary>
/// The mouse information which can be detected by a mouse hook.
/// </summary>
public class MouseInformation
{
/// <summary>
/// Indicates whether the mouse event originates from a touch input by the user.
/// </summary>
public bool IsTouch { get; set; }
/// <summary>
/// The X coordinate of the current mouse position.
/// </summary>
public int X { get; set; }
/// <summary>
/// The Y coordinate of the current mouse position.
/// </summary>
public int Y { get; set; }
}
}

View File

@@ -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.WindowsApi.Contracts.Events
{
/// <summary>
/// Indicates that a process has terminated with the specified exit code.
/// </summary>
public delegate void ProcessTerminatedEventHandler(int exitCode);
}

View File

@@ -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;
namespace SafeExamBrowser.WindowsApi.Contracts.Events
{
/// <summary>
/// Defines the callback for system event hooks.
/// </summary>
public delegate void SystemEventCallback(IntPtr window);
}

View File

@@ -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.WindowsApi.Contracts.Events
{
/// <summary>
/// Event handler fired by the <see cref="ITerminationActivator"/> when the user would like to terminate the application.
/// </summary>
public delegate void TerminationActivatorEventHandler();
}