Win32 API 日本語リファレンス
ホームSystem.Power › THERMAL_INFORMATION

THERMAL_INFORMATION

構造体
サイズx64: 88 バイト / x86: 76 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ThermalStampDWORD4+0+0熱情報のタイムスタンプ(変化検出用)である。
ThermalConstant1DWORD4+4+4受動的冷却制御の時定数1である。
ThermalConstant2DWORD4+8+8受動的冷却制御の時定数2である。
ProcessorsUINT_PTR8/4+16+12この熱ゾーンが影響するプロセッサのアフィニティマスクである。
SamplingPeriodDWORD4+24+16温度サンプリング周期(秒)である。
CurrentTemperatureDWORD4+28+20現在の温度(ケルビンの1/10単位)である。
PassiveTripPointDWORD4+32+24受動的冷却を開始するトリップ温度(ケルビンの1/10単位)である。
CriticalTripPointDWORD4+36+28シャットダウンを行う臨界トリップ温度(ケルビンの1/10単位)である。
ActiveTripPointCountBYTE1+40+32有効なアクティブトリップポイントの個数である。
ActiveTripPointDWORD40+44+36各アクティブ冷却トリップ温度を保持する配列(ケルビンの1/10単位)である。

各言語での定義

#include <windows.h>

// THERMAL_INFORMATION  (x64 88 / x86 76 バイト)
typedef struct THERMAL_INFORMATION {
    DWORD ThermalStamp;
    DWORD ThermalConstant1;
    DWORD ThermalConstant2;
    UINT_PTR Processors;
    DWORD SamplingPeriod;
    DWORD CurrentTemperature;
    DWORD PassiveTripPoint;
    DWORD CriticalTripPoint;
    BYTE ActiveTripPointCount;
    DWORD ActiveTripPoint[10];
} THERMAL_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct THERMAL_INFORMATION
{
    public uint ThermalStamp;
    public uint ThermalConstant1;
    public uint ThermalConstant2;
    public UIntPtr Processors;
    public uint SamplingPeriod;
    public uint CurrentTemperature;
    public uint PassiveTripPoint;
    public uint CriticalTripPoint;
    public byte ActiveTripPointCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] ActiveTripPoint;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure THERMAL_INFORMATION
    Public ThermalStamp As UInteger
    Public ThermalConstant1 As UInteger
    Public ThermalConstant2 As UInteger
    Public Processors As UIntPtr
    Public SamplingPeriod As UInteger
    Public CurrentTemperature As UInteger
    Public PassiveTripPoint As UInteger
    Public CriticalTripPoint As UInteger
    Public ActiveTripPointCount As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public ActiveTripPoint() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class THERMAL_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("ThermalStamp", wintypes.DWORD),
        ("ThermalConstant1", wintypes.DWORD),
        ("ThermalConstant2", wintypes.DWORD),
        ("Processors", ctypes.c_size_t),
        ("SamplingPeriod", wintypes.DWORD),
        ("CurrentTemperature", wintypes.DWORD),
        ("PassiveTripPoint", wintypes.DWORD),
        ("CriticalTripPoint", wintypes.DWORD),
        ("ActiveTripPointCount", ctypes.c_ubyte),
        ("ActiveTripPoint", wintypes.DWORD * 10),
    ]
#[repr(C)]
pub struct THERMAL_INFORMATION {
    pub ThermalStamp: u32,
    pub ThermalConstant1: u32,
    pub ThermalConstant2: u32,
    pub Processors: usize,
    pub SamplingPeriod: u32,
    pub CurrentTemperature: u32,
    pub PassiveTripPoint: u32,
    pub CriticalTripPoint: u32,
    pub ActiveTripPointCount: u8,
    pub ActiveTripPoint: [u32; 10],
}
import "golang.org/x/sys/windows"

type THERMAL_INFORMATION struct {
	ThermalStamp uint32
	ThermalConstant1 uint32
	ThermalConstant2 uint32
	Processors uintptr
	SamplingPeriod uint32
	CurrentTemperature uint32
	PassiveTripPoint uint32
	CriticalTripPoint uint32
	ActiveTripPointCount byte
	ActiveTripPoint [10]uint32
}
type
  THERMAL_INFORMATION = record
    ThermalStamp: DWORD;
    ThermalConstant1: DWORD;
    ThermalConstant2: DWORD;
    Processors: NativeUInt;
    SamplingPeriod: DWORD;
    CurrentTemperature: DWORD;
    PassiveTripPoint: DWORD;
    CriticalTripPoint: DWORD;
    ActiveTripPointCount: Byte;
    ActiveTripPoint: array[0..9] of DWORD;
  end;
const THERMAL_INFORMATION = extern struct {
    ThermalStamp: u32,
    ThermalConstant1: u32,
    ThermalConstant2: u32,
    Processors: usize,
    SamplingPeriod: u32,
    CurrentTemperature: u32,
    PassiveTripPoint: u32,
    CriticalTripPoint: u32,
    ActiveTripPointCount: u8,
    ActiveTripPoint: [10]u32,
};
type
  THERMAL_INFORMATION {.bycopy.} = object
    ThermalStamp: uint32
    ThermalConstant1: uint32
    ThermalConstant2: uint32
    Processors: uint
    SamplingPeriod: uint32
    CurrentTemperature: uint32
    PassiveTripPoint: uint32
    CriticalTripPoint: uint32
    ActiveTripPointCount: uint8
    ActiveTripPoint: array[10, uint32]
struct THERMAL_INFORMATION
{
    uint ThermalStamp;
    uint ThermalConstant1;
    uint ThermalConstant2;
    size_t Processors;
    uint SamplingPeriod;
    uint CurrentTemperature;
    uint PassiveTripPoint;
    uint CriticalTripPoint;
    ubyte ActiveTripPointCount;
    uint[10] ActiveTripPoint;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; THERMAL_INFORMATION サイズ: 76 バイト(x86)
dim st, 19    ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; ThermalStamp : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ThermalConstant1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ThermalConstant2 : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Processors : UINT_PTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SamplingPeriod : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; CurrentTemperature : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; PassiveTripPoint : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; CriticalTripPoint : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ActiveTripPointCount : BYTE (+32, 1byte)  poke st,32,値  /  値 = peek(st,32)
; ActiveTripPoint : DWORD (+36, 40byte)  varptr(st)+36 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; THERMAL_INFORMATION サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; ThermalStamp : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ThermalConstant1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ThermalConstant2 : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Processors : UINT_PTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; SamplingPeriod : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; CurrentTemperature : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; PassiveTripPoint : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; CriticalTripPoint : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ActiveTripPointCount : BYTE (+40, 1byte)  poke st,40,値  /  値 = peek(st,40)
; ActiveTripPoint : DWORD (+44, 40byte)  varptr(st)+44 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global THERMAL_INFORMATION
    #field int ThermalStamp
    #field int ThermalConstant1
    #field int ThermalConstant2
    #field intptr Processors
    #field int SamplingPeriod
    #field int CurrentTemperature
    #field int PassiveTripPoint
    #field int CriticalTripPoint
    #field byte ActiveTripPointCount
    #field int ActiveTripPoint 10
#endstruct

stdim st, THERMAL_INFORMATION        ; NSTRUCT 変数を確保
st->ThermalStamp = 100
mes "ThermalStamp=" + st->ThermalStamp