RPS.Screensaver.IsRunAsAdmin C# (CSharp) 메소드

IsRunAsAdmin() 정적인 개인적인 메소드

The function checks whether the current process is run as administrator. In other words, it dictates whether the primary access token of the process belongs to user account that is a member of the local Administrators group and it is elevated.
static private IsRunAsAdmin ( ) : bool
리턴 bool
        static bool IsRunAsAdmin() {
            WindowsIdentity id = WindowsIdentity.GetCurrent();
            WindowsPrincipal principal = new WindowsPrincipal(id);
            return principal.IsInRole(WindowsBuiltInRole.Administrator);
        }