Restore SEBPatch
This commit is contained in:
23
SafeExamBrowser.WindowsApi.Contracts/Events/KeyModifier.cs
Normal file
23
SafeExamBrowser.WindowsApi.Contracts/Events/KeyModifier.cs
Normal 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
|
||||
}
|
||||
}
|
20
SafeExamBrowser.WindowsApi.Contracts/Events/KeyState.cs
Normal file
20
SafeExamBrowser.WindowsApi.Contracts/Events/KeyState.cs
Normal 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
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
22
SafeExamBrowser.WindowsApi.Contracts/Events/MouseButton.cs
Normal file
22
SafeExamBrowser.WindowsApi.Contracts/Events/MouseButton.cs
Normal 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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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; }
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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();
|
||||
}
|
Reference in New Issue
Block a user