' ########################################################################################
' Microsoft Windows
' File: powrprof.inc
' Contents: Interface for powrprof.dll, the power policy applicator
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_powrprof_PBI)
#DEFINE PBX_powrprof_PBI
%EQUATE `POWRPROF_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'// Registry storage structures for the GLOBAL_POWER_POLICY data. There are two
'// structures, GLOBAL_MACHINE_POWER_POLICY and GLOBAL_USER_POWER_POLICY. the
'// GLOBAL_MACHINE_POWER_POLICY stores per machine data for which there is no UI.
'// GLOBAL_USER_POWER_POLICY stores the per user data.
' // Size = 16 bytes
TYPE GLOBAL_MACHINE_POWER_POLICY DWORD
 Revision AS DWORD ' ULONG
 LidOpenWakeAc AS LONG ' SYSTEM_POWER_STATE
 LidOpenWakeDc AS LONG ' SYSTEM_POWER_STATE
 BroadcastCapacityResolution AS DWORD ' ULONG
END TYPE
' // Size = 176 bytes
TYPE GLOBAL_USER_POWER_POLICY DWORD
 Revision AS DWORD ' ULONG
 PowerButtonAc AS POWER_ACTION_POLICY
 PowerButtonDc AS POWER_ACTION_POLICY
 SleepButtonAc AS POWER_ACTION_POLICY
 SleepButtonDc AS POWER_ACTION_POLICY
 LidCloseAc AS POWER_ACTION_POLICY
 LidCloseDc AS POWER_ACTION_POLICY
 DischargePolicy(%NUM_DISCHARGE_POLICIES - 1) AS SYSTEM_POWER_LEVEL
 GlobalFlags AS DWORD ' ULONG
END TYPE
'// Structure to manage global power policies at the user level. This structure
'// contains data which is common across all power policy profiles.
' // Size = 192 bytes
TYPE GLOBAL_POWER_POLICY DWORD
 user AS GLOBAL_USER_POWER_POLICY
 mach AS GLOBAL_MACHINE_POWER_POLICY
END TYPE
'// Registry storage structures for the POWER_POLICY data. There are three
'// structures, MACHINE_POWER_POLICY, MACHINE_PROCESSOR_POWER_POLICY and USER_POWER_POLICY. the
'// MACHINE_POWER_POLICY stores per machine data for which there is no UI.
'// USER_POWER_POLICY stores the per user data.
' // Size = 64 bytes
TYPE MACHINE_POWER_POLICY DWORD FILL
 Revision AS DWORD ' ULONG
 ' meaning of power action "sleep"
 MinSleepAc AS LONG ' SYSTEM_POWER_STATE
 MinSleepDc AS LONG ' SYSTEM_POWER_STATE
 ReducedLatencySleepAc AS LONG ' SYSTEM_POWER_STATE
 ReducedLatencySleepDc AS LONG ' SYSTEM_POWER_STATE
 ' parameters for dozing
 DozeTimeoutAc AS DWORD ' ULONG
 DozeTimeoutDc AS DWORD ' ULONG
 DozeS4TimeoutAc AS DWORD ' ULONG
 DozeS4TimeoutDc AS DWORD ' ULONG
 ' processor policies
 MinThrottleAc AS BYTE ' UCHAR
 MinThrottleDc AS BYTE ' UCHAR
 pad1(1) AS BYTE ' UCHAR
 OverThrottledAc AS POWER_ACTION_POLICY
 OverThrottledDc AS POWER_ACTION_POLICY
END TYPE
'//
'// deprecated
'//
' // Size = 156 bytes
TYPE MACHINE_PROCESSOR_POWER_POLICY DWORD
 Revision AS DWORD ' ULONG
 ProcessorPolicyAc AS PROCESSOR_POWER_POLICY
 ProcessorPolicyDc AS PROCESSOR_POWER_POLICY
END TYPE
' // Size = 80 bytes
TYPE USER_POWER_POLICY
 Revision AS DWORD ' ULONG
 ' "system idle" detection
 IdleAc AS POWER_ACTION_POLICY
 IdleDc AS POWER_ACTION_POLICY
 IdleTimeoutAc AS DWORD ' ULONG
 IdleTimeoutDc AS DWORD ' ULONG
 IdleSensitivityAc AS BYTE ' UCHAR
 IdleSensitivityDc AS BYTE ' UCHAR
 ' Throttling Policy
 ThrottlePolicyAc AS BYTE ' UCHAR
 ThrottlePolicyDc AS BYTE ' UCHAR
 ' meaning of power action "sleep"
 MaxSleepAc AS LONG ' SYSTEM_POWER_STATE
 MaxSleepDc AS LONG ' SYSTEM_POWER_STATE
 ' For future use
 Reserved(1) AS DWORD ' ULONG[2]
 ' video policies
 VideoTimeoutAc AS DWORD ' ULONG
 VideoTimeoutDc AS DWORD ' ULONG
 ' hard disk policies
 SpindownTimeoutAc AS DWORD ' ULONG
 SpindownTimeoutDc AS DWORD ' ULONG
 ' processor policies
 OptimizeForPowerAc AS BYTE ' BOOLEAN
 OptimizeForPowerDc AS BYTE ' BOOLEAN
 FanThrottleToleranceAc AS BYTE ' UCHAR
 FanThrottleToleranceDc AS BYTE ' UCHAR
 ForcedThrottleAc AS BYTE ' UCHAR
 ForcedThrottleDc AS BYTE ' UCHAR
 alignment__ AS WORD ' // To keep DWORD alignment
END TYPE
'// Structure to manage power policies at the user level. This structure
'// contains data which is unique across power policy profiles.
' // Size = 144 bytes
TYPE POWER_POLICY DWORD
 user AS USER_POWER_POLICY
 mach AS MACHINE_POWER_POLICY
END TYPE
'// Constants for GlobalFlags
%EQUATE `EnableSysTrayBatteryMeter = &H01
%EQUATE `EnableMultiBatteryDisplay = &H02
%EQUATE `EnablePasswordLogon = &H04
%EQUATE `EnableWakeOnRing = &H08
%EQUATE `EnableVideoDimDisplay = &H10
'//
'// Power setting attribute flags
'//
%EQUATE `POWER_ATTRIBUTE_HIDE = &H00000001
'// This constant is passed as a uiID to WritePwrScheme.
%EQUATE `NEWSCHEME = &HFFFFFFFF ' (UINT)-1
'// Prototype for EnumPwrSchemes callback proceedures.
'typedef
'BOOLEAN
'CALLBACK
'PWRSCHEMESENUMPROC_V1 (
' );
'FUNCTION PWRSCHEMESENUMPROC_V1 ( ' BYVAL Index AS DWORD
' , BYVAL NameSize AS DWORD
' , BYREF strName AS ASCIIZ
' , BYVAL DescriptionSize AS DWORD
' , BYREF Description AS ASCIIZ
' , BYREF Policy AS POWER_POLICY
' , BYVAL Context AS LONG
' ) AS LONG ' BOOLEAN
'typedef
'BOOLEAN
'CALLBACK
'PWRSCHEMESENUMPROC_V2 (
' );
'FUNCTION PWRSCHEMESENUMPROC_V2 ( ' BYVAL Index AS DWORD
' , BYVAL NameSize AS DWORD
' , BYREF bstrName AS WSTRINGZ
' , BYVAL DescriptionSize AS DWORD
' , BYREF Description AS WSTRINGZ
' , BYREF Policy AS POWER_POLICY
' , BYVAL Context AS LONG
' ) AS LONG ' BOOLEAN
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'typedef PWRSCHEMESENUMPROC_V2 *PWRSCHEMESENUMPROC;
'#else
'typedef PWRSCHEMESENUMPROC_V1 *PWRSCHEMESENUMPROC;
'#endif
'// Public function prototypes
DECLARE FUNCTION GetPwrDiskSpindownRange LIB "powrprof.dll" ALIAS "GetPwrDiskSpindownRange" ( BYREF RangeMax AS QUAD , BYREF RangeMin AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION EnumPwrSchemes LIB "powrprof.dll" ALIAS "EnumPwrSchemes" ( BYVAL lpfnPwrSchemesEnumProc AS QUAD , BYVAL lParam AS LONG ) AS BYTE ' BOOLEAN
DECLARE FUNCTION ReadGlobalPwrPolicy LIB "powrprof.dll" ALIAS "ReadGlobalPwrPolicy" ( BYREF pGlobalPowerPolicy AS GLOBAL_POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION ReadPwrScheme LIB "powrprof.dll" ALIAS "ReadPwrScheme" ( BYVAL uiID AS QUAD , BYREF pPowerPolicy AS POWER_POLICY ) AS BYTE ' BOOLEAN
' WritePwrScheme is no longer available for use as of Windows Vista. Instead, use the PowerEnumerate function
' to enumerate power settings for a specified scheme, and the power write functions to write individual settings.]
DECLARE FUNCTION WritePwrScheme LIB "powrprof.dll" ALIAS "WritePwrScheme" ( BYREF puiID AS QUAD , BYREF lpszName AS WSTRINGZ , BYREF lpszDescription AS WSTRINGZ , BYREF pPowerPolicy AS POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION WriteGlobalPwrPolicy LIB "powrprof.dll" ALIAS "WriteGlobalPwrPolicy" ( BYREF pGlobalPowerPolicy AS GLOBAL_POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION DeletePwrScheme LIB "powrprof.dll" ALIAS "DeletePwrScheme" ( BYVAL uiIndex AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION GetActivePwrScheme LIB "powrprof.dll" ALIAS "GetActivePwrScheme" ( BYREF puiID AS QUAD ) AS BYTE ' BOOLEAN
DECLARE FUNCTION SetActivePwrScheme LIB "powrprof.dll" ALIAS "SetActivePwrScheme" ( BYVAL uiID AS QUAD , BYREF pGlobalPowerPolicy AS GLOBAL_POWER_POLICY , BYREF pPowerPolicy AS POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION GetPwrCapabilities LIB "powrprof.dll" ALIAS "GetPwrCapabilities" ( BYREF pSystemPowerCapabilities AS SYSTEM_POWER_CAPABILITIES ) AS BYTE ' BOOLEAN
DECLARE FUNCTION IsPwrSuspendAllowed LIB "powrprof.dll" ALIAS "IsPwrSuspendAllowed" ( ) AS BYTE ' BOOLEAN
DECLARE FUNCTION IsPwrHibernateAllowed LIB "powrprof.dll" ALIAS "IsPwrHibernateAllowed" ( ) AS BYTE ' BOOLEAN
DECLARE FUNCTION IsPwrShutdownAllowed LIB "powrprof.dll" ALIAS "IsPwrShutdownAllowed" ( ) AS BYTE ' BOOLEAN
DECLARE FUNCTION IsAdminOverrideActive LIB "powrprof.dll" ALIAS "IsAdminOverrideActive" ( BYREF pAdministratorPowerPolicy AS ADMINISTRATOR_POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION SetSuspendState LIB "powrprof.dll" ALIAS "SetSuspendState" ( BYVAL Hibernate AS BYTE , BYVAL ForceCritical AS BYTE , BYVAL DisableWakeEvent AS BYTE ) AS BYTE ' BOOLEAN
DECLARE FUNCTION GetCurrentPowerPolicies LIB "powrprof.dll" ALIAS "GetCurrentPowerPolicies" ( BYREF pGlobalPowerPolicy AS GLOBAL_POWER_POLICY , BYREF pPowerPolicy AS POWER_POLICY ) AS BYTE ' BOOLEAN
DECLARE FUNCTION CanUserWritePwrScheme LIB "powrprof.dll" ALIAS "CanUserWritePwrScheme" ( ) AS BYTE ' BOOLEAN
'#if (NTDDI_VERSION >= NTDDI_WINXP)
'//
'// deprecated.
'//
DECLARE FUNCTION ReadProcessorPwrScheme LIB "powrprof.dll" ALIAS "ReadProcessorPwrScheme" ( BYVAL uiID AS QUAD , BYREF pMachineProcessorPowerPolicy AS MACHINE_PROCESSOR_POWER_POLICY ) AS BYTE ' BOOLEAN
'#endif
'#if (NTDDI_VERSION >= NTDDI_WINXP)
'//
'// deprecated.
'//
DECLARE FUNCTION WriteProcessorPwrScheme LIB "powrprof.dll" ALIAS "WriteProcessorPwrScheme" ( BYVAL uiID AS QUAD , BYREF pMachineProcessorPowerPolicy AS MACHINE_PROCESSOR_POWER_POLICY ) AS BYTE ' BOOLEAN
'#endif
DECLARE FUNCTION ValidatePowerPolicies LIB "powrprof.dll" ALIAS "ValidatePowerPolicies" ( BYREF pGlobalPowerPolicy AS GLOBAL_POWER_POLICY , OPTIONAL BYREF pPowerPolicy AS POWER_POLICY ) AS BYTE ' BOOLEAN
'#ifndef NT_SUCCESS
'#define NTSTATUS LONG
'#define _OVERRIDE_NTSTATUS_
'#endif
DECLARE FUNCTION CallNtPowerInformation LIB "powrprof.dll" ALIAS "CallNtPowerInformation" ( BYVAL InformationLevel AS LONG , BYVAL lpInputBuffer AS QUAD , BYVAL nInputBufferSize AS QUAD , BYVAL lpOutputBuffer AS QUAD , BYVAL nOutputBufferSize AS QUAD ) AS LONG ' NTSTATUS
'#ifdef _OVERRIDE_NTSTATUS_
'#undef NTSTATUS
'#endif
'//
'// Enum which defines which field inside of a
'// power setting is being accessed.
'//
' enum _POWER_DATA_ACCESSOR
'// Used by read/write and enumeration engines
%EQUATE `ACCESS_AC_POWER_SETTING_INDEX = 0
%EQUATE `ACCESS_DC_POWER_SETTING_INDEX = 1
%EQUATE `ACCESS_FRIENDLY_NAME = 2
%EQUATE `ACCESS_DESCRIPTION = 3
%EQUATE `ACCESS_POSSIBLE_POWER_SETTING = 4
%EQUATE `ACCESS_POSSIBLE_POWER_SETTING_FRIENDLY_NAME = 5
%EQUATE `ACCESS_POSSIBLE_POWER_SETTING_DESCRIPTION = 6
%EQUATE `ACCESS_DEFAULT_AC_POWER_SETTING = 7
%EQUATE `ACCESS_DEFAULT_DC_POWER_SETTING = 8
%EQUATE `ACCESS_POSSIBLE_VALUE_MIN = 9
%EQUATE `ACCESS_POSSIBLE_VALUE_MAX = 10
%EQUATE `ACCESS_POSSIBLE_VALUE_INCREMENT = 11
%EQUATE `ACCESS_POSSIBLE_VALUE_UNITS = 12
%EQUATE `ACCESS_ICON_RESOURCE = 13
%EQUATE `ACCESS_DEFAULT_SECURITY_DESCRIPTOR = 14
%EQUATE `ACCESS_ATTRIBUTES = 15
'// Used by enumeration engine.
%EQUATE `ACCESS_SCHEME = 16
%EQUATE `ACCESS_SUBGROUP = 17
%EQUATE `ACCESS_INDIVIDUAL_SETTING = 18
'// Used by access check
%EQUATE `ACCESS_ACTIVE_SCHEME = 19
%EQUATE `ACCESS_CREATE_SCHEME = 20
'// Used by override ranges.
%EQUATE `ACCESS_AC_POWER_SETTING_MAX = 21
%EQUATE `ACCESS_DC_POWER_SETTING_MAX = 22
%EQUATE `ACCESS_AC_POWER_SETTING_MIN = 23
%EQUATE `ACCESS_DC_POWER_SETTING_MIN = 24
'//
'// =========================================
'// Power Scheme APIs
'// =========================================
'//
'#if !defined(_HPOWERNOTIFY_DEF_)
'#define _HPOWERNOTIFY_DEF_
'typedef PVOID HPOWERNOTIFY;
'typedef HPOWERNOTIFY *PHPOWERNOTIFY;
'#endif
'#if (NTDDI_VERSION >= NTDDI_WIN7)
DECLARE FUNCTION PowerSettingRegisterNotification LIB "powrprof.dll" ALIAS "PowerSettingRegisterNotification" ( BYREF SettingGuid AS GUID , BYVAL Flags AS QUAD , BYVAL Recipient AS QUAD , BYREF RegistrationHandle AS ANY ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_WIN7)
DECLARE FUNCTION PowerSettingUnregisterNotification LIB "powrprof.dll" ALIAS "PowerSettingUnregisterNotification" ( BYREF RegistrationHandle AS ANY ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerSettingAccessCheck LIB "powrprof.dll" ALIAS "PowerSettingAccessCheck" ( BYVAL AccessFlags AS QUAD , OPTIONAL BYREF PowerGuid AS GUID ) AS QUAD
'#endif
'//
'// Read functions.
'//
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadACValueIndex LIB "powrprof.dll" ALIAS "PowerReadACValueIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF AcValueIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadDCValueIndex LIB "powrprof.dll" ALIAS "PowerReadDCValueIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF DcValueIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadACValue LIB "PowrProf.dll" ALIAS "PowerReadACValue" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, dType AS QUAD, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadACValue LIB "powrprof.dll" ALIAS "PowerReadACValue" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF Type AS QUAD , BYVAL Buffer AS BYTE PTR , OPTIONAL BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadDCValue LIB "PowrProf.dll" ALIAS "PowerReadDCValue" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, dType AS QUAD, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadDCValue LIB "powrprof.dll" ALIAS "PowerReadDCValue" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF Type AS QUAD , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadFriendlyName LIB "PowrProf.dll" ALIAS "PowerReadFriendlyName" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadFriendlyName LIB "powrprof.dll" ALIAS "PowerReadFriendlyName" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadDescription LIB "PowrProf.dll" ALIAS "PowerReadDescription" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadDescription LIB "powrprof.dll" ALIAS "PowerReadDescription" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadPossibleValue LIB "PowrProf.dll" ALIAS "PowerReadPossibleValue" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, dType AS QUAD, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadPossibleValue LIB "powrprof.dll" ALIAS "PowerReadPossibleValue" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF Type AS QUAD , BYREF PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadPossibleFriendlyName LIB "PowrProf.dll" ALIAS "PowerReadPossibleFriendlyName" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadPossibleFriendlyName LIB "powrprof.dll" ALIAS "PowerReadPossibleFriendlyName" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadPossibleDescription LIB "PowrProf.dll" ALIAS "PowerReadPossibleDescription" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadPossibleDescription LIB "powrprof.dll" ALIAS "PowerReadPossibleDescription" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadValueMin LIB "powrprof.dll" ALIAS "PowerReadValueMin" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF ValueMinimum AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadValueMax LIB "powrprof.dll" ALIAS "PowerReadValueMax" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF ValueMaximum AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadValueIncrement LIB "powrprof.dll" ALIAS "PowerReadValueIncrement" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF ValueIncrement AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadValueUnitsSpecifier LIB "PowrProf.dll" ALIAS "PowerReadValueUnitsSpecifier" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadValueUnitsSpecifier LIB "powrprof.dll" ALIAS "PowerReadValueUnitsSpecifier" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadACDefaultIndex LIB "powrprof.dll" ALIAS "PowerReadACDefaultIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemePersonalityGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF AcDefaultIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadDCDefaultIndex LIB "powrprof.dll" ALIAS "PowerReadDCDefaultIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemePersonalityGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYREF DcDefaultIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerReadIconResourceSpecifier LIB "PowrProf.dll" ALIAS "PowerReadIconResourceSpecifier" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerReadIconResourceSpecifier LIB "powrprof.dll" ALIAS "PowerReadIconResourceSpecifier" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReadSettingAttributes LIB "powrprof.dll" ALIAS "PowerReadSettingAttributes" ( OPTIONAL BYREF SubGroupGuid AS GUID , OPTIONAL BYREF PowerSettingGuid AS GUID ) AS QUAD
'#endif
'//
'// Write functions.
'//
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteACValueIndex LIB "powrprof.dll" ALIAS "PowerWriteACValueIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL AcValueIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteDCValueIndex LIB "powrprof.dll" ALIAS "PowerWriteDCValueIndex" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL DcValueIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWriteFriendlyName LIB "PowrProf.dll" ALIAS "PowerWriteFriendlyName" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWriteFriendlyName LIB "powrprof.dll" ALIAS "PowerWriteFriendlyName" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWriteDescription LIB "PowrProf.dll" ALIAS "PowerWriteDescription" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWriteDescription LIB "powrprof.dll" ALIAS "PowerWriteDescription" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWritePossibleValue LIB "PowrProf.dll" ALIAS "PowerWritePossibleValue" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, dType AS QUAD, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWritePossibleValue LIB "powrprof.dll" ALIAS "PowerWritePossibleValue" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Type AS QUAD , BYVAL PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWritePossibleFriendlyName LIB "PowrProf.dll" ALIAS "PowerWritePossibleFriendlyName" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWritePossibleFriendlyName LIB "powrprof.dll" ALIAS "PowerWritePossibleFriendlyName" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWritePossibleDescription LIB "PowrProf.dll" ALIAS "PowerWritePossibleDescription" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, BYVAL PossibleSettingIndex AS QUAD, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWritePossibleDescription LIB "powrprof.dll" ALIAS "PowerWritePossibleDescription" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL PossibleSettingIndex AS QUAD , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteValueMin LIB "powrprof.dll" ALIAS "PowerWriteValueMin" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL ValueMinimum AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteValueMax LIB "powrprof.dll" ALIAS "PowerWriteValueMax" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL ValueMaximum AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteValueIncrement LIB "powrprof.dll" ALIAS "PowerWriteValueIncrement" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL ValueIncrement AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWriteValueUnitsSpecifier LIB "PowrProf.dll" ALIAS "PowerWriteValueUnitsSpecifier" (BYVAL RootPowerKey AS QUAD, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWriteValueUnitsSpecifier LIB "powrprof.dll" ALIAS "PowerWriteValueUnitsSpecifier" ( BYVAL RootPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteACDefaultIndex LIB "powrprof.dll" ALIAS "PowerWriteACDefaultIndex" ( BYVAL RootSystemPowerKey AS QUAD , BYREF SchemePersonalityGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL DefaultAcIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteDCDefaultIndex LIB "powrprof.dll" ALIAS "PowerWriteDCDefaultIndex" ( BYVAL RootSystemPowerKey AS QUAD , BYREF SchemePersonalityGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL DefaultDcIndex AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerWriteIconResourceSpecifier LIB "PowrProf.dll" ALIAS "PowerWriteIconResourceSpecifier" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, PowerSettingGuid AS GUID, bBuffer AS QUAD, BYVAL BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerWriteIconResourceSpecifier LIB "powrprof.dll" ALIAS "PowerWriteIconResourceSpecifier" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Buffer AS BYTE PTR , BYVAL BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerWriteSettingAttributes LIB "powrprof.dll" ALIAS "PowerWriteSettingAttributes" ( BYREF SubGroupGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL Attributes AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerDuplicateScheme LIB "powrprof.dll" ALIAS "PowerDuplicateScheme" ( BYVAL RootPowerKey AS QUAD , BYREF SourceSchemeGuid AS GUID , BYREF DestinationSchemeGuid AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerImportPowerScheme LIB "powrprof.dll" ALIAS "PowerImportPowerScheme" ( BYVAL RootPowerKey AS QUAD , BYREF ImportFileNamePath AS WSTRINGZ , BYREF DestinationSchemeGuid AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerDeleteScheme LIB "powrprof.dll" ALIAS "PowerDeleteScheme" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerRemovePowerSetting LIB "powrprof.dll" ALIAS "PowerRemovePowerSetting" ( BYREF PowerSettingSubKeyGuid AS GUID , BYREF PowerSettingGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerCreateSetting LIB "powrprof.dll" ALIAS "PowerCreateSetting" ( BYVAL RootSystemPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerCreatePossibleSetting LIB "powrprof.dll" ALIAS "PowerCreatePossibleSetting" ( BYVAL RootSystemPowerKey AS QUAD , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYREF PowerSettingGuid AS GUID , BYVAL PossibleSettingIndex AS QUAD ) AS QUAD
'#endif
'//
'// Enumerate Functions.
'//
'#if (NTDDI_VERSION >= NTDDI_VISTA)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION PowerEnumerate LIB "PowrProf.dll" ALIAS "PowerEnumerate" (BYVAL RootPowerKey AS QUAD, SchemeGuid AS GUID, SubGroupOfPowerSettingsGuid AS GUID, BYVAL AccessFlags AS QUAD, BYVAL nIndex AS QUAD, Buffer AS QUAD, BufferSize AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION PowerEnumerate LIB "powrprof.dll" ALIAS "PowerEnumerate" ( BYVAL RootPowerKey AS QUAD , BYREF SchemeGuid AS GUID , BYREF SubGroupOfPowerSettingsGuid AS GUID , BYVAL AccessFlags AS QUAD , BYVAL Index AS QUAD , BYVAL Buffer AS BYTE PTR , BYREF BufferSize AS QUAD ) AS QUAD
#ENDIF
'#endif
'//
'// Activate Functions.
'//
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerSetActiveScheme LIB "powrprof.dll" ALIAS "PowerSetActiveScheme" ( BYVAL UserRootPowerKey AS QUAD , BYREF SchemeGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerGetActiveScheme LIB "powrprof.dll" ALIAS "PowerGetActiveScheme" ( BYVAL UserRootPowerKey AS QUAD , BYREF ActivePolicyGuid AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerOpenUserPowerKey LIB "powrprof.dll" ALIAS "PowerOpenUserPowerKey" ( BYREF phUserPowerKey AS QUAD , BYVAL Access AS REGSAM , BYVAL OpenExisting AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerOpenSystemPowerKey LIB "powrprof.dll" ALIAS "PowerOpenSystemPowerKey" ( BYREF phSystemPowerKey AS QUAD , BYVAL Access AS REGSAM , BYVAL OpenExisting AS LONG ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerCanRestoreIndividualDefaultPowerScheme LIB "powrprof.dll" ALIAS "PowerCanRestoreIndividualDefaultPowerScheme" ( BYREF SchemeGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerRestoreIndividualDefaultPowerScheme LIB "powrprof.dll" ALIAS "PowerRestoreIndividualDefaultPowerScheme" ( BYREF SchemeGuid AS GUID ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerRestoreDefaultPowerSchemes LIB "powrprof.dll" ALIAS "PowerRestoreDefaultPowerSchemes" ( ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerReplaceDefaultPowerSchemes LIB "powrprof.dll" ALIAS "PowerReplaceDefaultPowerSchemes" ( ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION PowerDeterminePlatformRole LIB "powrprof.dll" ALIAS "PowerDeterminePlatformRole" ( ) AS LONG ' POWER_PLATFORM_ROLE enum
'#endif
'//
'// =========================================
'// Device Power APIs
'// =========================================
'//
'//
'// ========================================================
'// These flags tell us how to interpret a query of
'// device power. Use these (or a combination of these)
'// for the QueryInterpretationFlags parameter sent into
'// DevicePowerEnumDevices().
'//
'// They'll ask us for some devices that supports some
'// D state. These flags help us determine what the
'// user really wants. I.e. does he want the device
'// name, or the hardware ID. Does he want some device
'// that supports some D state, or does he want us to
'// go see if that devices supports some S state? ...
'// ========================================================
'//
'//
'// Return HardwareID instead of the friendly device name, which
'// is the default.
'//
%EQUATE `DEVICEPOWER_HARDWAREID = &H80000000
'//
'//
'// 'and' the requested power states. I.e. if the user requested
'// that we query devices supporting D1 and D3, this flag says
'// "give me devices that support D1 *and* D3". Without this
'// flag, the query would be interpreted as "give me devices
'// that support D1 *or* D3".
'//
%EQUATE `DEVICEPOWER_AND_OPERATION = &H40000000
'// Only preform the query on devices that are present in the system.
'//
%EQUATE `DEVICEPOWER_FILTER_DEVICES_PRESENT = &H20000000
'//
'// Only preform the query on devices that are actual hardware.
'//
%EQUATE `DEVICEPOWER_FILTER_HARDWARE = &H10000000
'//
'// Only preform the query on devices that are armed to wake the
'// system from a sleep state.
'//
%EQUATE `DEVICEPOWER_FILTER_WAKEENABLED = &H08000000
'//
'// Only preform the query on devices that are capable of being programmed
'// to wake the system from a sleep state.
'//
%EQUATE `DEVICEPOWER_FILTER_WAKEPROGRAMMABLE = &H04000000
'//
'// Go find the device who's name is specifed by an input
'// parameter, then see if it's got the capabilities specified
'// in QueryFlags.
'//
%EQUATE `DEVICEPOWER_FILTER_ON_NAME = &H02000000
'//
'// Define flags to set/clear capabilities in the devices.
'//
'//
'// Enable the device to wake the system from a sleep state.
'//
%EQUATE `DEVICEPOWER_SET_WAKEENABLED = &H00000001
'//
'// Disable the device from waking the system from a sleep
'// state.
'//
%EQUATE `DEVICEPOWER_CLEAR_WAKEENABLED = &H00000002
'//
'// For the QueryFlags parameter, the user should send in
'// one of the PDCAP_D*_SUPPORTED flags found in ntpoapi.h.
'//
'// #define PDCAP_D0_SUPPORTED 0x00000001
'// #define PDCAP_D1_SUPPORTED 0x00000002
'// #define PDCAP_D2_SUPPORTED 0x00000004
'// #define PDCAP_D3_SUPPORTED 0x00000008
'// #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
'// #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
'// #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
'// #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
'// #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
'//
'// The user can also send in a combination of these values
'// to do queries that match either or both of the specified
'// flags. E.g. if the user used (PDCAP_D1_SUPPORTED | PDCAP_D3_SUPPORTED),
'// then the query would return a device that supported *either*
'// D1 or D3. The user could specify QUERY_AND_OPERATION in
'// QueryInterpretationFlags to get a device that supported
'// D1 *and* D3.
'//
'//
'// We also support querying on S states. Although devices don't
'// really understand system states, we can use the D-to-S state
'// mappings to derive this. For example, if we ask a device if
'// he supports S2, we can derive that by looking at his D-to-S
'// mappings. Suppose the device has a D-to-S state mapping
'// that looks like this:
'// S0 -> D0
'// S1 -> D3
'// S2 -> D3
'// S3 -> D3
'// S4 -> D3
'// S5 -> D3
'//
'// We see that S2 maps to D3 on this device. Does this device
'// actually support D3? We can find that out. If so, then we
'// say that this device supports S2.
'//
'// We have to make up the S-state vectors because there's no
'// existing values like the PDCAP_D* values.
'//
%EQUATE `PDCAP_S0_SUPPORTED = &H00010000
%EQUATE `PDCAP_S1_SUPPORTED = &H00020000
%EQUATE `PDCAP_S2_SUPPORTED = &H00040000
%EQUATE `PDCAP_S3_SUPPORTED = &H00080000
%EQUATE `PDCAP_WAKE_FROM_S0_SUPPORTED = &H00100000
%EQUATE `PDCAP_WAKE_FROM_S1_SUPPORTED = &H00200000
%EQUATE `PDCAP_WAKE_FROM_S2_SUPPORTED = &H00400000
%EQUATE `PDCAP_WAKE_FROM_S3_SUPPORTED = &H00800000
%EQUATE `PDCAP_S4_SUPPORTED = &H01000000
%EQUATE `PDCAP_S5_SUPPORTED = &H02000000
'//
'// Function prototypes
'//
'#if (NTDDI_VERSION >= NTDDI_WS03)
DECLARE FUNCTION DevicePowerEnumDevices LIB "powrprof.dll" ALIAS "DevicePowerEnumDevices" ( BYVAL QueryIndex AS QUAD , BYVAL QueryInterpretationFlags AS QUAD , BYVAL QueryFlags AS QUAD , BYVAL pReturnBuffer AS BYTE PTR , BYREF pBufferSize AS QUAD ) AS BYTE ' BOOLEAN
'#endif
'#if (NTDDI_VERSION >= NTDDI_WS03)
DECLARE FUNCTION DevicePowerSetDeviceState LIB "powrprof.dll" ALIAS "DevicePowerSetDeviceState" ( BYREF DeviceDescription AS WSTRINGZ , BYREF SetFlags AS QUAD , OPTIONAL BYVAL SetData AS QUAD ) AS QUAD
'#endif
'#if (NTDDI_VERSION >= NTDDI_WS03)
DECLARE FUNCTION DevicePowerOpen LIB "powrprof.dll" ALIAS "DevicePowerOpen" ( OPTIONAL BYVAL DebugMask AS QUAD ) AS BYTE ' BOOLEAN
'#endif
'#if (NTDDI_VERSION >= NTDDI_WS03)
DECLARE FUNCTION DevicePowerClose LIB "powrprof.dll" ALIAS "DevicePowerClose" ( ) AS BYTE ' BOOLEAN
'#endif
#ENDIF
