Top Description Inners Fields Methods
com.sun.jna.platform.win32

public Interface PowrProf

extends Library
Imports
com.sun.jna.Library, .Native, .Pointer

Functions used with power management.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PowrProf.POWER_INFORMATION_LEVEL

Enum which indicates the power information level requested from CallNtPowerInformation.

Field Summary

Modifier and TypeField and Description
public static final PowrProf
Inherited from com.sun.jna.Library:
OPTION_ALLOW_OBJECTSOPTION_CALLING_CONVENTIONOPTION_CLASSLOADEROPTION_FUNCTION_MAPPEROPTION_INVOCATION_MAPPEROPTION_OPEN_FLAGSOPTION_STRING_ENCODINGOPTION_STRUCTURE_ALIGNMENTOPTION_SYMBOL_PROVIDEROPTION_TYPE_MAPPER

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

If the function succeeds, the return value is NTStatus#STATUS_SUCCESS. If the function fails, the return value can be one the following status codes: NTStatus#STATUS_BUFFER_TOO_SMALL if the output buffer is of insufficient size to contain the data to be returned. NTStatus#STATUS_ACCESS_DENIED if the caller had insufficient access rights to perform the requested action.
CallNtPowerInformation
(int informationLevel, Pointer
A pointer to an optional input buffer. The data type of this buffer depends on the information level requested in the informationLevel parameter.
lpInputBuffer
,
int
The size of the input buffer, in bytes.
nInputBufferSize
,
Pointer
A pointer to an optional output buffer. The data type of this buffer depends on the information level requested in the informationLevel parameter. If the buffer is too small to contain the information, the function returns NTStatus#STATUS_BUFFER_TOO_SMALL.
lpOutputBuffer
,
int
The size of the output buffer, in bytes. Depending on the information level requested, this may be a variably sized buffer.
nOutputBufferSize
)

Sets or retrieves power information.

Field Detail

INSTANCEback to summary
public static final PowrProf INSTANCE

Method Detail

CallNtPowerInformationback to summary
public int CallNtPowerInformation(int informationLevel, Pointer lpInputBuffer, int nInputBufferSize, Pointer lpOutputBuffer, int nOutputBufferSize)

Sets or retrieves power information.

Changes made to the current system power policy using CallNtPowerInformation are immediate, but they are not persistent; that is, the changes are not stored as part of a power scheme. Any changes to system power policy made with CallNtPowerInformation may be overwritten by changes to a policy scheme made by the user in the Power Options control panel program, or by subsequent calls to WritePwrScheme, SetActivePwrScheme, or other power scheme functions.

Parameters
informationLevel:int

The information level requested. This value indicates the specific power information to be set or retrieved. This parameter must be one of the following POWER_INFORMATION_LEVEL enumeration type values: POWER_INFORMATION_LEVEL#LastSleepTime, POWER_INFORMATION_LEVEL#LastWakeTime, POWER_INFORMATION_LEVEL#ProcessorInformation, POWER_INFORMATION_LEVEL#SystemBatteryState, POWER_INFORMATION_LEVEL#SystemExecutionState, POWER_INFORMATION_LEVEL#SystemPowerCapabilities, POWER_INFORMATION_LEVEL#SystemPowerInformation, POWER_INFORMATION_LEVEL#SystemPowerPolicyAc, POWER_INFORMATION_LEVEL#SystemPowerPolicyCurrent, POWER_INFORMATION_LEVEL#SystemPowerPolicyDc, or POWER_INFORMATION_LEVEL#SystemReserveHiberFile.

lpInputBuffer:Pointer

A pointer to an optional input buffer. The data type of this buffer depends on the information level requested in the informationLevel parameter.

nInputBufferSize:int

The size of the input buffer, in bytes.

lpOutputBuffer:Pointer

A pointer to an optional output buffer. The data type of this buffer depends on the information level requested in the informationLevel parameter. If the buffer is too small to contain the information, the function returns NTStatus#STATUS_BUFFER_TOO_SMALL.

nOutputBufferSize:int

The size of the output buffer, in bytes. Depending on the information level requested, this may be a variably sized buffer.

Returns:int

