NtPowerInformation - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTPOAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)

/**
 * The NtPowerInformation routine sets or retrieves system power information.
 *
 * \param InformationLevel Specifies the requested information level, which indicates the specific power information to be set or retrieved.
 * \param InputBuffer Optional pointer to a caller-allocated input buffer.
 * \param InputBufferLength Size, in bytes, of the buffer at InputBuffer.
 * \param OutputBuffer Optional pointer to an output buffer. The type depends on the InformationLevel requested.
 * \param OutputBufferLength Size, in bytes, of the output buffer.
 * \return Successful or errant status.
 * \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-ntpowerinformation
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtPowerInformation(
    _In_ POWER_INFORMATION_LEVEL InformationLevel,
    _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
    _In_ ULONG InputBufferLength,
    _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
    _In_ ULONG OutputBufferLength
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwPowerInformation(
    _In_ POWER_INFORMATION_LEVEL InformationLevel,
    _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
    _In_ ULONG InputBufferLength,
    _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
    _In_ ULONG OutputBufferLength
    );

#endif

View code on GitHub
// ntddk.h

NTSYSAPI NTSTATUS ZwPowerInformation(
  [in]            POWER_INFORMATION_LEVEL InformationLevel,
  [in, optional]  PVOID                   InputBuffer,
  [in]            ULONG                   InputBufferLength,
  [out, optional] PVOID                   OutputBuffer,
  [in]            ULONG                   OutputBufferLength
);
View the official Windows Driver Kit DDI reference
// ntpoapi.h

__kernel_entry NTSYSCALLAPI NTSTATUS NtPowerInformation(
  [in]            POWER_INFORMATION_LEVEL InformationLevel,
  [in, optional]  PVOID                   InputBuffer,
  [in]            ULONG                   InputBufferLength,
  [out, optional] PVOID                   OutputBuffer,
  [in]            ULONG                   OutputBufferLength
);
View the official Windows Driver Kit DDI reference
// wdm.h

__kernel_entry NTSYSCALLAPI NTSTATUS NtPowerInformation(
  [in]            POWER_INFORMATION_LEVEL InformationLevel,
  [in, optional]  PVOID                   InputBuffer,
  [in]            ULONG                   InputBufferLength,
  [out, optional] PVOID                   OutputBuffer,
  [in]            ULONG                   OutputBufferLength
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit here, here, and here.

Windows Driver Kit DDI reference (nf-ntddk-zwpowerinformation)

ZwPowerInformation function

Description

The ZwPowerInformation routine sets or retrieves system power information.

Parameters

InformationLevel [in]

Specifies the requested information level, which indicates the specific power information to be set or retrieved. Currently, the only supported POWER_INFORMATION_LEVEL value is PlatformInformation.

Value Meaning
PlatformInformation Information represents the currently supported power capabilities of the system. Information may change as drivers are installed. For example, the installation of legacy device drivers that do not support power management might modify the capabilities of the system.

InputBuffer [in, optional]

Pointer to a caller-allocated input buffer. This parameter must be NULL, otherwise ERROR_INVALID_PARAMETER is returned.

InputBufferLength [in]

Size, in bytes, of the buffer at InputBuffer. The parameter must be set to zero.

OutputBuffer [out, optional]

A pointer to an output buffer. The data type of this buffer depends on the information level requested in the InformationLevel parameter. For the PlatformInformation level, the only currently supported value, the OutputBuffer parameter is required and should be of the POWER_PLATFORM_INFORMATION type.

OutputBufferLength [in]

Size, in bytes, of the output buffer. Depending on the information level requested, the buffer may be variably sized. PlatformInformation, the only currently supported value, requires a buffer that is the size of a POWER_PLATFORM_INFORMATION structure.

Return value

Returns STATUS_SUCCESS if the call is successful. If the call fails, possible error codes include the following:

Return code Description
STATUS_BUFFER_TOO_SMALL The output buffer is of insufficient size to contain the data being returned.
STATUS_INVALID_PARAMETER The PlatformInformation information level, which is the only currently supported value, requires no input buffer and must contain an output buffer. The caller either supplied an input buffer or no output buffer.
STATUS_ACCESS_DENIED The caller had insufficient access rights to perform the requested action.

Remarks

NtPowerInformation and ZwPowerInformation are two versions of the same Windows Native System Services routine.

For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Examples

This example illustrates a valid function call.

POWER_PLATFORM_INFORMATION PlatformInfo = {0};
NTSTATUS Result = NtPowerInformation(PlatformInformation, NULL, 0, &PlatformInfo, sizeof(PlatformInfo));

See also

POWER_PLATFORM_INFORMATION

Using Nt and Zw Versions of the Native System Services Routines


Windows Driver Kit DDI reference (nf-ntpoapi-ntpowerinformation)

NtPowerInformation function (ntpoapi.h)

Description

The ZwPowerInformation routine sets or retrieves system power information.

Parameters

InformationLevel [in]

Specifies the requested information level, which indicates the specific power information to be set or retrieved. Currently, the only supported POWER_INFORMATION_LEVEL value is PlatformInformation.

Value Meaning
PlatformInformation Information represents the currently supported power capabilities of the system. Information may change as drivers are installed. For example, the installation of legacy device drivers that do not support power management might modify the capabilities of the system.

InputBuffer [in, optional]

Pointer to a caller-allocated input buffer. This parameter must be NULL, otherwise ERROR_INVALID_PARAMETER is returned.

InputBufferLength [in]

Size, in bytes, of the buffer at InputBuffer. The parameter must be set to zero.

OutputBuffer [out, optional]

A pointer to an output buffer. The data type of this buffer depends on the information level requested in the InformationLevel parameter. For the PlatformInformation level, the only currently supported value, the OutputBuffer parameter is required and should be of the POWER_PLATFORM_INFORMATION type.

OutputBufferLength [in]

Size, in bytes, of the output buffer. Depending on the information level requested, the buffer may be variably sized. PlatformInformation, the only currently supported value, requires a buffer that is the size of a POWER_PLATFORM_INFORMATION structure.

Return value

Returns STATUS_SUCCESS if the call is successful. If the call fails, possible error codes include the following:

Return code Description
STATUS_BUFFER_TOO_SMALL The output buffer is of insufficient size to contain the data being returned.
STATUS_INVALID_PARAMETER The PlatformInformation information level, which is the only currently supported value, requires no input buffer and must contain an output buffer. The caller either supplied an input buffer or no output buffer.
STATUS_ACCESS_DENIED The caller had insufficient access rights to perform the requested action.

Remarks

NtPowerInformation and ZwPowerInformation are two versions of the same Windows Native System Services routine.

For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Examples

This example illustrates a valid function call.

POWER_PLATFORM_INFORMATION PlatformInfo = {0};
NTSTATUS Result = NtPowerInformation(PlatformInformation, NULL, 0, &PlatformInfo, sizeof(PlatformInfo));

See also

POWER_PLATFORM_INFORMATION

Using Nt and Zw Versions of the Native System Services Routines


Windows Driver Kit DDI reference (nf-wdm-ntpowerinformation)

NtPowerInformation function (wdm.h)

Description

The NtPowerInformation routine sets or retrieves system power information.

Parameters

InformationLevel [in]

Specifies the requested information level, which indicates the specific power information to be set or retrieved. Currently, the only supported POWER_INFORMATION_LEVEL value is PlatformInformation.

Value Description
PlatformInformation Information represents the currently supported power capabilities of the system. Information may change as drivers are installed. For example, the installation of legacy device drivers that do not support power management might modify the capabilities of the system.

InputBuffer [in, optional]

Pointer to a caller-allocated input buffer. This parameter must be NULL, otherwise ERROR_INVALID_PARAMETER is returned.

InputBufferLength [in]

Size, in bytes, of the buffer at InputBuffer. The parameter must be set to zero.

OutputBuffer [out, optional]

A pointer to an output buffer. The data type of this buffer depends on the information level requested in the InformationLevel parameter. For the PlatformInformation level, the only currently supported value, the OutputBuffer parameter is required and should be of the POWER_PLATFORM_INFORMATION type.

OutputBufferLength [in]

Size, in bytes, of the output buffer. Depending on the information level requested, the buffer may be variably sized. PlatformInformation, the only currently supported value, requires a buffer that is the size of a POWER_PLATFORM_INFORMATION structure.

Return value

Returns STATUS_SUCCESS if the call is successful. If the call fails, possible error codes include the following:

Return code Description
STATUS_BUFFER_TOO_SMALL The output buffer is of insufficient size to contain the data being returned.
STATUS_INVALID_PARAMETER The PlatformInformation information level, which is the only currently supported value, requires no input buffer and must contain an output buffer. The caller either supplied an input buffer or no output buffer.
STATUS_ACCESS_DENIED The caller had insufficient access rights to perform the requested action.

Remarks

NtPowerInformation and ZwPowerInformation are two versions of the same Windows Native System Services routine.

For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Examples

This example illustrates a valid function call.

POWER_PLATFORM_INFORMATION PlatformInfo = {0};
NTSTATUS Result = NtPowerInformation(PlatformInformation, NULL, 0, &PlatformInfo, sizeof(PlatformInfo));

See also

POWER_PLATFORM_INFORMATION

Using Nt and Zw Versions of the Native System Services Routines