ホーム › System.Power › THERMAL_POLICY
THERMAL_POLICY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | この温度ポリシー構造体のバージョン番号。 |
| WaitForUpdate | BOOLEAN | 1 | +4 | +4 | 更新を待機するかどうかを示すブール値。TRUEで待機する。 |
| Hibernate | BOOLEAN | 1 | +5 | +5 | 休止状態を許可するかどうかを示すブール値。 |
| Critical | BOOLEAN | 1 | +6 | +6 | クリティカルな温度状態であるかどうかを示すブール値。 |
| ThermalStandby | BOOLEAN | 1 | +7 | +7 | 温度起因のスタンバイ移行を行うかどうかを示すブール値。 |
| ActivationReasons | DWORD | 4 | +8 | +8 | ポリシーが起動された理由を表すフラグのビット集合。 |
| PassiveLimit | DWORD | 4 | +12 | +12 | パッシブ冷却時のプロセッサ性能上限。0〜100%で表す。 |
| ActiveLevel | DWORD | 4 | +16 | +16 | アクティブ冷却のレベル(ファン段階など)を示す値。 |
| OverThrottled | BOOLEAN | 1 | +20 | +20 | 過剰にスロットリングされた状態かどうかを示すブール値。 |
各言語での定義
#include <windows.h>
// THERMAL_POLICY (x64 24 / x86 24 バイト)
typedef struct THERMAL_POLICY {
DWORD Version;
BOOLEAN WaitForUpdate;
BOOLEAN Hibernate;
BOOLEAN Critical;
BOOLEAN ThermalStandby;
DWORD ActivationReasons;
DWORD PassiveLimit;
DWORD ActiveLevel;
BOOLEAN OverThrottled;
} THERMAL_POLICY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct THERMAL_POLICY
{
public uint Version;
[MarshalAs(UnmanagedType.U1)] public bool WaitForUpdate;
[MarshalAs(UnmanagedType.U1)] public bool Hibernate;
[MarshalAs(UnmanagedType.U1)] public bool Critical;
[MarshalAs(UnmanagedType.U1)] public bool ThermalStandby;
public uint ActivationReasons;
public uint PassiveLimit;
public uint ActiveLevel;
[MarshalAs(UnmanagedType.U1)] public bool OverThrottled;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure THERMAL_POLICY
Public Version As UInteger
<MarshalAs(UnmanagedType.U1)> Public WaitForUpdate As Boolean
<MarshalAs(UnmanagedType.U1)> Public Hibernate As Boolean
<MarshalAs(UnmanagedType.U1)> Public Critical As Boolean
<MarshalAs(UnmanagedType.U1)> Public ThermalStandby As Boolean
Public ActivationReasons As UInteger
Public PassiveLimit As UInteger
Public ActiveLevel As UInteger
<MarshalAs(UnmanagedType.U1)> Public OverThrottled As Boolean
End Structureimport ctypes
from ctypes import wintypes
class THERMAL_POLICY(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("WaitForUpdate", ctypes.c_byte),
("Hibernate", ctypes.c_byte),
("Critical", ctypes.c_byte),
("ThermalStandby", ctypes.c_byte),
("ActivationReasons", wintypes.DWORD),
("PassiveLimit", wintypes.DWORD),
("ActiveLevel", wintypes.DWORD),
("OverThrottled", ctypes.c_byte),
]#[repr(C)]
pub struct THERMAL_POLICY {
pub Version: u32,
pub WaitForUpdate: u8,
pub Hibernate: u8,
pub Critical: u8,
pub ThermalStandby: u8,
pub ActivationReasons: u32,
pub PassiveLimit: u32,
pub ActiveLevel: u32,
pub OverThrottled: u8,
}import "golang.org/x/sys/windows"
type THERMAL_POLICY struct {
Version uint32
WaitForUpdate byte
Hibernate byte
Critical byte
ThermalStandby byte
ActivationReasons uint32
PassiveLimit uint32
ActiveLevel uint32
OverThrottled byte
}type
THERMAL_POLICY = record
Version: DWORD;
WaitForUpdate: ByteBool;
Hibernate: ByteBool;
Critical: ByteBool;
ThermalStandby: ByteBool;
ActivationReasons: DWORD;
PassiveLimit: DWORD;
ActiveLevel: DWORD;
OverThrottled: ByteBool;
end;const THERMAL_POLICY = extern struct {
Version: u32,
WaitForUpdate: u8,
Hibernate: u8,
Critical: u8,
ThermalStandby: u8,
ActivationReasons: u32,
PassiveLimit: u32,
ActiveLevel: u32,
OverThrottled: u8,
};type
THERMAL_POLICY {.bycopy.} = object
Version: uint32
WaitForUpdate: uint8
Hibernate: uint8
Critical: uint8
ThermalStandby: uint8
ActivationReasons: uint32
PassiveLimit: uint32
ActiveLevel: uint32
OverThrottled: uint8struct THERMAL_POLICY
{
uint Version;
ubyte WaitForUpdate;
ubyte Hibernate;
ubyte Critical;
ubyte ThermalStandby;
uint ActivationReasons;
uint PassiveLimit;
uint ActiveLevel;
ubyte OverThrottled;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; THERMAL_POLICY サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; WaitForUpdate : BOOLEAN (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Hibernate : BOOLEAN (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; Critical : BOOLEAN (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; ThermalStandby : BOOLEAN (+7, 1byte) poke st,7,値 / 値 = peek(st,7)
; ActivationReasons : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; PassiveLimit : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ActiveLevel : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; OverThrottled : BOOLEAN (+20, 1byte) poke st,20,値 / 値 = peek(st,20)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global THERMAL_POLICY
#field int Version
#field bool1 WaitForUpdate
#field bool1 Hibernate
#field bool1 Critical
#field bool1 ThermalStandby
#field int ActivationReasons
#field int PassiveLimit
#field int ActiveLevel
#field bool1 OverThrottled
#endstruct
stdim st, THERMAL_POLICY ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version