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

STORAGE_FEATURE_SUPPORT

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

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

フィールド

フィールドサイズx64x86説明
SizeDWORD4+0+0この構造体のサイズをバイト単位で示す。
VersionDWORD4+4+4構造体のバージョン番号。互換性判定に使う。
Flags_Flags_e__Union8+8+8サポートされる機能を示すフラグの共用体。ビットフィールドで各機能の対応状況を表す。
ReservedULONGLONG48+16+16将来の拡張のために予約された64ビット領域。現状は0。

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

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

各言語での定義

#include <windows.h>

// STORAGE_FEATURE_SUPPORT  (x64 64 / x86 64 バイト)
typedef struct STORAGE_FEATURE_SUPPORT {
    DWORD Size;
    DWORD Version;
    _Flags_e__Union Flags;
    ULONGLONG Reserved[6];
} STORAGE_FEATURE_SUPPORT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_FEATURE_SUPPORT
{
    public uint Size;
    public uint Version;
    public _Flags_e__Union Flags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public ulong[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_FEATURE_SUPPORT
    Public Size As UInteger
    Public Version As UInteger
    Public Flags As _Flags_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved() As ULong
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_FEATURE_SUPPORT(ctypes.Structure):
    _fields_ = [
        ("Size", wintypes.DWORD),
        ("Version", wintypes.DWORD),
        ("Flags", _Flags_e__Union),
        ("Reserved", ctypes.c_ulonglong * 6),
    ]
#[repr(C)]
pub struct STORAGE_FEATURE_SUPPORT {
    pub Size: u32,
    pub Version: u32,
    pub Flags: _Flags_e__Union,
    pub Reserved: [u64; 6],
}
import "golang.org/x/sys/windows"

type STORAGE_FEATURE_SUPPORT struct {
	Size uint32
	Version uint32
	Flags _Flags_e__Union
	Reserved [6]uint64
}
type
  STORAGE_FEATURE_SUPPORT = record
    Size: DWORD;
    Version: DWORD;
    Flags: _Flags_e__Union;
    Reserved: array[0..5] of UInt64;
  end;
const STORAGE_FEATURE_SUPPORT = extern struct {
    Size: u32,
    Version: u32,
    Flags: _Flags_e__Union,
    Reserved: [6]u64,
};
type
  STORAGE_FEATURE_SUPPORT {.bycopy.} = object
    Size: uint32
    Version: uint32
    Flags: _Flags_e__Union
    Reserved: array[6, uint64]
struct STORAGE_FEATURE_SUPPORT
{
    uint Size;
    uint Version;
    _Flags_e__Union Flags;
    ulong[6] Reserved;
}

HSP用 定義

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

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

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