mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTDLL_APITEST] Add alignment probing tests for Query/Set information thread related routines
This commit is contained in:
parent
3b53b3d07f
commit
efaa7b6a24
2 changed files with 68 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <internal/ps_i.h>
|
||||
|
||||
static
|
||||
void
|
||||
|
@ -100,7 +101,40 @@ Test_ThreadBasicInformationClass(void)
|
|||
HeapFree(GetProcessHeap(), 0, ThreadInfoBasic);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
Test_ThreadQueryAlignmentProbe(void)
|
||||
{
|
||||
ULONG InfoClass;
|
||||
|
||||
/* Iterate over the process info classes and begin the tests */
|
||||
for (InfoClass = 0; InfoClass < _countof(PsThreadInfoClass); InfoClass++)
|
||||
{
|
||||
/* The buffer is misaligned */
|
||||
QuerySetThreadValidator(QUERY,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)1,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeQUERY,
|
||||
STATUS_DATATYPE_MISALIGNMENT);
|
||||
|
||||
/* We query an invalid buffer address */
|
||||
QuerySetThreadValidator(QUERY,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentQUERY,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeQUERY,
|
||||
STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* The information length is wrong */
|
||||
QuerySetThreadValidator(QUERY,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentQUERY,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeQUERY - 1,
|
||||
STATUS_INFO_LENGTH_MISMATCH);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(NtQueryInformationThread)
|
||||
{
|
||||
Test_ThreadBasicInformationClass();
|
||||
Test_ThreadQueryAlignmentProbe();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <internal/ps_i.h>
|
||||
|
||||
static
|
||||
void
|
||||
|
@ -94,7 +95,40 @@ Test_ThreadPriorityClass(void)
|
|||
HeapFree(GetProcessHeap(), 0, Priority);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
Test_ThreadSetAlignmentProbe(void)
|
||||
{
|
||||
ULONG InfoClass;
|
||||
|
||||
/* Iterate over the process info classes and begin the tests */
|
||||
for (InfoClass = 0; InfoClass < _countof(PsThreadInfoClass); InfoClass++)
|
||||
{
|
||||
/* The buffer is misaligned */
|
||||
QuerySetThreadValidator(SET,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)1,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeSET,
|
||||
STATUS_DATATYPE_MISALIGNMENT);
|
||||
|
||||
/* We set an invalid buffer address */
|
||||
QuerySetThreadValidator(SET,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentSET,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeSET,
|
||||
STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* The information length is wrong */
|
||||
QuerySetThreadValidator(SET,
|
||||
InfoClass,
|
||||
(PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentSET,
|
||||
PsThreadInfoClass[InfoClass].RequiredSizeSET - 1,
|
||||
STATUS_INFO_LENGTH_MISMATCH);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(NtSetInformationThread)
|
||||
{
|
||||
Test_ThreadPriorityClass();
|
||||
Test_ThreadSetAlignmentProbe();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue