ホーム › System.Ioctl › STORAGE_PHYSICAL_ADAPTER_DATA
STORAGE_PHYSICAL_ADAPTER_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AdapterId | DWORD | 4 | +0 | +0 | 物理アダプタの識別番号。 |
| HealthStatus | STORAGE_COMPONENT_HEALTH_STATUS | 4 | +4 | +4 | アダプタの健全性状態を示すSTORAGE_COMPONENT_HEALTH_STATUS列挙値。 |
| CommandProtocol | STORAGE_PROTOCOL_TYPE | 4 | +8 | +8 | アダプタが使用するコマンドプロトコルを示すSTORAGE_PROTOCOL_TYPE列挙値。 |
| SpecVersion | STORAGE_SPEC_VERSION | 16/8 | +16 | +12 | アダプタが準拠する仕様バージョンを示すSTORAGE_SPEC_VERSION。 |
| Vendor | BYTE | 8 | +32 | +20 | ベンダー名を示すバイト配列(文字列)。 |
| Model | BYTE | 40 | +40 | +28 | モデル名を示すバイト配列(文字列)。 |
| FirmwareRevision | BYTE | 16 | +80 | +68 | ファームウェアリビジョンを示すバイト配列(文字列)。 |
| PhysicalLocation | BYTE | 32 | +96 | +84 | 物理的な設置場所を示すバイト配列(文字列)。 |
| ExpanderConnected | BOOLEAN | 1 | +128 | +116 | エクスパンダが接続されているかを示す真偽値。 |
| Reserved0 | BYTE | 3 | +129 | +117 | 将来の拡張のために予約されたバイト領域。 |
| Reserved1 | DWORD | 12 | +132 | +120 | 将来の拡張のために予約された32ビット領域。 |
各言語での定義
#include <windows.h>
// STORAGE_SPEC_VERSION (x64 16 / x86 8 バイト)
typedef struct STORAGE_SPEC_VERSION {
_Anonymous_e__Struct Anonymous;
DWORD AsUlong;
} STORAGE_SPEC_VERSION;
// STORAGE_PHYSICAL_ADAPTER_DATA (x64 144 / x86 132 バイト)
typedef struct STORAGE_PHYSICAL_ADAPTER_DATA {
DWORD AdapterId;
STORAGE_COMPONENT_HEALTH_STATUS HealthStatus;
STORAGE_PROTOCOL_TYPE CommandProtocol;
STORAGE_SPEC_VERSION SpecVersion;
BYTE Vendor[8];
BYTE Model[40];
BYTE FirmwareRevision[16];
BYTE PhysicalLocation[32];
BOOLEAN ExpanderConnected;
BYTE Reserved0[3];
DWORD Reserved1[3];
} STORAGE_PHYSICAL_ADAPTER_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_SPEC_VERSION
{
public _Anonymous_e__Struct Anonymous;
public uint AsUlong;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_PHYSICAL_ADAPTER_DATA
{
public uint AdapterId;
public int HealthStatus;
public int CommandProtocol;
public STORAGE_SPEC_VERSION SpecVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] Vendor;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] Model;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] FirmwareRevision;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] PhysicalLocation;
[MarshalAs(UnmanagedType.U1)] public bool ExpanderConnected;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] Reserved1;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_SPEC_VERSION
Public Anonymous As _Anonymous_e__Struct
Public AsUlong As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_PHYSICAL_ADAPTER_DATA
Public AdapterId As UInteger
Public HealthStatus As Integer
Public CommandProtocol As Integer
Public SpecVersion As STORAGE_SPEC_VERSION
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public Vendor() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=40)> Public Model() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public FirmwareRevision() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public PhysicalLocation() As Byte
<MarshalAs(UnmanagedType.U1)> Public ExpanderConnected As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved1() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class STORAGE_SPEC_VERSION(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Struct),
("AsUlong", wintypes.DWORD),
]
class STORAGE_PHYSICAL_ADAPTER_DATA(ctypes.Structure):
_fields_ = [
("AdapterId", wintypes.DWORD),
("HealthStatus", ctypes.c_int),
("CommandProtocol", ctypes.c_int),
("SpecVersion", STORAGE_SPEC_VERSION),
("Vendor", ctypes.c_ubyte * 8),
("Model", ctypes.c_ubyte * 40),
("FirmwareRevision", ctypes.c_ubyte * 16),
("PhysicalLocation", ctypes.c_ubyte * 32),
("ExpanderConnected", ctypes.c_byte),
("Reserved0", ctypes.c_ubyte * 3),
("Reserved1", wintypes.DWORD * 3),
]#[repr(C)]
pub struct STORAGE_SPEC_VERSION {
pub Anonymous: _Anonymous_e__Struct,
pub AsUlong: u32,
}
#[repr(C)]
pub struct STORAGE_PHYSICAL_ADAPTER_DATA {
pub AdapterId: u32,
pub HealthStatus: i32,
pub CommandProtocol: i32,
pub SpecVersion: STORAGE_SPEC_VERSION,
pub Vendor: [u8; 8],
pub Model: [u8; 40],
pub FirmwareRevision: [u8; 16],
pub PhysicalLocation: [u8; 32],
pub ExpanderConnected: u8,
pub Reserved0: [u8; 3],
pub Reserved1: [u32; 3],
}import "golang.org/x/sys/windows"
type STORAGE_SPEC_VERSION struct {
Anonymous _Anonymous_e__Struct
AsUlong uint32
}
type STORAGE_PHYSICAL_ADAPTER_DATA struct {
AdapterId uint32
HealthStatus int32
CommandProtocol int32
SpecVersion STORAGE_SPEC_VERSION
Vendor [8]byte
Model [40]byte
FirmwareRevision [16]byte
PhysicalLocation [32]byte
ExpanderConnected byte
Reserved0 [3]byte
Reserved1 [3]uint32
}type
STORAGE_SPEC_VERSION = record
Anonymous: _Anonymous_e__Struct;
AsUlong: DWORD;
end;
STORAGE_PHYSICAL_ADAPTER_DATA = record
AdapterId: DWORD;
HealthStatus: Integer;
CommandProtocol: Integer;
SpecVersion: STORAGE_SPEC_VERSION;
Vendor: array[0..7] of Byte;
Model: array[0..39] of Byte;
FirmwareRevision: array[0..15] of Byte;
PhysicalLocation: array[0..31] of Byte;
ExpanderConnected: ByteBool;
Reserved0: array[0..2] of Byte;
Reserved1: array[0..2] of DWORD;
end;const STORAGE_SPEC_VERSION = extern struct {
Anonymous: _Anonymous_e__Struct,
AsUlong: u32,
};
const STORAGE_PHYSICAL_ADAPTER_DATA = extern struct {
AdapterId: u32,
HealthStatus: i32,
CommandProtocol: i32,
SpecVersion: STORAGE_SPEC_VERSION,
Vendor: [8]u8,
Model: [40]u8,
FirmwareRevision: [16]u8,
PhysicalLocation: [32]u8,
ExpanderConnected: u8,
Reserved0: [3]u8,
Reserved1: [3]u32,
};type
STORAGE_SPEC_VERSION {.bycopy.} = object
Anonymous: _Anonymous_e__Struct
AsUlong: uint32
STORAGE_PHYSICAL_ADAPTER_DATA {.bycopy.} = object
AdapterId: uint32
HealthStatus: int32
CommandProtocol: int32
SpecVersion: STORAGE_SPEC_VERSION
Vendor: array[8, uint8]
Model: array[40, uint8]
FirmwareRevision: array[16, uint8]
PhysicalLocation: array[32, uint8]
ExpanderConnected: uint8
Reserved0: array[3, uint8]
Reserved1: array[3, uint32]struct STORAGE_SPEC_VERSION
{
_Anonymous_e__Struct Anonymous;
uint AsUlong;
}
struct STORAGE_PHYSICAL_ADAPTER_DATA
{
uint AdapterId;
int HealthStatus;
int CommandProtocol;
STORAGE_SPEC_VERSION SpecVersion;
ubyte[8] Vendor;
ubyte[40] Model;
ubyte[16] FirmwareRevision;
ubyte[32] PhysicalLocation;
ubyte ExpanderConnected;
ubyte[3] Reserved0;
uint[3] Reserved1;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STORAGE_PHYSICAL_ADAPTER_DATA サイズ: 132 バイト(x86)
dim st, 33 ; 4byte整数×33(構造体サイズ 132 / 4 切り上げ)
; AdapterId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; HealthStatus : STORAGE_COMPONENT_HEALTH_STATUS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CommandProtocol : STORAGE_PROTOCOL_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; SpecVersion : STORAGE_SPEC_VERSION (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; Vendor : BYTE (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; Model : BYTE (+28, 40byte) varptr(st)+28 を基点に操作(40byte:入れ子/配列)
; FirmwareRevision : BYTE (+68, 16byte) varptr(st)+68 を基点に操作(16byte:入れ子/配列)
; PhysicalLocation : BYTE (+84, 32byte) varptr(st)+84 を基点に操作(32byte:入れ子/配列)
; ExpanderConnected : BOOLEAN (+116, 1byte) poke st,116,値 / 値 = peek(st,116)
; Reserved0 : BYTE (+117, 3byte) varptr(st)+117 を基点に操作(3byte:入れ子/配列)
; Reserved1 : DWORD (+120, 12byte) varptr(st)+120 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_PHYSICAL_ADAPTER_DATA サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; AdapterId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; HealthStatus : STORAGE_COMPONENT_HEALTH_STATUS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CommandProtocol : STORAGE_PROTOCOL_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; SpecVersion : STORAGE_SPEC_VERSION (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; Vendor : BYTE (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; Model : BYTE (+40, 40byte) varptr(st)+40 を基点に操作(40byte:入れ子/配列)
; FirmwareRevision : BYTE (+80, 16byte) varptr(st)+80 を基点に操作(16byte:入れ子/配列)
; PhysicalLocation : BYTE (+96, 32byte) varptr(st)+96 を基点に操作(32byte:入れ子/配列)
; ExpanderConnected : BOOLEAN (+128, 1byte) poke st,128,値 / 値 = peek(st,128)
; Reserved0 : BYTE (+129, 3byte) varptr(st)+129 を基点に操作(3byte:入れ子/配列)
; Reserved1 : DWORD (+132, 12byte) varptr(st)+132 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_PHYSICAL_ADAPTER_DATA
#field int AdapterId
#field int HealthStatus
#field int CommandProtocol
#field byte SpecVersion 16
#field byte Vendor 8
#field byte Model 40
#field byte FirmwareRevision 16
#field byte PhysicalLocation 32
#field bool1 ExpanderConnected
#field byte Reserved0 3
#field int Reserved1 3
#endstruct
stdim st, STORAGE_PHYSICAL_ADAPTER_DATA ; NSTRUCT 変数を確保
st->AdapterId = 100
mes "AdapterId=" + st->AdapterId
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。