Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 4.38 KB

nf-wdm-kequeryactiveprocessorcount.md

File metadata and controls

85 lines (60 loc) · 4.38 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:wdm.KeQueryActiveProcessorCount
KeQueryActiveProcessorCount function (wdm.h)
Learn how the KeQueryActiveProcessorCount routine returns the number of currently active processors.
kernel\kequeryactiveprocessorcount.htm
kernel
04/30/2018
KeQueryActiveProcessorCount function
KeQueryActiveProcessorCount, KeQueryActiveProcessorCount routine [Kernel-Mode Driver Architecture], k105_23574ace-ab66-43bb-976f-ca7310cece9a.xml, kernel.kequeryactiveprocessorcount, wdm/KeQueryActiveProcessorCount
wdm.h
Wdm.h, Ntddk.h
Universal
Available in Windows Vista and later versions of Windows.
NtosKrnl.lib
NtosKrnl.exe
Any level
Windows
KeQueryActiveProcessorCount
wdm/KeQueryActiveProcessorCount
APIRef
kbSyntax
DllExport
NtosKrnl.exe
KeQueryActiveProcessorCount

KeQueryActiveProcessorCount function (wdm.h)

-description

The KeQueryActiveProcessorCount routine returns the number of currently active processors.

-parameters

-param ActiveProcessors [out, optional]

A pointer to a KAFFINITY-typed variable into which the routine writes a bitmask that represents the set of currently active processors. In a hot-add environment, this mask may change during runtime. This parameter is optional and can be specified as NULL if the caller does not require the mask of active processors.

-returns

KeQueryActiveProcessorCount returns the number of currently active processors.

-remarks

A device driver calls the KeQueryActiveProcessorCount routine to retrieve the number of currently active processors. Device drivers that are built for Windows Vista and later versions of the Windows operating system should not use the KeNumberProcessors kernel variable for this purpose.

Callers cannot assume that the KeQueryActiveProcessorCount routine maps processors to bits in the returned KAFFINITY value consecutively, or that the routine will return the same bitmask each time it is called.

Callers must also be aware that the value returned by KeQueryActiveProcessorCount can change at runtime on versions of Windows that support hot-add CPU functionality.

If necessary, register for notification of changes to the number of processors by calling the KeRegisterProcessorChangeCallback routine.

To query just the affinity mask without getting the number of active processors, use KeQueryActiveProcessors.

Windows 7 and later versions of Windows support processor groups. Drivers that are designed to handle information about processor groups should use the KeQueryActiveProcessorCountEx routine, which specifies a processor group, instead of KeQueryActiveProcessorCount, which does not. However, the implementation of KeQueryActiveProcessorCount in Windows 7 and later versions of Windows provides compatibility for drivers that were written for earlier versions of Windows, which do not support processor groups. In this implementation, KeQueryActiveProcessorCount returns the number of active logical processors in group 0, and writes an affinity mask to *ActiveProcessors that specifies the set of active logical processors in group 0.

-see-also

KeQueryActiveProcessorCountEx

KeQueryActiveProcessors

KeRegisterProcessorChangeCallback