ReactOS  0.4.15-dev-2947-g59e1b78
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 */
38  Priority,
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 */
52  Priority,
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 */
80  Priority,
81  sizeof(KPRIORITY));
83 
84  /*
85  * Set the priority as LOW_REALTIME_PRIORITY,
86  * we don't have privileges to do so.
87  */
91  Priority,
92  sizeof(KPRIORITY));
94 
96 }
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
#define LOW_REALTIME_PRIORITY
#define ok_hex(expression, result)
Definition: atltest.h:94
LONG KPRIORITY
Definition: compat.h:662
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
HANDLE WINAPI GetCurrentThread(VOID)
Definition: proc.c:1148
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: query.c:2018
Status
Definition: gdiplustypes.h:24
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define skip(...)
Definition: atltest.h:64
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define STATUS_SUCCESS
Definition: shellext.h:65
#define HeapFree(x, y, z)
Definition: compat.h:594

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)
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define _countof(array)
Definition: sndvol32.h:68
VOID QuerySetThreadValidator(_In_ ALIGNMENT_PROBE_MODE ValidationMode, _In_ ULONG InfoClassIndex, _In_ PVOID InfoPointer, _In_ ULONG InfoLength, _In_ NTSTATUS ExpectedStatus)
Definition: probelib.c:189
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
unsigned int ULONG
Definition: retypes.h:1
static const INFORMATION_CLASS_INFO PsThreadInfoClass[]
Definition: ps_i.h:360

Referenced by START_TEST().