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

STORAGE_ADAPTER_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
MaximumTransferLengthDWORD4+8+81回の転送で扱える最大バイト数。
MaximumPhysicalPagesDWORD4+12+121回の転送で扱える最大物理ページ数。
AlignmentMaskDWORD4+16+16転送バッファに要求されるアライメントマスク。0でアライメント要件なし。
AdapterUsesPioBOOLEAN1+20+20アダプタがPIOモードを使用するかを示す真偽値。
AdapterScansDownBOOLEAN1+21+21アダプタがメモリを下方向にスキャンするかを示す真偽値。
CommandQueueingBOOLEAN1+22+22アダプタがコマンドキューイングをサポートするかを示す真偽値。
AcceleratedTransferBOOLEAN1+23+23高速転送をサポートするかを示す真偽値。
BusTypeBYTE1+24+24アダプタのバス種別を示す値(STORAGE_BUS_TYPE)。
BusMajorVersionWORD2+26+26バス規格のメジャーバージョン番号。
BusMinorVersionWORD2+28+28バス規格のマイナーバージョン番号。
SrbTypeBYTE1+30+30サポートするSRB(SCSI Request Block)の型。SRB_TYPE_SCSI_REQUEST等。
AddressTypeBYTE1+31+31アドレス指定の型を示す値。STORAGE_ADDRESS_TYPE_BTL8等。

各言語での定義

#include <windows.h>

