2022-10-13 13:05:43 +02:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Security.Principal;
|
|
|
|
|
|
|
2024-04-26 19:41:44 +02:00
|
|
|
|
namespace HostsUILib.Helpers
|
2022-10-13 13:05:43 +02:00
|
|
|
|
{
|
|
|
|
|
|
public class ElevationHelper : IElevationHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly bool _isElevated;
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsElevated => _isElevated;
|
|
|
|
|
|
|
|
|
|
|
|
public ElevationHelper()
|
|
|
|
|
|
{
|
|
|
|
|
|
_isElevated = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|