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この構造体のサイズです。sizeof(STORAGE_TEMPERATURE_THRESHOLD) を設定してください。
FlagsWORD2+8+8

この要求に対して設定されるフラグです。有効なフラグは次のとおりです。

フラグ 説明
STORAGE_PROTOCOL_COMMAND_FLAG_ADAPTER_REQUEST このフラグは、要求の対象がデバイスではなくアダプターであることを示します。
IndexWORD2+10+10温度情報のインスタンスを識別します。0 から始まります。インデックス 0 は複合値を示す場合があります。
ThresholdSHORT2+12+12しきい値の温度を摂氏で示す符号付きの値です。
OverThresholdBOOLEAN1+14+14Threshold が過温度と低温度のどちらのしきい値を指定するかを示します。true の場合はデバイスの OverThreshold 温度値を設定し、それ以外の場合は UnderThreshold 温度値を設定します。
ReservedBYTE1+15+15将来の使用のために予約済みです。

公式ドキュメント

この構造体は、ストレージデバイスの過温度または低温度のしきい値を(IOCTL_STORAGE_SET_TEMPERATURE_THRESHOLD を介して)設定するために使用されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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