If the function succeeds, the return value is NTStatus#STATUS_SUCCESS. If the function fails, the return value can be one the following status codes: NTStatus#STATUS_BUFFER_TOO_SMALL if the output buffer is of insufficient size to contain the data to be returned. NTStatus#STATUS_ACCESS_DENIED if the caller had insufficient access rights to perform the requested action.

com.sun.jna.platform.win32 back to summary

public Interface PowrProf.POWER_INFORMATION_LEVEL


Enum which indicates the power information level requested from CallNtPowerInformation. This value indicates the specific power information to be set or retrieved.

Field Summary

Modifier and TypeField and Description
public static final int
LastSleepTime

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
LastWakeTime

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
ProcessorInformation

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemBatteryState

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemExecutionState

The lpInBuffer parameter must be NULL otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemPowerCapabilities

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemPowerInformation

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemPowerPolicyAc

If lpInBuffer is not NULL, the function applies the com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY values passed in lpInBuffer to the current system power policy used while the system is running on AC (utility) power.

public static final int
SystemPowerPolicyCurrent

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

public static final int
SystemPowerPolicyDc

If lpInBuffer is not NULL, the function applies the com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY values passed in lpInBuffer to the current system power policy used while the system is running on battery power.

public static final int
SystemReserveHiberFile

If lpInBuffer is not NULL and the current user has sufficient privileges, the function commits or decommits the storage required to hold the hibernation image on the boot volume.

Field Detail

LastSleepTimeback to summary
public static final int LastSleepTime

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinDef.ULONGLONG that specifies the interrupt-time count, in 100-nanosecond units, at the last system sleep time.

LastWakeTimeback to summary
public static final int LastWakeTime

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinDef.ULONGLONG that specifies the interrupt-time count, in 100-nanosecond units, at the last system wake time.

ProcessorInformationback to summary
public static final int ProcessorInformation

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives one com.sun.jna.platform.win32.WinNT.PROCESSOR_POWER_INFORMATION structure for each processor that is installed on the system. Use the Kernel32#GetSystemInfo function to retrieve the number of processors, which will be the number of logical processors on the current Processor Group.

SystemBatteryStateback to summary
public static final int SystemBatteryState

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_BATTERY_STATE structure containing information about the current system battery.

SystemExecutionStateback to summary
public static final int SystemExecutionState

The lpInBuffer parameter must be NULL otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinDef.ULONG value containing the system execution state buffer. This value may contain any combination of the following values: WinBase#ES_SYSTEM_REQUIRED, WinBase#ES_DISPLAY_REQUIRED, or WinBase#ES_USER_PRESENT. For more information, see the Kernel32#SetThreadExecutionState function.

SystemPowerCapabilitiesback to summary
public static final int SystemPowerCapabilities

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_CAPABILITIES structure containing the current system power capabilities.

This information represents the currently supported power capabilities. It may change as drivers are installed in the system. For example, installation of legacy device drivers that do not support power management disables all system sleep states.

SystemPowerInformationback to summary
public static final int SystemPowerInformation

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_INFORMATION structure.

Applications can use this level to retrieve information about the idleness of the system.

SystemPowerPolicyAcback to summary
public static final int SystemPowerPolicyAc

If lpInBuffer is not NULL, the function applies the com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY values passed in lpInBuffer to the current system power policy used while the system is running on AC (utility) power.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY structure containing the current system power policy used while the system is running on AC (utility) power.

SystemPowerPolicyCurrentback to summary
public static final int SystemPowerPolicyCurrent

The lpInBuffer parameter must be NULL; otherwise, the function returns WinError#ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY structure containing the current system power policy used while the system is running on AC (utility) power.

SystemPowerPolicyDcback to summary
public static final int SystemPowerPolicyDc

If lpInBuffer is not NULL, the function applies the com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY values passed in lpInBuffer to the current system power policy used while the system is running on battery power.

The lpOutputBuffer buffer receives a com.sun.jna.platform.win32.WinNT.SYSTEM_POWER_POLICY structure containing the current system power policy used while the system is running on battery power.

SystemReserveHiberFileback to summary
public static final int SystemReserveHiberFile

If lpInBuffer is not NULL and the current user has sufficient privileges, the function commits or decommits the storage required to hold the hibernation image on the boot volume.

The lpInBuffer parameter must point to a BOOLEAN value indicating the desired request. If the value is TRUE, the hibernation file is reserved; if the value is FALSE, the hibernation file is removed.