mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Improve admin check
This commit is contained in:
parent
588f8c956d
commit
a97f676595
@ -99,8 +99,12 @@ namespace Wabbajack
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var identity = WindowsIdentity.GetCurrent();
|
var identity = WindowsIdentity.GetCurrent();
|
||||||
|
var owner = identity.Owner;
|
||||||
|
if (owner is not null) return owner.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid);
|
||||||
|
|
||||||
var principle = new WindowsPrincipal(identity);
|
var principle = new WindowsPrincipal(identity);
|
||||||
return principle.IsInRole(WindowsBuiltInRole.Administrator);
|
return principle.IsInRole(WindowsBuiltInRole.Administrator);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user