ホーム › Storage.IscsiDisc › STORAGE_FIRMWARE_INFO
STORAGE_FIRMWARE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | この構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のバイトサイズ。 |
| UpgradeSupport | BOOLEAN | 1 | +8 | +8 | ファームウェアアップグレードがサポートされていればTRUE。 |
| SlotCount | BYTE | 1 | +9 | +9 | ファームウェアスロットの総数。 |
| ActiveSlot | BYTE | 1 | +10 | +10 | 現在アクティブなスロット番号。 |
| PendingActivateSlot | BYTE | 1 | +11 | +11 | 次回起動時に有効化される保留中スロット番号。 |
| Reserved | DWORD | 4 | +12 | +12 | 予約フィールド。0を設定する。 |
| Slot | STORAGE_FIRMWARE_SLOT_INFO | 16 | +16 | +16 | 各スロット情報を表すSTORAGE_FIRMWARE_SLOT_INFO可変長配列。 |
各言語での定義
#include <windows.h>
// STORAGE_FIRMWARE_SLOT_INFO (x64 16 / x86 16 バイト)
typedef struct STORAGE_FIRMWARE_SLOT_INFO {
BYTE SlotNumber;
BOOLEAN ReadOnly;
BYTE Reserved[6];
_Revision_e__Union Revision;
} STORAGE_FIRMWARE_SLOT_INFO;
// STORAGE_FIRMWARE_INFO (x64 32 / x86 32 バイト)
typedef struct STORAGE_FIRMWARE_INFO {
DWORD Version;
DWORD Size;
BOOLEAN UpgradeSupport;
BYTE SlotCount;
BYTE ActiveSlot;
BYTE PendingActivateSlot;
DWORD Reserved;
STORAGE_FIRMWARE_SLOT_INFO Slot[1];
} STORAGE_FIRMWARE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_FIRMWARE_SLOT_INFO
{
public byte SlotNumber;
[MarshalAs(UnmanagedType.U1)] public bool ReadOnly;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved;
public _Revision_e__Union Revision;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_FIRMWARE_INFO
{
public uint Version;
public uint Size;
[MarshalAs(UnmanagedType.U1)] public bool UpgradeSupport;
public byte SlotCount;
public byte ActiveSlot;
public byte PendingActivateSlot;
public uint Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public STORAGE_FIRMWARE_SLOT_INFO[] Slot;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_FIRMWARE_SLOT_INFO
Public SlotNumber As Byte
<MarshalAs(UnmanagedType.U1)> Public ReadOnly As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved() As Byte
Public Revision As _Revision_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_FIRMWARE_INFO
Public Version As UInteger
Public Size As UInteger
<MarshalAs(UnmanagedType.U1)> Public UpgradeSupport As Boolean
Public SlotCount As Byte
Public ActiveSlot As Byte
Public PendingActivateSlot As Byte
Public Reserved As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Slot() As STORAGE_FIRMWARE_SLOT_INFO
End Structureimport ctypes
from ctypes import wintypes
class STORAGE_FIRMWARE_SLOT_INFO(ctypes.Structure):
_fields_ = [
("SlotNumber", ctypes.c_ubyte),
("ReadOnly", ctypes.c_byte),
("Reserved", ctypes.c_ubyte * 6),
("Revision", _Revision_e__Union),
]
class STORAGE_FIRMWARE_INFO(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("UpgradeSupport", ctypes.c_byte),
("SlotCount", ctypes.c_ubyte),
("ActiveSlot", ctypes.c_ubyte),
("PendingActivateSlot", ctypes.c_ubyte),
("Reserved", wintypes.DWORD),
("Slot", STORAGE_FIRMWARE_SLOT_INFO * 1),
]#[repr(C)]
pub struct STORAGE_FIRMWARE_SLOT_INFO {
pub SlotNumber: u8,
pub ReadOnly: u8,
pub Reserved: [u8; 6],
pub Revision: _Revision_e__Union,
}
#[repr(C)]
pub struct STORAGE_FIRMWARE_INFO {
pub Version: u32,
pub Size: u32,
pub UpgradeSupport: u8,
pub SlotCount: u8,
pub ActiveSlot: u8,
pub PendingActivateSlot: u8,
pub Reserved: u32,
pub Slot: [STORAGE_FIRMWARE_SLOT_INFO; 1],
}import "golang.org/x/sys/windows"
type STORAGE_FIRMWARE_SLOT_INFO struct {
SlotNumber byte
ReadOnly byte
Reserved [6]byte
Revision _Revision_e__Union
}
type STORAGE_FIRMWARE_INFO struct {
Version uint32
Size uint32
UpgradeSupport byte
SlotCount byte
ActiveSlot byte
PendingActivateSlot byte
Reserved uint32
Slot [1]STORAGE_FIRMWARE_SLOT_INFO
}type
STORAGE_FIRMWARE_SLOT_INFO = record
SlotNumber: Byte;
ReadOnly: ByteBool;
Reserved: array[0..5] of Byte;
Revision: _Revision_e__Union;
end;
STORAGE_FIRMWARE_INFO = record
Version: DWORD;
Size: DWORD;
UpgradeSupport: ByteBool;
SlotCount: Byte;
ActiveSlot: Byte;
PendingActivateSlot: Byte;
Reserved: DWORD;
Slot: array[0..0] of STORAGE_FIRMWARE_SLOT_INFO;
end;const STORAGE_FIRMWARE_SLOT_INFO = extern struct {
SlotNumber: u8,
ReadOnly: u8,
Reserved: [6]u8,
Revision: _Revision_e__Union,
};
const STORAGE_FIRMWARE_INFO = extern struct {
Version: u32,
Size: u32,
UpgradeSupport: u8,
SlotCount: u8,
ActiveSlot: u8,
PendingActivateSlot: u8,
Reserved: u32,
Slot: [1]STORAGE_FIRMWARE_SLOT_INFO,
};type
STORAGE_FIRMWARE_SLOT_INFO {.bycopy.} = object
SlotNumber: uint8
ReadOnly: uint8
Reserved: array[6, uint8]
Revision: _Revision_e__Union
STORAGE_FIRMWARE_INFO {.bycopy.} = object
Version: uint32
Size: uint32
UpgradeSupport: uint8
SlotCount: uint8
ActiveSlot: uint8
PendingActivateSlot: uint8
Reserved: uint32
Slot: array[1, STORAGE_FIRMWARE_SLOT_INFO]struct STORAGE_FIRMWARE_SLOT_INFO
{
ubyte SlotNumber;
ubyte ReadOnly;
ubyte[6] Reserved;
_Revision_e__Union Revision;
}
struct STORAGE_FIRMWARE_INFO
{
uint Version;
uint Size;
ubyte UpgradeSupport;
ubyte SlotCount;
ubyte ActiveSlot;
ubyte PendingActivateSlot;
uint Reserved;
STORAGE_FIRMWARE_SLOT_INFO[1] Slot;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_FIRMWARE_INFO サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; UpgradeSupport : BOOLEAN (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; SlotCount : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; ActiveSlot : BYTE (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; PendingActivateSlot : BYTE (+11, 1byte) poke st,11,値 / 値 = peek(st,11)
; Reserved : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Slot : STORAGE_FIRMWARE_SLOT_INFO (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STORAGE_FIRMWARE_SLOT_INFO
#field byte SlotNumber
#field bool1 ReadOnly
#field byte Reserved 6
#field byte Revision 8
#endstruct
#defstruct global STORAGE_FIRMWARE_INFO
#field int Version
#field int Size
#field bool1 UpgradeSupport
#field byte SlotCount
#field byte ActiveSlot
#field byte PendingActivateSlot
#field int Reserved
#field STORAGE_FIRMWARE_SLOT_INFO Slot 1
#endstruct
stdim st, STORAGE_FIRMWARE_INFO ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version