Compartir a través de


ZwQueryInformationThread routine

The ZwQueryInformationThread routine retrieves information about the specified thread, such as its page priority.

Syntax

NTSTATUS ZwQueryInformationThread (
  _In_      HANDLE          ThreadHandle,
  _In_      THREADINFOCLASS ThreadInformationClass,
  _In_      PVOID           ThreadInformation,
  _In_      ULONG           ThreadInformationLength,
  _Out_opt_ PULONG          ReturnLength
);

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]
    The type of thread information to be retrieved. This value is one of the system-defined values in the THREADINFOCLASS enumeration (see ntddk.h).

    Value Description

    ThreadPagePriority

    24

    The current thread page priority.

     

  • ThreadInformation [in]
    Pointer to a buffer supplied by the caller. The format of the buffer depends on the type of information requested, as specified by the ThreadInformationClass parameter.

    If ThreadInformationClass is ThreadPagePriority, the buffer is a PAGE_PRIORITY_INFORMATION structure that receives the current thread page priority, indicated by one of these values.

    Value Meaning
    MEMORY_PRIORITY_VERY_LOW 1

    Very low memory priority.

    MEMORY_PRIORITY_LOW 2

    Low memory priority.

    MEMORY_PRIORITY_MEDIUM 3

    Medium memory priority.

    MEMORY_PRIORITY_BELOW_NORMAL 4

    Below normal memory priority.

    MEMORY_PRIORITY_NORMAL 5

    Normal memory priority. This is the default priority for all threads and processes on the system.

     

  • ThreadInformationLength [in]
    The size, in bytes, of the buffer pointed to by ThreadInformation.

  • ReturnLength [out, optional]
    A pointer to a ULONG variable in which the routine returns the size of the requested information. If the function was successful, this is the size of the information written to the buffer pointed to by the ThreadInformation parameter, but if the buffer was too small, this is the minimum size of buffer needed to receive the information successfully.

Return value

ZwQueryInformationThread 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

A kernel-mode driver calls ZwQueryInformationThread when it wants to change the thread page priority. Typically, the driver calls the routine to determine the current thread page priority, lower it to the desired value (if necessary) by calling ZwSetInformationThread, perform the operation, and then restore the priority to the thread's original priority.

Requirements

Target platform

Universal

Version

Available starting with Windows 10, version 1511.

Header

Ntddk.h (include Ntddk.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

PASSIVE_LEVEL

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

ZwSetInformationThread

 

 

Send comments about this topic to Microsoft