This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
2020-05-25 19:32:53 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace CC_Functions.W32.Native
|
2020-01-15 17:59:29 +01:00
|
|
|
|
{
|
|
|
|
|
internal static class advapi32
|
|
|
|
|
{
|
|
|
|
|
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
|
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
|
|
|
internal static extern bool LookupPrivilegeValue(string lpsystemname, string lpname,
|
|
|
|
|
[MarshalAs(UnmanagedType.Struct)] ref Privileges.LUID lpLuid);
|
|
|
|
|
|
|
|
|
|
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
|
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
|
|
|
internal static extern bool AdjustTokenPrivileges(IntPtr tokenhandle,
|
|
|
|
|
[MarshalAs(UnmanagedType.Bool)] bool disableAllPrivileges,
|
|
|
|
|
[MarshalAs(UnmanagedType.Struct)] ref Privileges.TOKEN_PRIVILEGES newstate, uint bufferlength,
|
|
|
|
|
IntPtr previousState, IntPtr returnlength);
|
|
|
|
|
|
|
|
|
|
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
|
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
|
|
|
internal static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccesss,
|
|
|
|
|
out IntPtr tokenHandle);
|
|
|
|
|
}
|
|
|
|
|
}
|