5f9f7b5409
Add process memory priority foundation Introduce backend support for process memory priority using Windows GetProcessInformation and SetProcessInformation while keeping the feature testable and safe. - Add ProcessMemoryPriority model with documented Windows memory priority levels - Add fakeable native API wrapper for process memory priority - Add ProcessMemoryPriorityService with safe error handling - Add ProcessOperationResult for process operation outcomes - Extend persistent process rules with memory priority support - Apply memory priority through PersistentRulesEngine when configured - Preserve anti-cheat/protected-process safety messaging - Add tests for native get/set, invalid process, access denied, unsupported API, enum mapping, persistent rules and JSON roundtrip No UI redesign, registry/IFEO persistence, Windows Service, preset generator, migration, version or tag changes.
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
/*
|
|
* ThreadPilot - Windows process memory priority P/Invoke declarations.
|
|
*/
|
|
namespace ThreadPilot.Platforms.Windows
|
|
{
|
|
using System.Runtime.InteropServices;
|
|
using Microsoft.Win32.SafeHandles;
|
|
|
|
internal static partial class ProcessMemoryPriorityNativeMethods
|
|
{
|
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
|
public static partial SafeProcessHandle OpenProcess(
|
|
ProcessAccessFlags access,
|
|
[MarshalAs(UnmanagedType.Bool)] bool inheritHandle,
|
|
uint processId);
|
|
|
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
public static partial bool GetProcessInformation(
|
|
SafeProcessHandle process,
|
|
ProcessInformationClass processInformationClass,
|
|
ref MemoryPriorityInformation processInformation,
|
|
uint processInformationSize);
|
|
|
|
[LibraryImport("kernel32.dll", SetLastError = true)]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
public static partial bool SetProcessInformation(
|
|
SafeProcessHandle process,
|
|
ProcessInformationClass processInformationClass,
|
|
ref MemoryPriorityInformation processInformation,
|
|
uint processInformationSize);
|
|
}
|
|
}
|