Windows: Make SetPrivilege return error if AdjustTokenPrivileges cannot adjust privileges

This commit is contained in:
Mounir IDRASSI 2023-06-23 00:32:24 +02:00
parent d4ae2ce893
commit 0e4f1ecee3
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F

View File

@ -13976,8 +13976,11 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable)
tkp.Privileges[0].Attributes = bEnable? SE_PRIVILEGE_ENABLED : SE_PRIVILEGE_REMOVED;
bRet = AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL);
if (!bRet)
dwLastError = GetLastError ();
dwLastError = GetLastError ();
if ( ERROR_SUCCESS != dwLastError)
{
bRet = FALSE;
}
}
else
dwLastError = GetLastError ();