Win32 API 日本語リファレンス
ホームSystem.Ioctl › SCM_PD_FIRMWARE_SLOT_INFO

SCM_PD_FIRMWARE_SLOT_INFO

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のバージョン番号。
SizeDWORD4+4+4この構造体のバイト単位のサイズ。
SlotNumberBYTE1+8+8ファームウェアスロットの番号。
_bitfieldBYTE1+9+9ReadOnlyなどのスロット属性を格納するビットフィールド。
Reserved1BYTE6+10+10予約領域。ゼロを設定する。
RevisionBYTE32+16+16スロットに格納されたファームウェアのリビジョン情報。

各言語での定義

#include <windows.h>

// SCM_PD_FIRMWARE_SLOT_INFO  (x64 48 / x86 48 バイト)
typedef struct SCM_PD_FIRMWARE_SLOT_INFO {
    DWORD Version;
    DWORD Size;
    BYTE SlotNumber;
    BYTE _bitfield;
    BYTE Reserved1[6];
    BYTE Revision[32];
} SCM_PD_FIRMWARE_SLOT_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_PD_FIRMWARE_SLOT_INFO
{
    public uint Version;
    public uint Size;
    public byte SlotNumber;
    public byte _bitfield;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved1;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] Revision;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_PD_FIRMWARE_SLOT_INFO
    Public Version As UInteger
    Public Size As UInteger
    Public SlotNumber As Byte
    Public _bitfield As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved1() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public Revision() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SCM_PD_FIRMWARE_SLOT_INFO(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("SlotNumber", ctypes.c_ubyte),
        ("_bitfield", ctypes.c_ubyte),
        ("Reserved1", ctypes.c_ubyte * 6),
        ("Revision", ctypes.c_ubyte * 32),
    ]
#[repr(C)]
pub struct SCM_PD_FIRMWARE_SLOT_INFO {
    pub Version: u32,
    pub Size: u32,
    pub SlotNumber: u8,
    pub _bitfield: u8,
    pub Reserved1: [u8; 6],
    pub Revision: [u8; 32],
}
import "golang.org/x/sys/windows"

type SCM_PD_FIRMWARE_SLOT_INFO struct {
	Version uint32
	Size uint32
	SlotNumber byte
	_bitfield byte
	Reserved1 [6]byte
	Revision [32]byte
}
type
  SCM_PD_FIRMWARE_SLOT_INFO = record
    Version: DWORD;
    Size: DWORD;
    SlotNumber: Byte;
    _bitfield: Byte;
    Reserved1: array[0..5] of Byte;
    Revision: array[0..31] of Byte;
  end;
const SCM_PD_FIRMWARE_SLOT_INFO = extern struct {
    Version: u32,
    Size: u32,
    SlotNumber: u8,
    _bitfield: u8,
    Reserved1: [6]u8,
    Revision: [32]u8,
};
type
  SCM_PD_FIRMWARE_SLOT_INFO {.bycopy.} = object
    Version: uint32
    Size: uint32
    SlotNumber: uint8
    _bitfield: uint8
    Reserved1: array[6, uint8]
    Revision: array[32, uint8]
struct SCM_PD_FIRMWARE_SLOT_INFO
{
    uint Version;
    uint Size;
    ubyte SlotNumber;
    ubyte _bitfield;
    ubyte[6] Reserved1;
    ubyte[32] Revision;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCM_PD_FIRMWARE_SLOT_INFO サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SlotNumber : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; _bitfield : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; Reserved1 : BYTE (+10, 6byte)  varptr(st)+10 を基点に操作(6byte:入れ子/配列)
; Revision : BYTE (+16, 32byte)  varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCM_PD_FIRMWARE_SLOT_INFO
    #field int Version
    #field int Size
    #field byte SlotNumber
    #field byte _bitfield
    #field byte Reserved1 6
    #field byte Revision 32
#endstruct

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