Win32 API 日本語リファレンス
ホームStorage.IscsiDisc › STORAGE_FIRMWARE_SLOT_INFO_V2

STORAGE_FIRMWARE_SLOT_INFO_V2

構造体
サイズx64: 24 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
SlotNumberBYTE1+0+0ファームウェアスロットの番号。
ReadOnlyBOOLEAN1+1+1スロットが読み取り専用ならTRUE。
ReservedBYTE6+2+2予約フィールド。0を設定する。
RevisionBYTE16+8+8スロットのファームウェアリビジョン文字列(16バイト)。

各言語での定義

#include <windows.h>

// STORAGE_FIRMWARE_SLOT_INFO_V2  (x64 24 / x86 24 バイト)
typedef struct STORAGE_FIRMWARE_SLOT_INFO_V2 {
    BYTE SlotNumber;
    BOOLEAN ReadOnly;
    BYTE Reserved[6];
    BYTE Revision[16];
} STORAGE_FIRMWARE_SLOT_INFO_V2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_FIRMWARE_SLOT_INFO_V2
{
    public byte SlotNumber;
    [MarshalAs(UnmanagedType.U1)] public bool ReadOnly;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Revision;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_FIRMWARE_SLOT_INFO_V2
    Public SlotNumber As Byte
    <MarshalAs(UnmanagedType.U1)> Public ReadOnly As Boolean
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Revision() As Byte
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_FIRMWARE_SLOT_INFO_V2(ctypes.Structure):
    _fields_ = [
        ("SlotNumber", ctypes.c_ubyte),
        ("ReadOnly", ctypes.c_byte),
        ("Reserved", ctypes.c_ubyte * 6),
        ("Revision", ctypes.c_ubyte * 16),
    ]
#[repr(C)]
pub struct STORAGE_FIRMWARE_SLOT_INFO_V2 {
    pub SlotNumber: u8,
    pub ReadOnly: u8,
    pub Reserved: [u8; 6],
    pub Revision: [u8; 16],
}
import "golang.org/x/sys/windows"

type STORAGE_FIRMWARE_SLOT_INFO_V2 struct {
	SlotNumber byte
	ReadOnly byte
	Reserved [6]byte
	Revision [16]byte
}
type
  STORAGE_FIRMWARE_SLOT_INFO_V2 = record
    SlotNumber: Byte;
    ReadOnly: ByteBool;
    Reserved: array[0..5] of Byte;
    Revision: array[0..15] of Byte;
  end;
const STORAGE_FIRMWARE_SLOT_INFO_V2 = extern struct {
    SlotNumber: u8,
    ReadOnly: u8,
    Reserved: [6]u8,
    Revision: [16]u8,
};
type
  STORAGE_FIRMWARE_SLOT_INFO_V2 {.bycopy.} = object
    SlotNumber: uint8
    ReadOnly: uint8
    Reserved: array[6, uint8]
    Revision: array[16, uint8]
struct STORAGE_FIRMWARE_SLOT_INFO_V2
{
    ubyte SlotNumber;
    ubyte ReadOnly;
    ubyte[6] Reserved;
    ubyte[16] Revision;
}

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_SLOT_INFO_V2 サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; SlotNumber : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; ReadOnly : BOOLEAN (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; Reserved : BYTE (+2, 6byte)  varptr(st)+2 を基点に操作(6byte:入れ子/配列)
; Revision : BYTE (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_FIRMWARE_SLOT_INFO_V2
    #field byte SlotNumber
    #field bool1 ReadOnly
    #field byte Reserved 6
    #field byte Revision 16
#endstruct

stdim st, STORAGE_FIRMWARE_SLOT_INFO_V2        ; NSTRUCT 変数を確保
st->SlotNumber = 100
mes "SlotNumber=" + st->SlotNumber