//private readonly PrivilegeName _privilegeName; #endregion #region IDisposable Implementation and Cleanup /// <summary> /// Cleanup /// </summary> protected virtual void Cleanup() { //Restore previous state PrivilegeProvider.AdjustTokenPrivileges(_process, false, _previousState); }
/// <summary> /// Constructor /// </summary> public AdjustPrivilege(PrivilegeName privilegeName) { _process = Process.GetCurrentProcess(); _previousState = PrivilegeProvider.EnablePrivilege(_process, privilegeName); }