How to get system privileges

I have a C # program that requires SeSystemEnvironmentPrivilegeaccess to UEFI NVRAM.

I found a very long code that uses Win32 APIto get privileges, but is there a .NET version to get it? In a process class or somewhere else?

+4
source share
1 answer

If it is really necessary, you can use the AdjustTokenPrivileges function. Something like that:

 [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
    internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
    ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);

You can get more information here:

+4

Source: https://habr.com/ru/post/1625845/


All Articles