[KMTEST] Fix hacks in SeQueryInfoToken test and make it pass on Test WHS

This commit is contained in:
Timo Kreuzer 2023-05-06 19:40:05 +03:00
parent f0f58a5788
commit 7c81367e9b

View File

@ -204,6 +204,17 @@ void TestsSeQueryInformationToken(PACCESS_TOKEN Token)
//------------------------------------------------------------------------------//
GENERIC_MAPPING PspProcessMapping =
{
STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
STANDARD_RIGHTS_WRITE | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD |
PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_DUP_HANDLE |
PROCESS_TERMINATE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION |
PROCESS_SUSPEND_RESUME,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
PROCESS_ALL_ACCESS
};
//------------------------------------------------------------------------------//
// Body of the main test //
//------------------------------------------------------------------------------//
@ -211,13 +222,13 @@ void TestsSeQueryInformationToken(PACCESS_TOKEN Token)
START_TEST(SeQueryInfoToken)
{
PACCESS_STATE AccessState;
ACCESS_MASK AccessMask = MAXIMUM_ALLOWED;
//ACCESS_MASK AccessMask = MAXIMUM_ALLOWED;
ACCESS_MASK DesiredAccess = MAXIMUM_ALLOWED;
NTSTATUS Status = STATUS_SUCCESS;
PAUX_ACCESS_DATA AuxData = NULL;
PPRIVILEGE_SET NewPrivilegeSet;
BOOLEAN Checker;
PPRIVILEGE_SET Privileges = NULL;
//BOOLEAN Checker;
//PPRIVILEGE_SET Privileges = NULL;
PSECURITY_SUBJECT_CONTEXT SubjectContext = NULL;
PACCESS_TOKEN Token = NULL;
PTOKEN_PRIVILEGES TPrivileges;
@ -310,7 +321,7 @@ START_TEST(SeQueryInfoToken)
//----------------------------------------------------------------//
// Testing SeFreePrivileges //
//----------------------------------------------------------------//
#if 0 // FIXME: This test fails on Test WHS
Privileges = NULL;
Checker = SeAccessCheck(
AccessState->SecurityDescriptor,
@ -319,7 +330,7 @@ START_TEST(SeQueryInfoToken)
AccessState->OriginalDesiredAccess,
AccessState->PreviouslyGrantedAccess,
&Privileges,
(PGENERIC_MAPPING)((PCHAR*)PsProcessType + 52),
&PspProcessMapping,
KernelMode,
&AccessMask,
&Status
@ -332,7 +343,7 @@ START_TEST(SeQueryInfoToken)
AuxData->PrivilegeSet->PrivilegeCount, Privileges->PrivilegeCount);
}
if (Privileges) SeFreePrivileges(Privileges);
#endif
//----------------------------------------------------------------//
// Testing SePrivilegeCheck //
@ -370,7 +381,7 @@ START_TEST(SeQueryInfoToken)
}
// Call SeFreePrivileges again
#if 0 // FIXME: This test fails on Test WHS
Privileges = NULL;
Checker = SeAccessCheck(
AccessState->SecurityDescriptor,
@ -379,7 +390,7 @@ START_TEST(SeQueryInfoToken)
AccessState->OriginalDesiredAccess,
AccessState->PreviouslyGrantedAccess,
&Privileges,
(PGENERIC_MAPPING)((PCHAR*)PsProcessType + 52),
&PspProcessMapping,
KernelMode,
&AccessMask,
&Status
@ -392,7 +403,7 @@ START_TEST(SeQueryInfoToken)
AuxData->PrivilegeSet->PrivilegeCount, Privileges->PrivilegeCount);
}
if (Privileges) SeFreePrivileges(Privileges);
#endif
//----------------------------------------------------------------//
// Missing for now //
//----------------------------------------------------------------//