Skip to content

Commit

Permalink
Windows: Fix bug in disabling of Windows privileges, they were comple…
Browse files Browse the repository at this point in the history
…tely removed instead

This started to cause issues after latest changes to disable privileges when they are no more needed.
Because of the bug, the privileges could not be enabled again because they were wrongly removed.
  • Loading branch information
idrassi committed Sep 2, 2024
1 parent f024653 commit 0970a98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Common/Dlgcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -13706,11 +13706,11 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
&tkp.Privileges[0].Luid))
{
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : 0;

bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
dwLastError = GetLastError ();
if ( ERROR_SUCCESS != dwLastError)
if (bRet && (ERROR_NOT_ALL_ASSIGNED == dwLastError))
{
bRet = FALSE;
}
Expand Down

0 comments on commit 0970a98

Please sign in to comment.