Export (0) Print
Expand All

ZwSetInformationThread routine

The ZwSetInformationThread routine sets the priority of a thread.

Syntax


NTSTATUS ZwSetInformationThread(
  _In_  HANDLE ThreadHandle,
  _In_  THREADINFOCLASS ThreadInformationClass,
  _In_  PVOID ThreadInformation,
  _In_  ULONG ThreadInformationLength
);

Parameters

ThreadHandle [in]

Handle to the thread object. To create a new thread and get a handle to it, call PsCreateSystemThread. To specify the current thread, use the ZwCurrentThread macro.

ThreadInformationClass [in]

Specifies one of the system-defined values, ThreadPriority or ThreadBasePriority.

ThreadInformation [in]

Pointer to a variable that specifies the information to set. If ThreadInformationClass is ThreadPriority, this value must be > LOW_PRIORITY and <= HIGH_PRIORITY. If ThreadInformationClass is ThreadBasePriority, this value must fall within the system's valid base-priority range and the original priority class for the given thread. That is, if a thread's priority class is variable, that thread's base priority cannot be reset to a real-time priority value, and vice versa.

ThreadInformationLength [in]

The size, in bytes, of ThreadInformation. The minimum value is sizeof(KPRIORITY).

Return value

ZwSetInformationThread returns STATUS_SUCCESS on success, or the appropriate NTSTATUS error code on failure. Possible error codes include STATUS_INFO_LENGTH_MISMATCH or STATUS_INVALID_PARAMETER.

Remarks

ZwSetInformationThread can be called by higher-level drivers to set the priority of a thread for which they have a handle.

The caller must have THREAD_SET_INFORMATION access rights for the given thread in order to call this routine.

Usually, device and intermediate drivers that set up driver-created threads call KeSetBasePriorityThread or KeSetPriorityThread from their driver-created threads, rather than calling ZwSetInformationThread. However, a driver can call ZwSetInformationThread to raise the priority of a driver-created thread before that thread runs.

Note  If the call to this function occurs in user mode, you should use the name "NtSetInformationThread" instead of "ZwSetInformationThread".

Requirements

Version

Available starting with Windows 2000.

Header

Ntddk.h (include Ntddk.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

KeSetBasePriorityThread
KeSetPriorityThread
PsCreateSystemThread

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft