| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
//! Interface for powrprof.dll, the power policy applicator |
| 7 |
use shared::guiddef::GUID; |
| 8 |
use shared::minwindef::{ |
| 9 |
BOOL, DWORD, HKEY, LPARAM, LPDWORD, PBYTE, PUCHAR, PUINT, PULONG, UCHAR, UINT, ULONG, |
| 10 |
}; |
| 11 |
use um::winnt::{ |
| 12 |
BOOLEAN, LPCWSTR, LPWSTR, NUM_DISCHARGE_POLICIES, PADMINISTRATOR_POWER_POLICY, |
| 13 |
POWER_ACTION_POLICY, POWER_PLATFORM_ROLE, PROCESSOR_POWER_POLICY, PVOID, SYSTEM_POWER_LEVEL, |
| 14 |
SYSTEM_POWER_STATE, |
| 15 |
}; |
| 16 |
use um::winreg::REGSAM; |
| 17 |
STRUCT!{struct GLOBAL_MACHINE_POWER_POLICY { |
| 18 |
Revision: ULONG, |
| 19 |
LidOpenWakeAc: SYSTEM_POWER_STATE, |
| 20 |
LidOpenWakeDc: SYSTEM_POWER_STATE, |
| 21 |
BroadcastCapacityResolution: ULONG, |
| 22 |
}} |
| 23 |
pub type PGLOBAL_MACHINE_POWER_POLICY = *mut GLOBAL_MACHINE_POWER_POLICY; |
| 24 |
STRUCT!{struct GLOBAL_USER_POWER_POLICY { |
| 25 |
Revision: ULONG, |
| 26 |
PowerButtonAc: POWER_ACTION_POLICY, |
| 27 |
PowerButtonDc: POWER_ACTION_POLICY, |
| 28 |
SleepButtonAc: POWER_ACTION_POLICY, |
| 29 |
SleepButtonDc: POWER_ACTION_POLICY, |
| 30 |
LidCloseAc: POWER_ACTION_POLICY, |
| 31 |
LidCloseDc: POWER_ACTION_POLICY, |
| 32 |
DischargePolicy: [SYSTEM_POWER_LEVEL; NUM_DISCHARGE_POLICIES], |
| 33 |
GlobalFlags: ULONG, |
| 34 |
}} |
| 35 |
pub type PGLOBAL_USER_POWER_POLICY = *mut GLOBAL_USER_POWER_POLICY; |
| 36 |
STRUCT!{struct GLOBAL_POWER_POLICY { |
| 37 |
user: GLOBAL_USER_POWER_POLICY, |
| 38 |
mach: GLOBAL_MACHINE_POWER_POLICY, |
| 39 |
}} |
| 40 |
pub type PGLOBAL_POWER_POLICY = *mut GLOBAL_POWER_POLICY; |
| 41 |
STRUCT!{struct MACHINE_POWER_POLICY { |
| 42 |
Revision: ULONG, |
| 43 |
MinSleepAc: SYSTEM_POWER_STATE, |
| 44 |
MinSleepDc: SYSTEM_POWER_STATE, |
| 45 |
ReducedLatencySleepAc: SYSTEM_POWER_STATE, |
| 46 |
ReducedLatencySleepDc: SYSTEM_POWER_STATE, |
| 47 |
DozeTimeoutAc: ULONG, |
| 48 |
DozeTimeoutDc: ULONG, |
| 49 |
DozeS4TimeoutAc: ULONG, |
| 50 |
DozeS4TimeoutDc: ULONG, |
| 51 |
MinThrottleAc: UCHAR, |
| 52 |
MinThrottleDc: UCHAR, |
| 53 |
pad1: [UCHAR; 2], |
| 54 |
OverThrottledAc: POWER_ACTION_POLICY, |
| 55 |
OverThrottledDc: POWER_ACTION_POLICY, |
| 56 |
}} |
| 57 |
pub type PMACHINE_POWER_POLICY = *mut MACHINE_POWER_POLICY; |
| 58 |
STRUCT!{struct MACHINE_PROCESSOR_POWER_POLICY { |
| 59 |
Revision: ULONG, |
| 60 |
ProcessorPolicyAc: PROCESSOR_POWER_POLICY, |
| 61 |
ProcessorPolicyDc: PROCESSOR_POWER_POLICY, |
| 62 |
}} |
| 63 |
pub type PMACHINE_PROCESSOR_POWER_POLICY = *mut MACHINE_PROCESSOR_POWER_POLICY; |
| 64 |
STRUCT!{struct USER_POWER_POLICY { |
| 65 |
Revision: ULONG, |
| 66 |
IdleAc: POWER_ACTION_POLICY, |
| 67 |
IdleDc: POWER_ACTION_POLICY, |
| 68 |
IdleTimeoutAc: ULONG, |
| 69 |
IdleTimeoutDc: ULONG, |
| 70 |
IdleSensitivityAc: UCHAR, |
| 71 |
IdleSensitivityDc: UCHAR, |
| 72 |
ThrottlePolicyAc: UCHAR, |
| 73 |
ThrottlePolicyDc: UCHAR, |
| 74 |
MaxSleepAc: SYSTEM_POWER_STATE, |
| 75 |
MaxSleepDc: SYSTEM_POWER_STATE, |
| 76 |
Reserved: [ULONG; 2], |
| 77 |
VideoTimeoutAc: ULONG, |
| 78 |
VideoTimeoutDc: ULONG, |
| 79 |
SpindownTimeoutAc: ULONG, |
| 80 |
SpindownTimeoutDc: ULONG, |
| 81 |
OptimizeForPowerAc: BOOLEAN, |
| 82 |
OptimizeForPowerDc: BOOLEAN, |
| 83 |
FanThrottleToleranceAc: UCHAR, |
| 84 |
FanThrottleToleranceDc: UCHAR, |
| 85 |
ForcedThrottleAc: UCHAR, |
| 86 |
ForcedThrottleDc: UCHAR, |
| 87 |
}} |
| 88 |
pub type PUSER_POWER_POLICY = *mut USER_POWER_POLICY; |
| 89 |
STRUCT!{struct POWER_POLICY { |
| 90 |
user: USER_POWER_POLICY, |
| 91 |
mach: MACHINE_POWER_POLICY, |
| 92 |
}} |
| 93 |
pub type PPOWER_POLICY = *mut POWER_POLICY; |
| 94 |
pub const EnableSysTrayBatteryMeter: ULONG = 0x01; |
| 95 |
pub const EnableMultiBatteryDisplay: ULONG = 0x02; |
| 96 |
pub const EnablePasswordLogon: ULONG = 0x04; |
| 97 |
pub const EnableWakeOnRing: ULONG = 0x08; |
| 98 |
pub const EnableVideoDimDisplay: ULONG = 0x10; |
| 99 |
pub const POWER_ATTRIBUTE_HIDE: ULONG = 0x00000001; |
| 100 |
pub const POWER_ATTRIBUTE_SHOW_AOAC: ULONG = 0x00000002; |
| 101 |
pub const NEWSCHEME: UINT = -1i32 as u32; |
| 102 |
FN!{stdcall PWRSCHEMESENUMPROC_V1( |
| 103 |
Index: UINT, |
| 104 |
NameSize: DWORD, |
| 105 |
Name: LPWSTR, |
| 106 |
DescriptionSize: DWORD, |
| 107 |
Description: LPWSTR, |
| 108 |
Policy: PPOWER_POLICY, |
| 109 |
Context: LPARAM, |
| 110 |
) -> BOOLEAN} |
| 111 |
FN!{stdcall PWRSCHEMESENUMPROC_V2( |
| 112 |
Index: UINT, |
| 113 |
NameSize: DWORD, |
| 114 |
Name: LPWSTR, |
| 115 |
DescriptionSize: DWORD, |
| 116 |
Description: LPWSTR, |
| 117 |
Policy: PPOWER_POLICY, |
| 118 |
Context: LPARAM, |
| 119 |
) -> BOOLEAN} |
| 120 |
pub type PWRSCHEMESENUMPROC = *mut PWRSCHEMESENUMPROC_V2; |
| 121 |
extern "system" { |
| 122 |
pub fn GetPwrDiskSpindownRange( |
| 123 |
puiMax: PUINT, |
| 124 |
puiMin: PUINT, |
| 125 |
) -> BOOLEAN; |
| 126 |
pub fn EnumPwrSchemes( |
| 127 |
lpfn: PWRSCHEMESENUMPROC, |
| 128 |
lParam: LPARAM, |
| 129 |
) -> BOOLEAN; |
| 130 |
pub fn ReadGlobalPwrPolicy( |
| 131 |
pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, |
| 132 |
) -> BOOLEAN; |
| 133 |
pub fn ReadPwrScheme( |
| 134 |
uiID: UINT, |
| 135 |
pPowerPolicy: PPOWER_POLICY, |
| 136 |
) -> BOOLEAN; |
| 137 |
pub fn WritePwrScheme( |
| 138 |
puiID: PUINT, |
| 139 |
lpszSchemeName: LPCWSTR, |
| 140 |
lpszDescription: LPCWSTR, |
| 141 |
lpScheme: PPOWER_POLICY, |
| 142 |
) -> BOOLEAN; |
| 143 |
pub fn WriteGlobalPwrPolicy( |
| 144 |
pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, |
| 145 |
) -> BOOLEAN; |
| 146 |
pub fn DeletePwrScheme( |
| 147 |
uiID: UINT, |
| 148 |
) -> BOOLEAN; |
| 149 |
pub fn GetActivePwrScheme( |
| 150 |
puiID: PUINT, |
| 151 |
) -> BOOLEAN; |
| 152 |
pub fn SetActivePwrScheme( |
| 153 |
uiID: UINT, |
| 154 |
pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, |
| 155 |
pPowerPolicy: PPOWER_POLICY, |
| 156 |
) -> BOOLEAN; |
| 157 |
pub fn IsPwrSuspendAllowed() -> BOOLEAN; |
| 158 |
pub fn IsPwrHibernateAllowed() -> BOOLEAN; |
| 159 |
pub fn IsPwrShutdownAllowed() -> BOOLEAN; |
| 160 |
pub fn IsAdminOverrideActive( |
| 161 |
papp: PADMINISTRATOR_POWER_POLICY, |
| 162 |
) -> BOOLEAN; |
| 163 |
pub fn SetSuspendState( |
| 164 |
bHibernate: BOOLEAN, |
| 165 |
bForce: BOOLEAN, |
| 166 |
bWakeupEventsDisabled: BOOLEAN, |
| 167 |
) -> BOOLEAN; |
| 168 |
pub fn GetCurrentPowerPolicies( |
| 169 |
pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, |
| 170 |
pPowerPolicy: PPOWER_POLICY, |
| 171 |
) -> BOOLEAN; |
| 172 |
pub fn CanUserWritePwrScheme() -> BOOLEAN; |
| 173 |
pub fn ReadProcessorPwrScheme( |
| 174 |
uiID: UINT, |
| 175 |
pMachineProcessorPowerPolicy: PMACHINE_PROCESSOR_POWER_POLICY, |
| 176 |
) -> BOOLEAN; |
| 177 |
pub fn WriteProcessorPwrScheme( |
| 178 |
uiID: UINT, |
| 179 |
pMachineProcessorPowerPolicy: PMACHINE_PROCESSOR_POWER_POLICY, |
| 180 |
) -> BOOLEAN; |
| 181 |
pub fn ValidatePowerPolicies( |
| 182 |
pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, |
| 183 |
pPowerPolicy: PPOWER_POLICY, |
| 184 |
) -> BOOLEAN; |
| 185 |
} |
| 186 |
ENUM!{enum POWER_DATA_ACCESSOR { |
| 187 |
ACCESS_AC_POWER_SETTING_INDEX = 0, |
| 188 |
ACCESS_DC_POWER_SETTING_INDEX, |
| 189 |
ACCESS_FRIENDLY_NAME, |
| 190 |
ACCESS_DESCRIPTION, |
| 191 |
ACCESS_POSSIBLE_POWER_SETTING, |
| 192 |
ACCESS_POSSIBLE_POWER_SETTING_FRIENDLY_NAME, |
| 193 |
ACCESS_POSSIBLE_POWER_SETTING_DESCRIPTION, |
| 194 |
ACCESS_DEFAULT_AC_POWER_SETTING, |
| 195 |
ACCESS_DEFAULT_DC_POWER_SETTING, |
| 196 |
ACCESS_POSSIBLE_VALUE_MIN, |
| 197 |
ACCESS_POSSIBLE_VALUE_MAX, |
| 198 |
ACCESS_POSSIBLE_VALUE_INCREMENT, |
| 199 |
ACCESS_POSSIBLE_VALUE_UNITS, |
| 200 |
ACCESS_ICON_RESOURCE, |
| 201 |
ACCESS_DEFAULT_SECURITY_DESCRIPTOR, |
| 202 |
ACCESS_ATTRIBUTES, |
| 203 |
ACCESS_SCHEME, |
| 204 |
ACCESS_SUBGROUP, |
| 205 |
ACCESS_INDIVIDUAL_SETTING, |
| 206 |
ACCESS_ACTIVE_SCHEME, |
| 207 |
ACCESS_CREATE_SCHEME, |
| 208 |
ACCESS_AC_POWER_SETTING_MAX, |
| 209 |
ACCESS_DC_POWER_SETTING_MAX, |
| 210 |
ACCESS_AC_POWER_SETTING_MIN, |
| 211 |
ACCESS_DC_POWER_SETTING_MIN, |
| 212 |
ACCESS_PROFILE, |
| 213 |
ACCESS_OVERLAY_SCHEME, |
| 214 |
ACCESS_ACTIVE_OVERLAY_SCHEME, |
| 215 |
}} |
| 216 |
pub type PPOWER_DATA_ACCESSOR = *mut POWER_DATA_ACCESSOR; |
| 217 |
pub const DEVICE_NOTIFY_CALLBACK: ULONG = 2; |
| 218 |
FN!{stdcall DEVICE_NOTIFY_CALLBACK_ROUTINE( |
| 219 |
Context: PVOID, |
| 220 |
Type: ULONG, |
| 221 |
Setting: PVOID, |
| 222 |
) -> ULONG} |
| 223 |
pub type PDEVICE_NOTIFY_CALLBACK_ROUTINE = *mut DEVICE_NOTIFY_CALLBACK_ROUTINE; |
| 224 |
STRUCT!{struct DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS { |
| 225 |
Callback: PDEVICE_NOTIFY_CALLBACK_ROUTINE, |
| 226 |
Context: PVOID, |
| 227 |
}} |
| 228 |
pub type PDEVICE_NOTIFY_SUBSCRIBE_PARAMETERS = *mut DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS; |
| 229 |
extern "system" { |
| 230 |
pub fn PowerIsSettingRangeDefined( |
| 231 |
SubKeyGuid: *const GUID, |
| 232 |
SettingGuid: *const GUID, |
| 233 |
) -> BOOLEAN; |
| 234 |
pub fn PowerSettingAccessCheckEx( |
| 235 |
AccessFlags: POWER_DATA_ACCESSOR, |
| 236 |
PowerGuid: *const GUID, |
| 237 |
AccessType: REGSAM, |
| 238 |
) -> DWORD; |
| 239 |
pub fn PowerSettingAccessCheck( |
| 240 |
AccessFlags: POWER_DATA_ACCESSOR, |
| 241 |
PowerGuid: *const GUID, |
| 242 |
) -> DWORD; |
| 243 |
pub fn PowerReadACValueIndex( |
| 244 |
RootPowerKey: HKEY, |
| 245 |
SchemeGuid: *const GUID, |
| 246 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 247 |
PowerSettingGuid: *const GUID, |
| 248 |
AcValueIndex: LPDWORD, |
| 249 |
) -> DWORD; |
| 250 |
pub fn PowerReadDCValueIndex( |
| 251 |
RootPowerKey: HKEY, |
| 252 |
SchemeGuid: *const GUID, |
| 253 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 254 |
PowerSettingGuid: *const GUID, |
| 255 |
DcValueIndex: LPDWORD, |
| 256 |
) -> DWORD; |
| 257 |
pub fn PowerReadFriendlyName( |
| 258 |
RootPowerKey: HKEY, |
| 259 |
SchemeGuid: *const GUID, |
| 260 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 261 |
PowerSettingGuid: *const GUID, |
| 262 |
Buffer: PUCHAR, |
| 263 |
BufferSize: LPDWORD, |
| 264 |
) -> DWORD; |
| 265 |
pub fn PowerReadDescription( |
| 266 |
RootPowerKey: HKEY, |
| 267 |
SchemeGuid: *const GUID, |
| 268 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 269 |
PowerSettingGuid: *const GUID, |
| 270 |
Buffer: PUCHAR, |
| 271 |
BufferSize: LPDWORD, |
| 272 |
) -> DWORD; |
| 273 |
pub fn PowerReadPossibleValue( |
| 274 |
RootPowerKey: HKEY, |
| 275 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 276 |
PowerSettingGuid: *const GUID, |
| 277 |
Type: PULONG, |
| 278 |
PossibleSettingIndex: ULONG, |
| 279 |
Buffer: PUCHAR, |
| 280 |
BufferSize: LPDWORD, |
| 281 |
) -> DWORD; |
| 282 |
pub fn PowerReadPossibleFriendlyName( |
| 283 |
RootPowerKey: HKEY, |
| 284 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 285 |
PowerSettingGuid: *const GUID, |
| 286 |
PossibleSettingIndex: ULONG, |
| 287 |
Buffer: PUCHAR, |
| 288 |
BufferSize: LPDWORD, |
| 289 |
) -> DWORD; |
| 290 |
pub fn PowerReadPossibleDescription( |
| 291 |
RootPowerKey: HKEY, |
| 292 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 293 |
PowerSettingGuid: *const GUID, |
| 294 |
PossibleSettingIndex: ULONG, |
| 295 |
Buffer: PUCHAR, |
| 296 |
BufferSize: LPDWORD, |
| 297 |
) -> DWORD; |
| 298 |
pub fn PowerReadValueMin( |
| 299 |
RootPowerKey: HKEY, |
| 300 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 301 |
PowerSettingGuid: *const GUID, |
| 302 |
ValueMinimum: LPDWORD, |
| 303 |
) -> DWORD; |
| 304 |
pub fn PowerReadValueMax( |
| 305 |
RootPowerKey: HKEY, |
| 306 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 307 |
PowerSettingGuid: *const GUID, |
| 308 |
ValueMaximum: LPDWORD, |
| 309 |
) -> DWORD; |
| 310 |
pub fn PowerReadValueIncrement( |
| 311 |
RootPowerKey: HKEY, |
| 312 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 313 |
PowerSettingGuid: *const GUID, |
| 314 |
ValueIncrement: LPDWORD, |
| 315 |
) -> DWORD; |
| 316 |
pub fn PowerReadValueUnitsSpecifier( |
| 317 |
RootPowerKey: HKEY, |
| 318 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 319 |
PowerSettingGuid: *const GUID, |
| 320 |
Buffer: *mut UCHAR, |
| 321 |
BufferSize: LPDWORD, |
| 322 |
) -> DWORD; |
| 323 |
pub fn PowerReadACDefaultIndex( |
| 324 |
RootPowerKey: HKEY, |
| 325 |
SchemeGuid: *const GUID, |
| 326 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 327 |
PowerSettingGuid: *const GUID, |
| 328 |
AcDefaultIndex: LPDWORD, |
| 329 |
) -> DWORD; |
| 330 |
pub fn PowerReadDCDefaultIndex( |
| 331 |
RootPowerKey: HKEY, |
| 332 |
SchemeGuid: *const GUID, |
| 333 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 334 |
PowerSettingGuid: *const GUID, |
| 335 |
DcDefaultIndex: LPDWORD, |
| 336 |
) -> DWORD; |
| 337 |
pub fn PowerReadIconResourceSpecifier( |
| 338 |
RootPowerKey: HKEY, |
| 339 |
SchemeGuid: *const GUID, |
| 340 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 341 |
PowerSettingGuid: *const GUID, |
| 342 |
Buffer: PUCHAR, |
| 343 |
BufferSize: LPDWORD, |
| 344 |
) -> DWORD; |
| 345 |
pub fn PowerReadSettingAttributes( |
| 346 |
SubGroupGuid: *const GUID, |
| 347 |
PowerSettingGuid: *const GUID, |
| 348 |
) -> DWORD; |
| 349 |
pub fn PowerWriteFriendlyName( |
| 350 |
RootPowerKey: HKEY, |
| 351 |
SchemeGuid: *const GUID, |
| 352 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 353 |
PowerSettingGuid: *const GUID, |
| 354 |
Buffer: *mut UCHAR, |
| 355 |
BufferSize: DWORD, |
| 356 |
) -> DWORD; |
| 357 |
pub fn PowerWriteDescription( |
| 358 |
RootPowerKey: HKEY, |
| 359 |
SchemeGuid: *const GUID, |
| 360 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 361 |
PowerSettingGuid: *const GUID, |
| 362 |
Buffer: *mut UCHAR, |
| 363 |
BufferSize: DWORD, |
| 364 |
) -> DWORD; |
| 365 |
pub fn PowerWritePossibleValue( |
| 366 |
RootPowerKey: HKEY, |
| 367 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 368 |
PowerSettingGuid: *const GUID, |
| 369 |
Type: ULONG, |
| 370 |
PossibleSettingIndex: ULONG, |
| 371 |
Buffer: *mut UCHAR, |
| 372 |
BufferSize: DWORD, |
| 373 |
) -> DWORD; |
| 374 |
pub fn PowerWritePossibleFriendlyName( |
| 375 |
RootPowerKey: HKEY, |
| 376 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 377 |
PowerSettingGuid: *const GUID, |
| 378 |
PossibleSettingIndex: ULONG, |
| 379 |
Buffer: *mut UCHAR, |
| 380 |
BufferSize: DWORD, |
| 381 |
) -> DWORD; |
| 382 |
pub fn PowerWritePossibleDescription( |
| 383 |
RootPowerKey: HKEY, |
| 384 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 385 |
PowerSettingGuid: *const GUID, |
| 386 |
PossibleSettingIndex: ULONG, |
| 387 |
Buffer: *mut UCHAR, |
| 388 |
BufferSize: DWORD, |
| 389 |
) -> DWORD; |
| 390 |
pub fn PowerWriteValueMin( |
| 391 |
RootPowerKey: HKEY, |
| 392 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 393 |
PowerSettingGuid: *const GUID, |
| 394 |
ValueMinimum: DWORD, |
| 395 |
) -> DWORD; |
| 396 |
pub fn PowerWriteValueMax( |
| 397 |
RootPowerKey: HKEY, |
| 398 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 399 |
PowerSettingGuid: *const GUID, |
| 400 |
ValueMaximum: DWORD, |
| 401 |
) -> DWORD; |
| 402 |
pub fn PowerWriteValueIncrement( |
| 403 |
RootPowerKey: HKEY, |
| 404 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 405 |
PowerSettingGuid: *const GUID, |
| 406 |
ValueIncrement: DWORD, |
| 407 |
) -> DWORD; |
| 408 |
pub fn PowerWriteValueUnitsSpecifier( |
| 409 |
RootPowerKey: HKEY, |
| 410 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 411 |
PowerSettingGuid: *const GUID, |
| 412 |
Buffer: *mut UCHAR, |
| 413 |
BufferSize: DWORD, |
| 414 |
) -> DWORD; |
| 415 |
pub fn PowerWriteACDefaultIndex( |
| 416 |
RootSystemPowerKey: HKEY, |
| 417 |
SchemePersonalityGuid: *const GUID, |
| 418 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 419 |
PowerSettingGuid: *const GUID, |
| 420 |
DefaultAcIndex: DWORD, |
| 421 |
) -> DWORD; |
| 422 |
pub fn PowerWriteDCDefaultIndex( |
| 423 |
RootSystemPowerKey: HKEY, |
| 424 |
SchemePersonalityGuid: *const GUID, |
| 425 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 426 |
PowerSettingGuid: *const GUID, |
| 427 |
DefaultDcIndex: DWORD, |
| 428 |
) -> DWORD; |
| 429 |
pub fn PowerWriteIconResourceSpecifier( |
| 430 |
RootPowerKey: HKEY, |
| 431 |
SchemeGuid: *const GUID, |
| 432 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 433 |
PowerSettingGuid: *const GUID, |
| 434 |
Buffer: *mut UCHAR, |
| 435 |
BufferSize: DWORD, |
| 436 |
) -> DWORD; |
| 437 |
pub fn PowerWriteSettingAttributes( |
| 438 |
SubGroupGuid: *const GUID, |
| 439 |
PowerSettingGuid: *const GUID, |
| 440 |
Attributes: DWORD, |
| 441 |
) -> DWORD; |
| 442 |
pub fn PowerDuplicateScheme( |
| 443 |
RootPowerKey: HKEY, |
| 444 |
SourceSchemeGuid: *const GUID, |
| 445 |
DestinationSchemeGuid: *mut *mut GUID, |
| 446 |
) -> DWORD; |
| 447 |
pub fn PowerImportPowerScheme( |
| 448 |
RootPowerKey: HKEY, |
| 449 |
ImportFileNamePath: LPCWSTR, |
| 450 |
DestinationSchemeGuid: *mut *mut GUID, |
| 451 |
) -> DWORD; |
| 452 |
pub fn PowerDeleteScheme( |
| 453 |
RootPowerKey: HKEY, |
| 454 |
SchemeGuid: *mut GUID, |
| 455 |
) -> DWORD; |
| 456 |
pub fn PowerRemovePowerSetting( |
| 457 |
PowerSettingSubKeyGuid: *const GUID, |
| 458 |
PowerSettingGuid: *const GUID, |
| 459 |
) -> DWORD; |
| 460 |
pub fn PowerCreateSetting( |
| 461 |
RootPowerKey: HKEY, |
| 462 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 463 |
PowerSettingGuid: *const GUID, |
| 464 |
) -> DWORD; |
| 465 |
pub fn PowerCreatePossibleSetting( |
| 466 |
RootPowerKey: HKEY, |
| 467 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 468 |
PowerSettingGuid: *const GUID, |
| 469 |
PossibleSettingIndex: ULONG, |
| 470 |
) -> DWORD; |
| 471 |
pub fn PowerEnumerate( |
| 472 |
RootPowerKey: HKEY, |
| 473 |
SchemeGuid: *const GUID, |
| 474 |
SubGroupOfPowerSettingsGuid: *const GUID, |
| 475 |
AccessFlags: POWER_DATA_ACCESSOR, |
| 476 |
Index: ULONG, |
| 477 |
Buffer: *mut UCHAR, |
| 478 |
BufferSize: *mut DWORD, |
| 479 |
) -> DWORD; |
| 480 |
pub fn PowerOpenUserPowerKey( |
| 481 |
phUserPowerKey: *mut HKEY, |
| 482 |
Access: REGSAM, |
| 483 |
OpenExisting: BOOL, |
| 484 |
) -> DWORD; |
| 485 |
pub fn PowerOpenSystemPowerKey( |
| 486 |
phSystemPowerKey: *mut HKEY, |
| 487 |
Access: REGSAM, |
| 488 |
OpenExisting: BOOL, |
| 489 |
) -> DWORD; |
| 490 |
pub fn PowerCanRestoreIndividualDefaultPowerScheme( |
| 491 |
SchemeGuid: *const GUID, |
| 492 |
) -> DWORD; |
| 493 |
pub fn PowerRestoreIndividualDefaultPowerScheme( |
| 494 |
SchemeGuid: *const GUID, |
| 495 |
) -> DWORD; |
| 496 |
pub fn PowerRestoreDefaultPowerSchemes() -> DWORD; |
| 497 |
pub fn PowerReplaceDefaultPowerSchemes() -> DWORD; |
| 498 |
pub fn PowerDeterminePlatformRole() -> POWER_PLATFORM_ROLE; |
| 499 |
} |
| 500 |
pub const DEVICEPOWER_HARDWAREID: ULONG = 0x80000000; |
| 501 |
pub const DEVICEPOWER_AND_OPERATION: ULONG = 0x40000000; |
| 502 |
pub const DEVICEPOWER_FILTER_DEVICES_PRESENT: ULONG = 0x20000000; |
| 503 |
pub const DEVICEPOWER_FILTER_HARDWARE: ULONG = 0x10000000; |
| 504 |
pub const DEVICEPOWER_FILTER_WAKEENABLED: ULONG = 0x08000000; |
| 505 |
pub const DEVICEPOWER_FILTER_WAKEPROGRAMMABLE: ULONG = 0x04000000; |
| 506 |
pub const DEVICEPOWER_FILTER_ON_NAME: ULONG = 0x02000000; |
| 507 |
pub const DEVICEPOWER_SET_WAKEENABLED: ULONG = 0x00000001; |
| 508 |
pub const DEVICEPOWER_CLEAR_WAKEENABLED: ULONG = 0x00000002; |
| 509 |
pub const PDCAP_S0_SUPPORTED: ULONG = 0x00010000; |
| 510 |
pub const PDCAP_S1_SUPPORTED: ULONG = 0x00020000; |
| 511 |
pub const PDCAP_S2_SUPPORTED: ULONG = 0x00040000; |
| 512 |
pub const PDCAP_S3_SUPPORTED: ULONG = 0x00080000; |
| 513 |
pub const PDCAP_WAKE_FROM_S0_SUPPORTED: ULONG = 0x00100000; |
| 514 |
pub const PDCAP_WAKE_FROM_S1_SUPPORTED: ULONG = 0x00200000; |
| 515 |
pub const PDCAP_WAKE_FROM_S2_SUPPORTED: ULONG = 0x00400000; |
| 516 |
pub const PDCAP_WAKE_FROM_S3_SUPPORTED: ULONG = 0x00800000; |
| 517 |
pub const PDCAP_S4_SUPPORTED: ULONG = 0x01000000; |
| 518 |
pub const PDCAP_S5_SUPPORTED: ULONG = 0x02000000; |
| 519 |
extern "system" { |
| 520 |
pub fn DevicePowerEnumDevices( |
| 521 |
QueryIndex: ULONG, |
| 522 |
QueryInterpretationFlags: ULONG, |
| 523 |
QueryFlags: ULONG, |
| 524 |
pReturnBuffer: PBYTE, |
| 525 |
pBufferSize: PULONG, |
| 526 |
) -> BOOLEAN; |
| 527 |
pub fn DevicePowerSetDeviceState( |
| 528 |
DeviceDescription: LPCWSTR, |
| 529 |
SetFlags: ULONG, |
| 530 |
SetData: PVOID, |
| 531 |
) -> DWORD; |
| 532 |
pub fn DevicePowerOpen( |
| 533 |
DebugMask: ULONG, |
| 534 |
) -> BOOLEAN; |
| 535 |
pub fn DevicePowerClose() -> BOOLEAN; |
| 536 |
} |
| 537 |
STRUCT!{struct THERMAL_EVENT { |
| 538 |
Version: ULONG, |
| 539 |
Size: ULONG, |
| 540 |
Type: ULONG, |
| 541 |
Temperature: ULONG, |
| 542 |
TripPointTemperature: ULONG, |
| 543 |
Initiator: LPWSTR, |
| 544 |
}} |
| 545 |
pub type PTHERMAL_EVENT = *mut THERMAL_EVENT; |
| 546 |
extern "system" { |
| 547 |
pub fn PowerReportThermalEvent( |
| 548 |
Event: PTHERMAL_EVENT, |
| 549 |
) -> DWORD; |
| 550 |
} |