ホーム › System.Ioctl › STORAGE_TEMPERATURE_DATA_DESCRIPTOR
STORAGE_TEMPERATURE_DATA_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体全体のサイズをバイト単位で示す。 |
| CriticalTemperature | SHORT | 2 | +8 | +8 | 致命的とされる温度を摂氏で示す符号付き値。 |
| WarningTemperature | SHORT | 2 | +10 | +10 | 警告とされる温度を摂氏で示す符号付き値。 |
| InfoCount | WORD | 2 | +12 | +12 | TemperatureInfo配列に含まれる温度情報エントリ数。 |
| Reserved0 | BYTE | 2 | +14 | +14 | 将来の拡張のために予約されたバイト領域。 |
| Reserved1 | DWORD | 8 | +16 | +16 | 将来の拡張のために予約された32ビット領域。 |
| TemperatureInfo | STORAGE_TEMPERATURE_INFO | 16 | +24 | +24 | STORAGE_TEMPERATURE_INFO構造体の可変長配列。各センサー情報を保持する。 |
各言語での定義
#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;
// STORAGE_TEMPERATURE_DATA_DESCRIPTOR (x64 40 / x86 40 バイト)
typedef struct STORAGE_TEMPERATURE_DATA_DESCRIPTOR {
DWORD Version;
DWORD Size;
SHORT CriticalTemperature;
SHORT WarningTemperature;
WORD InfoCount;
BYTE Reserved0[2];
DWORD Reserved1[2];
STORAGE_TEMPERATURE_INFO TemperatureInfo[1];
} STORAGE_TEMPERATURE_DATA_DESCRIPTOR;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_TEMPERATURE_DATA_DESCRIPTOR
{
public uint Version;
public uint Size;
public short CriticalTemperature;
public short WarningTemperature;
public ushort InfoCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved0;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] Reserved1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public STORAGE_TEMPERATURE_INFO[] TemperatureInfo;
}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
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_TEMPERATURE_DATA_DESCRIPTOR
Public Version As UInteger
Public Size As UInteger
Public CriticalTemperature As Short
Public WarningTemperature As Short
Public InfoCount As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved0() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved1() As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public TemperatureInfo() As STORAGE_TEMPERATURE_INFO
End Structureimport 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),
]
class STORAGE_TEMPERATURE_DATA_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("CriticalTemperature", ctypes.c_short),
("WarningTemperature", ctypes.c_short),
("InfoCount", ctypes.c_ushort),
("Reserved0", ctypes.c_ubyte * 2),
("Reserved1", wintypes.DWORD * 2),
("TemperatureInfo", STORAGE_TEMPERATURE_INFO * 1),
]#[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,
}
#[repr(C)]
pub struct STORAGE_TEMPERATURE_DATA_DESCRIPTOR {
pub Version: u32,
pub Size: u32,
pub CriticalTemperature: i16,
pub WarningTemperature: i16,
pub InfoCount: u16,
pub Reserved0: [u8; 2],
pub Reserved1: [u32; 2],
pub TemperatureInfo: [STORAGE_TEMPERATURE_INFO; 1],
}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_DATA_DESCRIPTOR struct {
Version uint32
Size uint32
CriticalTemperature int16
WarningTemperature int16
InfoCount uint16
Reserved0 [2]byte
Reserved1 [2]uint32
TemperatureInfo [1]STORAGE_TEMPERATURE_INFO
}type
STORAGE_TEMPERATURE_INFO = record
Index: Word;
Temperature: Smallint;
OverThreshold: Smallint;
UnderThreshold: Smallint;
OverThresholdChangable: ByteBool;
UnderThresholdChangable: ByteBool;
EventGenerated: ByteBool;
Reserved0: Byte;
Reserved1: DWORD;
end;
STORAGE_TEMPERATURE_DATA_DESCRIPTOR = record
Version: DWORD;
Size: DWORD;
CriticalTemperature: Smallint;
WarningTemperature: Smallint;
InfoCount: Word;
Reserved0: array[0..1] of Byte;
Reserved1: array[0..1] of DWORD;
TemperatureInfo: array[0..0] of STORAGE_TEMPERATURE_INFO;
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,
};
const STORAGE_TEMPERATURE_DATA_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
CriticalTemperature: i16,
WarningTemperature: i16,
InfoCount: u16,
Reserved0: [2]u8,
Reserved1: [2]u32,
TemperatureInfo: [1]STORAGE_TEMPERATURE_INFO,
};type
STORAGE_TEMPERATURE_INFO {.bycopy.} = object
Index: uint16
Temperature: int16
OverThreshold: int16
UnderThreshold: int16
OverThresholdChangable: uint8
UnderThresholdChangable: uint8
EventGenerated: uint8
Reserved0: uint8
Reserved1: uint32
STORAGE_TEMPERATURE_DATA_DESCRIPTOR {.bycopy.} = object
Version: uint32
Size: uint32
CriticalTemperature: int16
WarningTemperature: int16
InfoCount: uint16
Reserved0: array[2, uint8]
Reserved1: array[2, uint32]
TemperatureInfo: array[1, STORAGE_TEMPERATURE_INFO]struct STORAGE_TEMPERATURE_INFO
{
ushort Index;
short Temperature;
short OverThreshold;
short UnderThreshold;
ubyte OverThresholdChangable;
ubyte UnderThresholdChangable;
ubyte EventGenerated;
ubyte Reserved0;
uint Reserved1;
}
struct STORAGE_TEMPERATURE_DATA_DESCRIPTOR
{
uint Version;
uint Size;
short CriticalTemperature;
short WarningTemperature;
ushort InfoCount;
ubyte[2] Reserved0;
uint[2] Reserved1;
STORAGE_TEMPERATURE_INFO[1] TemperatureInfo;
}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_DATA_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CriticalTemperature : SHORT (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; WarningTemperature : SHORT (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; InfoCount : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; Reserved0 : BYTE (+14, 2byte) varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; Reserved1 : DWORD (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; TemperatureInfo : STORAGE_TEMPERATURE_INFO (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global STORAGE_TEMPERATURE_DATA_DESCRIPTOR
#field int Version
#field int Size
#field short CriticalTemperature
#field short WarningTemperature
#field short InfoCount
#field byte Reserved0 2
#field int Reserved1 2
#field STORAGE_TEMPERATURE_INFO TemperatureInfo 1
#endstruct
stdim st, STORAGE_TEMPERATURE_DATA_DESCRIPTOR ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version