ReactOS 0.4.16-dev-117-g38f21f9
NtSetInformationThread.c File Reference
#include "precomp.h"
#include <internal/ps_i.h>
Include dependency graph for NtSetInformationThread.c:

Go to the source code of this file.

Functions

static void Test_ThreadPriorityClass (void)
 
static void Test_ThreadSetAlignmentProbe (void)
 
 START_TEST (NtSetInformationThread)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtSetInformationThread  )

Definition at line 130 of file NtSetInformationThread.c.

131{
134}
static void Test_ThreadSetAlignmentProbe(void)
static void Test_ThreadPriorityClass(void)

◆ Test_ThreadPriorityClass()

static void Test_ThreadPriorityClass ( void  )
static

Definition at line 13 of file NtSetInformationThread.c.

14{
17
19 if (Priority == NULL)
20 {
21 skip("Failed to allocate memory for thread priority variable!\n");
22 return;
23 }
24
25 /* Assign a priority */
26 *Priority = 11;
27
28 /* Everything is NULL */
31 NULL,
32 0);
34
35 /* Give an invalid thread handle */
39 sizeof(KPRIORITY));
41
42 /* Don't set any priority to the thread */
45 NULL,
46 sizeof(KPRIORITY));
48
49 /* The information length is incorrect */
53 0);
55
56 /* The buffer is misaligned and information length is incorrect */
59 (PVOID)1,
60 0);
62
63 /* The buffer is misaligned */
66 (PVOID)1,
67 sizeof(KPRIORITY));
69
70 /* The buffer is misaligned -- try with an alignment size of 2 */
73 (PVOID)2,
74 sizeof(KPRIORITY));
76
77 /* Set the priority to the current thread */
81 sizeof(KPRIORITY));
83
84 /*
85 * Set the priority as LOW_REALTIME_PRIORITY,
86 * we don't have privileges to do so.
87 */
92 sizeof(KPRIORITY));
94
96}
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define ok_hex(expression, result)
Definition: atltest.h:94
#define skip(...)
Definition: atltest.h:64
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
@ ThreadPriority
Definition: compat.h:937
#define HeapFree(x, y, z)
Definition: compat.h:735
LONG KPRIORITY
Definition: compat.h:803
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
Status
Definition: gdiplustypes.h:25
#define LOW_REALTIME_PRIORITY
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: query.c:2018
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148

Referenced by START_TEST().

◆ Test_ThreadSetAlignmentProbe()

static void Test_ThreadSetAlignmentProbe ( void  )
static

Definition at line 100 of file NtSetInformationThread.c.

101{
102 ULONG InfoClass;
103
104 /* Iterate over the process info classes and begin the tests */
105 for (InfoClass = 0; InfoClass < _countof(PsThreadInfoClass); InfoClass++)
106 {
107 /* The buffer is misaligned */
109 InfoClass,
110 (PVOID)(ULONG_PTR)1,
111 PsThreadInfoClass[InfoClass].RequiredSizeSET,
113
114 /* We set an invalid buffer address */
116 InfoClass,
117 (PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentSET,
118 PsThreadInfoClass[InfoClass].RequiredSizeSET,
120
121 /* The information length is wrong */
123 InfoClass,
124 (PVOID)(ULONG_PTR)PsThreadInfoClass[InfoClass].AlignmentSET,
125 PsThreadInfoClass[InfoClass].RequiredSizeSET - 1,
127 }
128}
#define SET(field, seg, reg)
VOID QuerySetThreadValidator(_In_ ALIGNMENT_PROBE_MODE ValidationMode, _In_ ULONG InfoClassIndex, _In_ PVOID InfoPointer, _In_ ULONG InfoLength, _In_ NTSTATUS ExpectedStatus)
Definition: probelib.c:210
static const INFORMATION_CLASS_INFO PsThreadInfoClass[]
Definition: ps_i.h:360
#define _countof(array)
Definition: sndvol32.h:70
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().