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

SCM_PD_FIRMWARE_DOWNLOAD

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のバージョン番号。
SizeDWORD4+4+4この構造体のバイト単位のサイズ。
FlagsDWORD4+8+8ダウンロード動作を制御するフラグのビットマスク。
SlotBYTE1+12+12ファームウェアを書き込む対象スロット番号。
ReservedBYTE3+13+13予約領域。ゼロを設定する。
OffsetULONGLONG8+16+16イメージ内の書き込み開始オフセット。バイト単位。
FirmwareImageSizeInBytesDWORD4+24+24FirmwareImageのバイト単位のサイズ。
FirmwareImageBYTE1+28+28ダウンロードするファームウェアイメージデータ。可変長配列。

各言語での定義

#include <windows.h>

// SCM_PD_FIRMWARE_DOWNLOAD  (x64 32 / x86 32 バイト)
typedef struct SCM_PD_FIRMWARE_DOWNLOAD {
    DWORD Version;
    DWORD Size;
    DWORD Flags;
    BYTE Slot;
    BYTE Reserved[3];
    ULONGLONG Offset;
    DWORD FirmwareImageSizeInBytes;
    BYTE FirmwareImage[1];
} SCM_PD_FIRMWARE_DOWNLOAD;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_PD_FIRMWARE_DOWNLOAD
{
    public uint Version;
    public uint Size;
    public uint Flags;
    public byte Slot;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved;
    public ulong Offset;
    public uint FirmwareImageSizeInBytes;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] FirmwareImage;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_PD_FIRMWARE_DOWNLOAD
    Public Version As UInteger
    Public Size As UInteger
    Public Flags As UInteger
    Public Slot As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved() As Byte
    Public Offset As ULong
    Public FirmwareImageSizeInBytes As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public FirmwareImage() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SCM_PD_FIRMWARE_DOWNLOAD(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("Slot", ctypes.c_ubyte),
        ("Reserved", ctypes.c_ubyte * 3),
        ("Offset", ctypes.c_ulonglong),
        ("FirmwareImageSizeInBytes", wintypes.DWORD),
        ("FirmwareImage", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct SCM_PD_FIRMWARE_DOWNLOAD {
    pub Version: u32,
    pub Size: u32,
    pub Flags: u32,
    pub Slot: u8,
    pub Reserved: [u8; 3],
    pub Offset: u64,
    pub FirmwareImageSizeInBytes: u32,
    pub FirmwareImage: [u8; 1],
}
import "golang.org/x/sys/windows"

type SCM_PD_FIRMWARE_DOWNLOAD struct {
	Version uint32
	Size uint32
	Flags uint32
	Slot byte
	Reserved [3]byte
	Offset uint64
	FirmwareImageSizeInBytes uint32
	FirmwareImage [1]byte
}
type
  SCM_PD_FIRMWARE_DOWNLOAD = record
    Version: DWORD;
    Size: DWORD;
    Flags: DWORD;
    Slot: Byte;
    Reserved: array[0..2] of Byte;
    Offset: UInt64;
    FirmwareImageSizeInBytes: DWORD;
    FirmwareImage: array[0..0] of Byte;
  end;
const SCM_PD_FIRMWARE_DOWNLOAD = extern struct {
    Version: u32,
    Size: u32,
    Flags: u32,
    Slot: u8,
    Reserved: [3]u8,
    Offset: u64,
    FirmwareImageSizeInBytes: u32,
    FirmwareImage: [1]u8,
};
type
  SCM_PD_FIRMWARE_DOWNLOAD {.bycopy.} = object
    Version: uint32
    Size: uint32
    Flags: uint32
    Slot: uint8
    Reserved: array[3, uint8]
    Offset: uint64
    FirmwareImageSizeInBytes: uint32
    FirmwareImage: array[1, uint8]
struct SCM_PD_FIRMWARE_DOWNLOAD
{
    uint Version;
    uint Size;
    uint Flags;
    ubyte Slot;
    ubyte[3] Reserved;
    ulong Offset;
    uint FirmwareImageSizeInBytes;
    ubyte[1] FirmwareImage;
}

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_DOWNLOAD サイズ: 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 も可)
; Flags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Slot : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; Reserved : BYTE (+13, 3byte)  varptr(st)+13 を基点に操作(3byte:入れ子/配列)
; Offset : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; FirmwareImageSizeInBytes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; FirmwareImage : BYTE (+28, 1byte)  varptr(st)+28 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCM_PD_FIRMWARE_DOWNLOAD
    #field int Version
    #field int Size
    #field int Flags
    #field byte Slot
    #field byte Reserved 3
    #field int64 Offset
    #field int FirmwareImageSizeInBytes
    #field byte FirmwareImage 1
#endstruct

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