Improve admin check

This commit is contained in:
erri120 2022-11-13 12:24:53 +01:00
parent 588f8c956d
commit a97f676595
No known key found for this signature in database

View File

@ -99,8 +99,12 @@ namespace Wabbajack
try
{
var identity = WindowsIdentity.GetCurrent();
var owner = identity.Owner;
if (owner is not null) return owner.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid);
var principle = new WindowsPrincipal(identity);
return principle.IsInRole(WindowsBuiltInRole.Administrator);
}
catch (Exception)
{