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

STORAGE_TEMPERATURE_THRESHOLD

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
FlagsWORD2+8+8しきい値設定の動作を示すフラグ。
IndexWORD2+10+10対象とする温度センサーのインデックス。
ThresholdSHORT2+12+12設定する温度しきい値を摂氏で示す符号付き値。
OverThresholdBOOLEAN1+14+14上限しきい値か下限しきい値かを示す真偽値。TRUEで上限。
ReservedBYTE1+15+15将来の拡張のために予約されたバイト領域。

各言語での定義

#include <windows.h>

// STORAGE_TEMPERATURE_THRESHOLD  (x64 16 / x86 16 バイト)
typedef struct STORAGE_TEMPERATURE_THRESHOLD {
    DWORD Version;
    DWORD Size;
    WORD Flags;
    WORD Index;
    SHORT Threshold;
    BOOLEAN OverThreshold;
    BYTE Reserved;
} STORAGE_TEMPERATURE_THRESHOLD;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_TEMPERATURE_THRESHOLD
{
    public uint Version;
    public uint Size;
    public ushort Flags;
    public ushort Index;
    public short Threshold;
    [MarshalAs(UnmanagedType.U1)] public bool OverThreshold;
    public byte Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_TEMPERATURE_THRESHOLD
    Public Version As UInteger
    Public Size As UInteger
    Public Flags As UShort
    Public Index As UShort
    Public Threshold As Short
    <MarshalAs(UnmanagedType.U1)> Public OverThreshold As Boolean
    Public Reserved As Byte
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_TEMPERATURE_THRESHOLD(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("Flags", ctypes.c_ushort),
        ("Index", ctypes.c_ushort),
        ("Threshold", ctypes.c_short),
        ("OverThreshold", ctypes.c_byte),
        ("Reserved", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct STORAGE_TEMPERATURE_THRESHOLD {
    pub Version: u32,
    pub Size: u32,
    pub Flags: u16,
    pub Index: u16,
    pub Threshold: i16,
    pub OverThreshold: u8,
    pub Reserved: u8,
}
import "golang.org/x/sys/windows"

type STORAGE_TEMPERATURE_THRESHOLD struct {
	Version uint32
	Size uint32
	Flags uint16
	Index uint16
	Threshold int16
	OverThreshold byte
	Reserved byte
}
type
  STORAGE_TEMPERATURE_THRESHOLD = record
    Version: DWORD;
    Size: DWORD;
    Flags: Word;
    Index: Word;
    Threshold: Smallint;
    OverThreshold: ByteBool;
    Reserved: Byte;
  end;
const STORAGE_TEMPERATURE_THRESHOLD = extern struct {
    Version: u32,
    Size: u32,
    Flags: u16,
    Index: u16,
    Threshold: i16,
    OverThreshold: u8,
    Reserved: u8,
};
type
  STORAGE_TEMPERATURE_THRESHOLD {.bycopy.} = object
    Version: uint32
    Size: uint32
    Flags: uint16
    Index: uint16
    Threshold: int16
    OverThreshold: uint8
    Reserved: uint8
struct STORAGE_TEMPERATURE_THRESHOLD
{
    uint Version;
    uint Size;
    ushort Flags;
    ushort Index;
    short Threshold;
    ubyte OverThreshold;
    ubyte Reserved;
}

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_THRESHOLD サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Flags : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; Index : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; Threshold : SHORT (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; OverThreshold : BOOLEAN (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; Reserved : BYTE (+15, 1byte)  poke st,15,値  /  値 = peek(st,15)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_TEMPERATURE_THRESHOLD
    #field int Version
    #field int Size
    #field short Flags
    #field short Index
    #field short Threshold
    #field bool1 OverThreshold
    #field byte Reserved
#endstruct

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