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

STORAGE_TEMPERATURE_INFO

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

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

フィールド

フィールドサイズx64x86説明
IndexWORD2+0+0温度センサーのインデックス番号。
TemperatureSHORT2+2+2現在の温度を摂氏で示す符号付き値。
OverThresholdSHORT2+4+4過熱と判定される上限しきい値を摂氏で示す。
UnderThresholdSHORT2+6+6低温と判定される下限しきい値を摂氏で示す。
OverThresholdChangableBOOLEAN1+8+8上限しきい値を変更可能かを示す真偽値。
UnderThresholdChangableBOOLEAN1+9+9下限しきい値を変更可能かを示す真偽値。
EventGeneratedBOOLEAN1+10+10しきい値超過でイベントを生成するかを示す真偽値。
Reserved0BYTE1+11+11将来の拡張のために予約されたバイト領域。
Reserved1DWORD4+12+12将来の拡張のために予約された32ビット領域。

各言語での定義

#include <windows.h>

// STORAGE_TEMPERATURE_INFO  (x64 16 / x86 16 バイト)
typedef struct STORAGE_TEMPERATURE_INFO {
    WORD Index;
    SHORT Temperature;
    SHORT OverThreshold;
    SHORT UnderThreshold;
    BOOLEAN OverThresholdChangable;
    BOOLEAN UnderThresholdChangable;
    BOOLEAN EventGenerated;
    BYTE Reserved0;
    DWORD Reserved1;
} STORAGE_TEMPERATURE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_TEMPERATURE_INFO
{
    public ushort Index;
    public short Temperature;
    public short OverThreshold;
    public short UnderThreshold;
    [MarshalAs(UnmanagedType.U1)] public bool OverThresholdChangable;
    [MarshalAs(UnmanagedType.U1)] public bool UnderThresholdChangable;
    [MarshalAs(UnmanagedType.U1)] public bool EventGenerated;
    public byte Reserved0;
    public uint Reserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_TEMPERATURE_INFO
    Public Index As UShort
    Public Temperature As Short
    Public OverThreshold As Short
    Public UnderThreshold As Short
    <MarshalAs(UnmanagedType.U1)> Public OverThresholdChangable As Boolean
    <MarshalAs(UnmanagedType.U1)> Public UnderThresholdChangable As Boolean
    <MarshalAs(UnmanagedType.U1)> Public EventGenerated As Boolean
    Public Reserved0 As Byte
    Public Reserved1 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_TEMPERATURE_INFO(ctypes.Structure):
    _fields_ = [
        ("Index", ctypes.c_ushort),
        ("Temperature", ctypes.c_short),
        ("OverThreshold", ctypes.c_short),
        ("UnderThreshold", ctypes.c_short),
        ("OverThresholdChangable", ctypes.c_byte),
        ("UnderThresholdChangable", ctypes.c_byte),
        ("EventGenerated", ctypes.c_byte),
        ("Reserved0", ctypes.c_ubyte),
        ("Reserved1", wintypes.DWORD),
    ]
#[repr(C)]
pub struct STORAGE_TEMPERATURE_INFO {
    pub Index: u16,
    pub Temperature: i16,
    pub OverThreshold: i16,
    pub UnderThreshold: i16,
    pub OverThresholdChangable: u8,
    pub UnderThresholdChangable: u8,
    pub EventGenerated: u8,
    pub Reserved0: u8,
    pub Reserved1: u32,
}
import "golang.org/x/sys/windows"

type STORAGE_TEMPERATURE_INFO struct {
	Index uint16
	Temperature int16
	OverThreshold int16
	UnderThreshold int16
	OverThresholdChangable byte
	UnderThresholdChangable byte
	EventGenerated byte
	Reserved0 byte
	Reserved1 uint32
}
type
  STORAGE_TEMPERATURE_INFO = record
    Index: Word;
    Temperature: Smallint;
    OverThreshold: Smallint;
    UnderThreshold: Smallint;
    OverThresholdChangable: ByteBool;
    UnderThresholdChangable: ByteBool;
    EventGenerated: ByteBool;
    Reserved0: Byte;
    Reserved1: DWORD;
  end;
const STORAGE_TEMPERATURE_INFO = extern struct {
    Index: u16,
    Temperature: i16,
    OverThreshold: i16,
    UnderThreshold: i16,
    OverThresholdChangable: u8,
    UnderThresholdChangable: u8,
    EventGenerated: u8,
    Reserved0: u8,
    Reserved1: u32,
};
type
  STORAGE_TEMPERATURE_INFO {.bycopy.} = object
    Index: uint16
    Temperature: int16
    OverThreshold: int16
    UnderThreshold: int16
    OverThresholdChangable: uint8
    UnderThresholdChangable: uint8
    EventGenerated: uint8
    Reserved0: uint8
    Reserved1: uint32
struct STORAGE_TEMPERATURE_INFO
{
    ushort Index;
    short Temperature;
    short OverThreshold;
    short UnderThreshold;
    ubyte OverThresholdChangable;
    ubyte UnderThresholdChangable;
    ubyte EventGenerated;
    ubyte Reserved0;
    uint Reserved1;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_TEMPERATURE_INFO サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Index : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Temperature : SHORT (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; OverThreshold : SHORT (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; UnderThreshold : SHORT (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; OverThresholdChangable : BOOLEAN (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; UnderThresholdChangable : BOOLEAN (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; EventGenerated : BOOLEAN (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; Reserved0 : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; Reserved1 : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_TEMPERATURE_INFO
    #field short Index
    #field short Temperature
    #field short OverThreshold
    #field short UnderThreshold
    #field bool1 OverThresholdChangable
    #field bool1 UnderThresholdChangable
    #field bool1 EventGenerated
    #field byte Reserved0
    #field int Reserved1
#endstruct

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