mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 23:37:44 +01:00
err...
This commit is contained in:
parent
b5f1084f73
commit
9965dc313a
14 changed files with 381 additions and 406 deletions
49
Dalamud.Bootstrap/OS/Windows/Raw/Kernel32.cs
Normal file
49
Dalamud.Bootstrap/OS/Windows/Raw/Kernel32.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Dalamud.Bootstrap.OS.Windows.Raw
|
||||
{
|
||||
internal static unsafe class Kernel32
|
||||
{
|
||||
private const string Name = "kernel32";
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
public static extern SafeProcessHandle OpenProcess(uint dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, uint dwProcessId);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool TerminateProcess(SafeProcessHandle hProcess, int uExitCode);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool ReadProcessMemory(SafeProcessHandle hProcess, IntPtr lpBaseAddress, void* lpBuffer, IntPtr nSize, out IntPtr lpNumberOfBytesRead);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool WriteProcessMemory(SafeProcessHandle hProcess, IntPtr lpBaseAddress, void* lpBuffer, IntPtr nSize, out IntPtr lpNumberOfBytesWritten);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
public static extern void* LocalFree(void* hMem);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi)]
|
||||
public static extern uint GetProcessId(SafeProcessHandle hProcess);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetProcessTimes(SafeProcessHandle hProcess, out FILETIME lpCreationTime, out FILETIME lpExitTime, out FILETIME lpKernelTime, out FILETIME lpUserTime);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool QueryFullProcessImageNameW(SafeProcessHandle hProcess, uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpExeName, ref int lpdwSize);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool CreateProcessW(void* lpApplicationName, void* lpCommandLine, SECURITY_ATTRIBUTES* lpProcessAttributes, SECURITY_ATTRIBUTES* lpThreadAttributes, uint bInheritHandles, uint dwCreationFlags, void* lpEnvironment, void* lpCurrentDirectory, void* lpStartupInfo, void* lpProcessInformation);
|
||||
|
||||
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool CloseHandle(IntPtr hObject);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue