mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-09 17:44:38 +01:00
ughhhhhhhhhhhhhhhhh
This commit is contained in:
parent
380c8732c6
commit
4042d138b2
11 changed files with 321 additions and 301 deletions
|
|
@ -0,0 +1,48 @@
|
|||
using Dalamud.Bootstrap.OS;
|
||||
using Dalamud.Bootstrap.OS.Windows.Raw;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
|
||||
namespace Dalamud.Bootstrap
|
||||
{
|
||||
public sealed partial class GameProcess : IDisposable
|
||||
{
|
||||
private SafeProcessHandle m_handle;
|
||||
|
||||
private GameProcess(SafeProcessHandle handle)
|
||||
{
|
||||
m_handle = handle;
|
||||
}
|
||||
|
||||
public static GameProcess Create(GameProcessCreationOptions options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static GameProcess Open(uint pid)
|
||||
{
|
||||
|
||||
var handle = OpenHandle(pid, TODO);
|
||||
|
||||
return new GameProcess(handle);
|
||||
}
|
||||
|
||||
private static SafeProcessHandle OpenHandle(uint pid, PROCESS_ACCESS_RIGHTS access)
|
||||
{
|
||||
var handle = Kernel32.OpenProcess((uint)access, false, pid);
|
||||
|
||||
if (handle.IsInvalid)
|
||||
{
|
||||
ProcessException.ThrowLastOsError();
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
m_handle?.Dispose();
|
||||
m_handle = null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue