[NTDLL_APITEST] Use RtlConvertUlongToLuid

This commit is contained in:
Ratin Gao 2024-04-26 13:58:54 +08:00 committed by George Bișoc
parent ffd060295d
commit ff12fc9fb9
3 changed files with 2 additions and 15 deletions

View file

@ -15,13 +15,10 @@ IsPrivilegeEnabled(
{ {
PRIVILEGE_SET PrivSet; PRIVILEGE_SET PrivSet;
BOOL Result, Success; BOOL Result, Success;
LUID Priv;
ConvertPrivLongToLuid(Privilege, &Priv);
PrivSet.PrivilegeCount = 1; PrivSet.PrivilegeCount = 1;
PrivSet.Control = PRIVILEGE_SET_ALL_NECESSARY; PrivSet.Control = PRIVILEGE_SET_ALL_NECESSARY;
PrivSet.Privilege[0].Luid = Priv; PrivSet.Privilege[0].Luid = RtlConvertUlongToLuid(Privilege);
PrivSet.Privilege[0].Attributes = 0; PrivSet.Privilege[0].Attributes = 0;
Success = PrivilegeCheck(TokenHandle, &PrivSet, &Result); Success = PrivilegeCheck(TokenHandle, &PrivSet, &Result);

View file

@ -31,7 +31,6 @@ START_TEST(NtFilterToken)
NTSTATUS Status; NTSTATUS Status;
HANDLE FilteredToken, Token; HANDLE FilteredToken, Token;
TOKEN_PRIVILEGES Priv; TOKEN_PRIVILEGES Priv;
LUID PrivLuid;
ULONG Size; ULONG Size;
PTOKEN_STATISTICS TokenStats; PTOKEN_STATISTICS TokenStats;
@ -107,8 +106,7 @@ START_TEST(NtFilterToken)
/* Fill in a privilege to delete */ /* Fill in a privilege to delete */
Priv.PrivilegeCount = 1; Priv.PrivilegeCount = 1;
ConvertPrivLongToLuid(SE_BACKUP_PRIVILEGE, &PrivLuid); Priv.Privileges[0].Luid = RtlConvertUlongToLuid(SE_BACKUP_PRIVILEGE);
Priv.Privileges[0].Luid = PrivLuid;
Priv.Privileges[0].Attributes = 0; Priv.Privileges[0].Attributes = 0;
/* Delete the privileges */ /* Delete the privileges */

View file

@ -41,12 +41,4 @@ SetupLocale(
_In_ ULONG OemCode, _In_ ULONG OemCode,
_In_ ULONG Unicode); _In_ ULONG Unicode);
#define ConvertPrivLongToLuid(PrivilegeVal, ConvertedPrivLuid) \
do { \
LUID Luid; \
Luid.LowPart = PrivilegeVal; \
Luid.HighPart = 0; \
*ConvertedPrivLuid = Luid; \
} while (0)
#endif /* _NTDLL_APITEST_PRECOMP_H_ */ #endif /* _NTDLL_APITEST_PRECOMP_H_ */