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

GETVERSIONINPARAMS

構造体
サイズx64: 24 バイト / x86: 24 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
bVersionBYTE1+0+0SMARTドライバのバイナリバージョン。
bRevisionBYTE1+1+1SMARTドライバのバイナリリビジョン。
bReservedBYTE1+2+2予約領域。ゼロを設定する。
bIDEDeviceMapBYTE1+3+3IDEデバイスの存在を示すビットマップ。
fCapabilitiesDWORD4+4+4ドライバがサポートする機能を示すフラグのビットマスク。
dwReservedDWORD16+8+8予約領域。ゼロを設定する。

各言語での定義

#include <windows.h>

// GETVERSIONINPARAMS  (x64 24 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct GETVERSIONINPARAMS {
    BYTE bVersion;
    BYTE bRevision;
    BYTE bReserved;
    BYTE bIDEDeviceMap;
    DWORD fCapabilities;
    DWORD dwReserved[4];
} GETVERSIONINPARAMS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct GETVERSIONINPARAMS
{
    public byte bVersion;
    public byte bRevision;
    public byte bReserved;
    public byte bIDEDeviceMap;
    public uint fCapabilities;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] dwReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure GETVERSIONINPARAMS
    Public bVersion As Byte
    Public bRevision As Byte
    Public bReserved As Byte
    Public bIDEDeviceMap As Byte
    Public fCapabilities As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public dwReserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class GETVERSIONINPARAMS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("bVersion", ctypes.c_ubyte),
        ("bRevision", ctypes.c_ubyte),
        ("bReserved", ctypes.c_ubyte),
        ("bIDEDeviceMap", ctypes.c_ubyte),
        ("fCapabilities", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD * 4),
    ]
#[repr(C, packed(1))]
pub struct GETVERSIONINPARAMS {
    pub bVersion: u8,
    pub bRevision: u8,
    pub bReserved: u8,
    pub bIDEDeviceMap: u8,
    pub fCapabilities: u32,
    pub dwReserved: [u32; 4],
}
import "golang.org/x/sys/windows"

type GETVERSIONINPARAMS struct {
	bVersion byte
	bRevision byte
	bReserved byte
	bIDEDeviceMap byte
	fCapabilities uint32
	dwReserved [4]uint32
}
type
  GETVERSIONINPARAMS = packed record
    bVersion: Byte;
    bRevision: Byte;
    bReserved: Byte;
    bIDEDeviceMap: Byte;
    fCapabilities: DWORD;
    dwReserved: array[0..3] of DWORD;
  end;
const GETVERSIONINPARAMS = extern struct {
    bVersion: u8,
    bRevision: u8,
    bReserved: u8,
    bIDEDeviceMap: u8,
    fCapabilities: u32,
    dwReserved: [4]u32,
};
type
  GETVERSIONINPARAMS {.packed.} = object
    bVersion: uint8
    bRevision: uint8
    bReserved: uint8
    bIDEDeviceMap: uint8
    fCapabilities: uint32
    dwReserved: array[4, uint32]
align(1)
struct GETVERSIONINPARAMS
{
    ubyte bVersion;
    ubyte bRevision;
    ubyte bReserved;
    ubyte bIDEDeviceMap;
    uint fCapabilities;
    uint[4] dwReserved;
}

HSP用 定義

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

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

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