Edit

Share via


PsQueryProcessAvailableCpusCount function (wdm.h)

The PsQueryProcessAvailableCpusCount function queries the count of CPUs that are available for a given process to run on.

Syntax

NTSTATUS PsQueryProcessAvailableCpusCount(
  [in]  PEPROCESS Process,
  [out] PULONG    AvailableCpuCount,
  [out] PULONG64  SequenceNumber
);

Parameters

[in] Process

Pointer to a process (PEPROCESS).

[out] AvailableCpuCount

Pointer to a buffer that will receive the count of available CPUs to the given process.

[out] SequenceNumber

Pointer to a buffer that will receive the current sequence number for the available CPUs to the given process.

Return value

PsQueryProcessAvailableCpusCount returns an NTSTATUS value. Possible return values include:

Return code Description
STATUS_SUCCESS The query was completed successfully.
STATUS_INVALID_PARAMETER Any of the required parameters is NULL.

Remarks

This routine can be called at IRQL from PASSIVE_LEVEL to DISPATCH_LEVEL.

This function provides a simpler alternative to PsQueryProcessAvailableCpus when only the count of available CPUs is needed, rather than the detailed affinity information.

The sequence number allows callers to track changes in CPU availability and can be used with PsQueryProcessAvailableCpus for optimized queries.

Requirements

Requirement Value
Header wdm.h
IRQL PASSIVE_LEVEL to DISPATCH_LEVEL

See also

PsQueryProcessAvailableCpus

PsQuerySystemAvailableCpusCount