// STORAGE_ADAPTER_DESCRIPTOR  (x64 32 / x86 32 バイト)
typedef struct STORAGE_ADAPTER_DESCRIPTOR {
    DWORD Version;
    DWORD Size;
    DWORD MaximumTransferLength;
    DWORD MaximumPhysicalPages;
    DWORD AlignmentMask;
    BOOLEAN AdapterUsesPio;
    BOOLEAN AdapterScansDown;
    BOOLEAN CommandQueueing;
    BOOLEAN AcceleratedTransfer;
    BYTE BusType;
    WORD BusMajorVersion;
    WORD BusMinorVersion;
    BYTE SrbType;
    BYTE AddressType;
} STORAGE_ADAPTER_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_ADAPTER_DESCRIPTOR
{
    public uint Version;
    public uint Size;
    public uint MaximumTransferLength;
    public uint MaximumPhysicalPages;
    public uint AlignmentMask;
    [MarshalAs(UnmanagedType.U1)] public bool AdapterUsesPio;
    [MarshalAs(UnmanagedType.U1)] public bool AdapterScansDown;
    [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing;
    [MarshalAs(UnmanagedType.U1)] public bool AcceleratedTransfer;
    public byte BusType;
    public ushort BusMajorVersion;
    public ushort BusMinorVersion;
    public byte SrbType;
    public byte AddressType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_ADAPTER_DESCRIPTOR
    Public Version As UInteger
    Public Size As UInteger
    Public MaximumTransferLength As UInteger
    Public MaximumPhysicalPages As UInteger
    Public AlignmentMask As UInteger
    <MarshalAs(UnmanagedType.U1)> Public AdapterUsesPio As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AdapterScansDown As Boolean
    <MarshalAs(UnmanagedType.U1)> Public CommandQueueing As Boolean
    <MarshalAs(UnmanagedType.U1)> Public AcceleratedTransfer As Boolean
    Public BusType As Byte
    Public BusMajorVersion As UShort
    Public BusMinorVersion As UShort
    Public SrbType As Byte
    Public AddressType As Byte
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_ADAPTER_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("MaximumTransferLength", wintypes.DWORD),
        ("MaximumPhysicalPages", wintypes.DWORD),
        ("AlignmentMask", wintypes.DWORD),
        ("AdapterUsesPio", ctypes.c_byte),
        ("AdapterScansDown", ctypes.c_byte),
        ("CommandQueueing", ctypes.c_byte),
        ("AcceleratedTransfer", ctypes.c_byte),
        ("BusType", ctypes.c_ubyte),
        ("BusMajorVersion", ctypes.c_ushort),
        ("BusMinorVersion", ctypes.c_ushort),
        ("SrbType", ctypes.c_ubyte),
        ("AddressType", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct STORAGE_ADAPTER_DESCRIPTOR {
    pub Version: u32,
    pub Size: u32,
    pub MaximumTransferLength: u32,
    pub MaximumPhysicalPages: u32,
    pub AlignmentMask: u32,
    pub AdapterUsesPio: u8,
    pub AdapterScansDown: u8,
    pub CommandQueueing: u8,
    pub AcceleratedTransfer: u8,
    pub BusType: u8,
    pub BusMajorVersion: u16,
    pub BusMinorVersion: u16,
    pub SrbType: u8,
    pub AddressType: u8,
}
import "golang.org/x/sys/windows"

type STORAGE_ADAPTER_DESCRIPTOR struct {
	Version uint32
	Size uint32
	MaximumTransferLength uint32
	MaximumPhysicalPages uint32
	AlignmentMask uint32
	AdapterUsesPio byte
	AdapterScansDown byte
	CommandQueueing byte
	AcceleratedTransfer byte
	BusType byte
	BusMajorVersion uint16
	BusMinorVersion uint16
	SrbType byte
	AddressType byte
}
type
  STORAGE_ADAPTER_DESCRIPTOR = record
    Version: DWORD;
    Size: DWORD;
    MaximumTransferLength: DWORD;
    MaximumPhysicalPages: DWORD;
    AlignmentMask: DWORD;
    AdapterUsesPio: ByteBool;
    AdapterScansDown: ByteBool;
    CommandQueueing: ByteBool;
    AcceleratedTransfer: ByteBool;
    BusType: Byte;
    BusMajorVersion: Word;
    BusMinorVersion: Word;
    SrbType: Byte;
    AddressType: Byte;
  end;
const STORAGE_ADAPTER_DESCRIPTOR = extern struct {
    Version: u32,
    Size: u32,
    MaximumTransferLength: u32,
    MaximumPhysicalPages: u32,
    AlignmentMask: u32,
    AdapterUsesPio: u8,
    AdapterScansDown: u8,
    CommandQueueing: u8,
    AcceleratedTransfer: u8,
    BusType: u8,
    BusMajorVersion: u16,
    BusMinorVersion: u16,
    SrbType: u8,
    AddressType: u8,
};
type
  STORAGE_ADAPTER_DESCRIPTOR {.bycopy.} = object
    Version: uint32
    Size: uint32
    MaximumTransferLength: uint32
    MaximumPhysicalPages: uint32
    AlignmentMask: uint32
    AdapterUsesPio: uint8
    AdapterScansDown: uint8
    CommandQueueing: uint8
    AcceleratedTransfer: uint8
    BusType: uint8
    BusMajorVersion: uint16
    BusMinorVersion: uint16
    SrbType: uint8
    AddressType: uint8
struct STORAGE_ADAPTER_DESCRIPTOR
{
    uint Version;
    uint Size;
    uint MaximumTransferLength;
    uint MaximumPhysicalPages;
    uint AlignmentMask;
    ubyte AdapterUsesPio;
    ubyte AdapterScansDown;
    ubyte CommandQueueing;
    ubyte AcceleratedTransfer;
    ubyte BusType;
    ushort BusMajorVersion;
    ushort BusMinorVersion;
    ubyte SrbType;
    ubyte AddressType;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_ADAPTER_DESCRIPTOR サイズ: 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 も可)
; MaximumTransferLength : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; MaximumPhysicalPages : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; AlignmentMask : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; AdapterUsesPio : BOOLEAN (+20, 1byte)  poke st,20,値  /  値 = peek(st,20)
; AdapterScansDown : BOOLEAN (+21, 1byte)  poke st,21,値  /  値 = peek(st,21)
; CommandQueueing : BOOLEAN (+22, 1byte)  poke st,22,値  /  値 = peek(st,22)
; AcceleratedTransfer : BOOLEAN (+23, 1byte)  poke st,23,値  /  値 = peek(st,23)
; BusType : BYTE (+24, 1byte)  poke st,24,値  /  値 = peek(st,24)
; BusMajorVersion : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; BusMinorVersion : WORD (+28, 2byte)  wpoke st,28,値  /  値 = wpeek(st,28)
; SrbType : BYTE (+30, 1byte)  poke st,30,値  /  値 = peek(st,30)
; AddressType : BYTE (+31, 1byte)  poke st,31,値  /  値 = peek(st,31)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_ADAPTER_DESCRIPTOR
    #field int Version
    #field int Size
    #field int MaximumTransferLength
    #field int MaximumPhysicalPages
    #field int AlignmentMask
    #field bool1 AdapterUsesPio
    #field bool1 AdapterScansDown
    #field bool1 CommandQueueing
    #field bool1 AcceleratedTransfer
    #field byte BusType
    #field short BusMajorVersion
    #field short BusMinorVersion
    #field byte SrbType
    #field byte AddressType
#endstruct

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