ホーム › System.Ioctl › DEVICE_INTERNAL_STATUS_DATA
DEVICE_INTERNAL_STATUS_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のサイズをバイト単位で示す。 |
| T10VendorId | ULONGLONG | 8 | +8 | +8 | T10標準のベンダー識別子(8バイト)を64ビット値で示す。 |
| DataSet1Length | DWORD | 4 | +16 | +16 | データセット1のバイト長。 |
| DataSet2Length | DWORD | 4 | +20 | +20 | データセット2のバイト長。 |
| DataSet3Length | DWORD | 4 | +24 | +24 | データセット3のバイト長。 |
| DataSet4Length | DWORD | 4 | +28 | +28 | データセット4のバイト長。 |
| StatusDataVersion | BYTE | 1 | +32 | +32 | ステータスデータの形式バージョン。 |
| Reserved | BYTE | 3 | +33 | +33 | 将来の拡張のために予約されたバイト配列。 |
| ReasonIdentifier | BYTE | 128 | +36 | +36 | データ収集の理由を識別するバイト配列。 |
| StatusDataLength | DWORD | 4 | +164 | +164 | StatusData領域のバイト長。 |
| StatusData | BYTE | 1 | +168 | +168 | 実際の内部ステータスデータを格納する可変長バイト配列。 |
各言語での定義
#include <windows.h>
// DEVICE_INTERNAL_STATUS_DATA (x64 176 / x86 176 バイト)
typedef struct DEVICE_INTERNAL_STATUS_DATA {
DWORD Version;
DWORD Size;
ULONGLONG T10VendorId;
DWORD DataSet1Length;
DWORD DataSet2Length;
DWORD DataSet3Length;
DWORD DataSet4Length;
BYTE StatusDataVersion;
BYTE Reserved[3];
BYTE ReasonIdentifier[128];
DWORD StatusDataLength;
BYTE StatusData[1];
} DEVICE_INTERNAL_STATUS_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_INTERNAL_STATUS_DATA
{
public uint Version;
public uint Size;
public ulong T10VendorId;
public uint DataSet1Length;
public uint DataSet2Length;
public uint DataSet3Length;
public uint DataSet4Length;
public byte StatusDataVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] ReasonIdentifier;
public uint StatusDataLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] StatusData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_INTERNAL_STATUS_DATA
Public Version As UInteger
Public Size As UInteger
Public T10VendorId As ULong
Public DataSet1Length As UInteger
Public DataSet2Length As UInteger
Public DataSet3Length As UInteger
Public DataSet4Length As UInteger
Public StatusDataVersion As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> Public ReasonIdentifier() As Byte
Public StatusDataLength As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public StatusData() As Byte
End Structureimport ctypes
from ctypes import wintypes
class DEVICE_INTERNAL_STATUS_DATA(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("T10VendorId", ctypes.c_ulonglong),
("DataSet1Length", wintypes.DWORD),
("DataSet2Length", wintypes.DWORD),
("DataSet3Length", wintypes.DWORD),
("DataSet4Length", wintypes.DWORD),
("StatusDataVersion", ctypes.c_ubyte),
("Reserved", ctypes.c_ubyte * 3),
("ReasonIdentifier", ctypes.c_ubyte * 128),
("StatusDataLength", wintypes.DWORD),
("StatusData", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct DEVICE_INTERNAL_STATUS_DATA {
pub Version: u32,
pub Size: u32,
pub T10VendorId: u64,
pub DataSet1Length: u32,
pub DataSet2Length: u32,
pub DataSet3Length: u32,
pub DataSet4Length: u32,
pub StatusDataVersion: u8,
pub Reserved: [u8; 3],
pub ReasonIdentifier: [u8; 128],
pub StatusDataLength: u32,
pub StatusData: [u8; 1],
}import "golang.org/x/sys/windows"
type DEVICE_INTERNAL_STATUS_DATA struct {
Version uint32
Size uint32
T10VendorId uint64
DataSet1Length uint32
DataSet2Length uint32
DataSet3Length uint32
DataSet4Length uint32
StatusDataVersion byte
Reserved [3]byte
ReasonIdentifier [128]byte
StatusDataLength uint32
StatusData [1]byte
}type
DEVICE_INTERNAL_STATUS_DATA = record
Version: DWORD;
Size: DWORD;
T10VendorId: UInt64;
DataSet1Length: DWORD;
DataSet2Length: DWORD;
DataSet3Length: DWORD;
DataSet4Length: DWORD;
StatusDataVersion: Byte;
Reserved: array[0..2] of Byte;
ReasonIdentifier: array[0..127] of Byte;
StatusDataLength: DWORD;
StatusData: array[0..0] of Byte;
end;const DEVICE_INTERNAL_STATUS_DATA = extern struct {
Version: u32,
Size: u32,
T10VendorId: u64,
DataSet1Length: u32,
DataSet2Length: u32,
DataSet3Length: u32,
DataSet4Length: u32,
StatusDataVersion: u8,
Reserved: [3]u8,
ReasonIdentifier: [128]u8,
StatusDataLength: u32,
StatusData: [1]u8,
};type
DEVICE_INTERNAL_STATUS_DATA {.bycopy.} = object
Version: uint32
Size: uint32
T10VendorId: uint64
DataSet1Length: uint32
DataSet2Length: uint32
DataSet3Length: uint32
DataSet4Length: uint32
StatusDataVersion: uint8
Reserved: array[3, uint8]
ReasonIdentifier: array[128, uint8]
StatusDataLength: uint32
StatusData: array[1, uint8]struct DEVICE_INTERNAL_STATUS_DATA
{
uint Version;
uint Size;
ulong T10VendorId;
uint DataSet1Length;
uint DataSet2Length;
uint DataSet3Length;
uint DataSet4Length;
ubyte StatusDataVersion;
ubyte[3] Reserved;
ubyte[128] ReasonIdentifier;
uint StatusDataLength;
ubyte[1] StatusData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICE_INTERNAL_STATUS_DATA サイズ: 176 バイト(x64)
dim st, 44 ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; T10VendorId : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; DataSet1Length : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DataSet2Length : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DataSet3Length : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; DataSet4Length : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; StatusDataVersion : BYTE (+32, 1byte) poke st,32,値 / 値 = peek(st,32)
; Reserved : BYTE (+33, 3byte) varptr(st)+33 を基点に操作(3byte:入れ子/配列)
; ReasonIdentifier : BYTE (+36, 128byte) varptr(st)+36 を基点に操作(128byte:入れ子/配列)
; StatusDataLength : DWORD (+164, 4byte) st.41 = 値 / 値 = st.41 (lpoke/lpeek も可)
; StatusData : BYTE (+168, 1byte) varptr(st)+168 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICE_INTERNAL_STATUS_DATA
#field int Version
#field int Size
#field int64 T10VendorId
#field int DataSet1Length
#field int DataSet2Length
#field int DataSet3Length
#field int DataSet4Length
#field byte StatusDataVersion
#field byte Reserved 3
#field byte ReasonIdentifier 128
#field int StatusDataLength
#field byte StatusData 1
#endstruct
stdim st, DEVICE_INTERNAL_STATUS_DATA ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version