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

STORAGE_MINIPORT_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
PortdriverSTORAGE_PORT_CODE_SET4+8+8ミニポートが属するポートドライバの種類を示すSTORAGE_PORT_CODE_SET列挙値。
LUNResetSupportedBOOLEAN1+12+12LUN単位のリセットをサポートするかを示す真偽値。
TargetResetSupportedBOOLEAN1+13+13ターゲット単位のリセットをサポートするかを示す真偽値。
IoTimeoutValueWORD2+14+14I/O操作のタイムアウト値を秒単位で示す。
ExtraIoInfoSupportedBOOLEAN1+16+16追加I/O情報の取得をサポートするかを示す真偽値。
Flags_Flags_e__Union8/4+24+20ミニポートの機能を示すフラグの共用体。
Reserved0BYTE2+32+24将来の拡張のために予約されたバイト領域。
Reserved1DWORD4+36+28将来の拡張のために予約された32ビット領域。

共用体: _Flags_e__Union x64 8B / x86 4B

フィールドサイズx64x86
Anonymous_Anonymous_e__Struct8/4+0+0
AsBYTEBYTE1+0+0

各言語での定義

#include <windows.h>

// STORAGE_MINIPORT_DESCRIPTOR  (x64 40 / x86 32 バイト)
typedef struct STORAGE_MINIPORT_DESCRIPTOR {
    DWORD Version;
    DWORD Size;
    STORAGE_PORT_CODE_SET Portdriver;
    BOOLEAN LUNResetSupported;
    BOOLEAN TargetResetSupported;
    WORD IoTimeoutValue;
    BOOLEAN ExtraIoInfoSupported;
    _Flags_e__Union Flags;
    BYTE Reserved0[2];
    DWORD Reserved1;
} STORAGE_MINIPORT_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_MINIPORT_DESCRIPTOR
{
    public uint Version;
    public uint Size;
    public int Portdriver;
    [MarshalAs(UnmanagedType.U1)] public bool LUNResetSupported;
    [MarshalAs(UnmanagedType.U1)] public bool TargetResetSupported;
    public ushort IoTimeoutValue;
    [MarshalAs(UnmanagedType.U1)] public bool ExtraIoInfoSupported;
    public _Flags_e__Union Flags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved0;
    public uint Reserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_MINIPORT_DESCRIPTOR
    Public Version As UInteger
    Public Size As UInteger
    Public Portdriver As Integer
    <MarshalAs(UnmanagedType.U1)> Public LUNResetSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public TargetResetSupported As Boolean
    Public IoTimeoutValue As UShort
    <MarshalAs(UnmanagedType.U1)> Public ExtraIoInfoSupported As Boolean
    Public Flags As _Flags_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved0() As Byte
    Public Reserved1 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_MINIPORT_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("Portdriver", ctypes.c_int),
        ("LUNResetSupported", ctypes.c_byte),
        ("TargetResetSupported", ctypes.c_byte),
        ("IoTimeoutValue", ctypes.c_ushort),
        ("ExtraIoInfoSupported", ctypes.c_byte),
        ("Flags", _Flags_e__Union),
        ("Reserved0", ctypes.c_ubyte * 2),
        ("Reserved1", wintypes.DWORD),
    ]
#[repr(C)]
pub struct STORAGE_MINIPORT_DESCRIPTOR {
    pub Version: u32,
    pub Size: u32,
    pub Portdriver: i32,
    pub LUNResetSupported: u8,
    pub TargetResetSupported: u8,
    pub IoTimeoutValue: u16,
    pub ExtraIoInfoSupported: u8,
    pub Flags: _Flags_e__Union,
    pub Reserved0: [u8; 2],
    pub Reserved1: u32,
}
import "golang.org/x/sys/windows"

type STORAGE_MINIPORT_DESCRIPTOR struct {
	Version uint32
	Size uint32
	Portdriver int32
	LUNResetSupported byte
	TargetResetSupported byte
	IoTimeoutValue uint16
	ExtraIoInfoSupported byte
	Flags _Flags_e__Union
	Reserved0 [2]byte
	Reserved1 uint32
}
type
  STORAGE_MINIPORT_DESCRIPTOR = record
    Version: DWORD;
    Size: DWORD;
    Portdriver: Integer;
    LUNResetSupported: ByteBool;
    TargetResetSupported: ByteBool;
    IoTimeoutValue: Word;
    ExtraIoInfoSupported: ByteBool;
    Flags: _Flags_e__Union;
    Reserved0: array[0..1] of Byte;
    Reserved1: DWORD;
  end;
const STORAGE_MINIPORT_DESCRIPTOR = extern struct {
    Version: u32,
    Size: u32,
    Portdriver: i32,
    LUNResetSupported: u8,
    TargetResetSupported: u8,
    IoTimeoutValue: u16,
    ExtraIoInfoSupported: u8,
    Flags: _Flags_e__Union,
    Reserved0: [2]u8,
    Reserved1: u32,
};
type
  STORAGE_MINIPORT_DESCRIPTOR {.bycopy.} = object
    Version: uint32
    Size: uint32
    Portdriver: int32
    LUNResetSupported: uint8
    TargetResetSupported: uint8
    IoTimeoutValue: uint16
    ExtraIoInfoSupported: uint8
    Flags: _Flags_e__Union
    Reserved0: array[2, uint8]
    Reserved1: uint32
struct STORAGE_MINIPORT_DESCRIPTOR
{
    uint Version;
    uint Size;
    int Portdriver;
    ubyte LUNResetSupported;
    ubyte TargetResetSupported;
    ushort IoTimeoutValue;
    ubyte ExtraIoInfoSupported;
    _Flags_e__Union Flags;
    ubyte[2] Reserved0;
    uint Reserved1;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STORAGE_MINIPORT_DESCRIPTOR サイズ: 32 バイト(x86)
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 も可)
; Portdriver : STORAGE_PORT_CODE_SET (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; LUNResetSupported : BOOLEAN (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; TargetResetSupported : BOOLEAN (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; IoTimeoutValue : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; ExtraIoInfoSupported : BOOLEAN (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; Flags : _Flags_e__Union (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; Reserved0 : BYTE (+24, 2byte)  varptr(st)+24 を基点に操作(2byte:入れ子/配列)
; Reserved1 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_MINIPORT_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Portdriver : STORAGE_PORT_CODE_SET (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; LUNResetSupported : BOOLEAN (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; TargetResetSupported : BOOLEAN (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; IoTimeoutValue : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; ExtraIoInfoSupported : BOOLEAN (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; Flags : _Flags_e__Union (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; Reserved0 : BYTE (+32, 2byte)  varptr(st)+32 を基点に操作(2byte:入れ子/配列)
; Reserved1 : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_MINIPORT_DESCRIPTOR
    #field int Version
    #field int Size
    #field int Portdriver
    #field bool1 LUNResetSupported
    #field bool1 TargetResetSupported
    #field short IoTimeoutValue
    #field bool1 ExtraIoInfoSupported
    #field byte Flags 8
    #field byte Reserved0 2
    #field int Reserved1
#endstruct

stdim st, STORAGE_MINIPORT_DESCRIPTOR        ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。