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

STORAGE_PROTOCOL_SPECIFIC_DATA

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

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

フィールド

フィールドサイズx64x86説明
ProtocolTypeSTORAGE_PROTOCOL_TYPE4+0+0対象プロトコルの種類を示すSTORAGE_PROTOCOL_TYPE列挙値。NVMe/ATA/SCSI等。
DataTypeDWORD4+4+4要求するプロトコル固有データの種類を示す値。
ProtocolDataRequestValueDWORD4+8+8プロトコルデータ要求の主値。ログページ番号等を指定する。
ProtocolDataRequestSubValueDWORD4+12+12プロトコルデータ要求のサブ値。追加パラメータを指定する。
ProtocolDataOffsetDWORD4+16+16返却データへの本構造体先頭からのバイトオフセット。
ProtocolDataLengthDWORD4+20+20返却されるプロトコルデータの長さをバイト単位で示す。
FixedProtocolReturnDataDWORD4+24+24固定長で返されるプロトコルデータ値。
ProtocolDataRequestSubValue2DWORD4+28+28プロトコルデータ要求の追加サブ値2。
ProtocolDataRequestSubValue3DWORD4+32+32プロトコルデータ要求の追加サブ値3。
ProtocolDataRequestSubValue4DWORD4+36+36プロトコルデータ要求の追加サブ値4。

各言語での定義

#include <windows.h>

// STORAGE_PROTOCOL_SPECIFIC_DATA  (x64 40 / x86 40 バイト)
typedef struct STORAGE_PROTOCOL_SPECIFIC_DATA {
    STORAGE_PROTOCOL_TYPE ProtocolType;
    DWORD DataType;
    DWORD ProtocolDataRequestValue;
    DWORD ProtocolDataRequestSubValue;
    DWORD ProtocolDataOffset;
    DWORD ProtocolDataLength;
    DWORD FixedProtocolReturnData;
    DWORD ProtocolDataRequestSubValue2;
    DWORD ProtocolDataRequestSubValue3;
    DWORD ProtocolDataRequestSubValue4;
} STORAGE_PROTOCOL_SPECIFIC_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_PROTOCOL_SPECIFIC_DATA
{
    public int ProtocolType;
    public uint DataType;
    public uint ProtocolDataRequestValue;
    public uint ProtocolDataRequestSubValue;
    public uint ProtocolDataOffset;
    public uint ProtocolDataLength;
    public uint FixedProtocolReturnData;
    public uint ProtocolDataRequestSubValue2;
    public uint ProtocolDataRequestSubValue3;
    public uint ProtocolDataRequestSubValue4;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_PROTOCOL_SPECIFIC_DATA
    Public ProtocolType As Integer
    Public DataType As UInteger
    Public ProtocolDataRequestValue As UInteger
    Public ProtocolDataRequestSubValue As UInteger
    Public ProtocolDataOffset As UInteger
    Public ProtocolDataLength As UInteger
    Public FixedProtocolReturnData As UInteger
    Public ProtocolDataRequestSubValue2 As UInteger
    Public ProtocolDataRequestSubValue3 As UInteger
    Public ProtocolDataRequestSubValue4 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_PROTOCOL_SPECIFIC_DATA(ctypes.Structure):
    _fields_ = [
        ("ProtocolType", ctypes.c_int),
        ("DataType", wintypes.DWORD),
        ("ProtocolDataRequestValue", wintypes.DWORD),
        ("ProtocolDataRequestSubValue", wintypes.DWORD),
        ("ProtocolDataOffset", wintypes.DWORD),
        ("ProtocolDataLength", wintypes.DWORD),
        ("FixedProtocolReturnData", wintypes.DWORD),
        ("ProtocolDataRequestSubValue2", wintypes.DWORD),
        ("ProtocolDataRequestSubValue3", wintypes.DWORD),
        ("ProtocolDataRequestSubValue4", wintypes.DWORD),
    ]
#[repr(C)]
pub struct STORAGE_PROTOCOL_SPECIFIC_DATA {
    pub ProtocolType: i32,
    pub DataType: u32,
    pub ProtocolDataRequestValue: u32,
    pub ProtocolDataRequestSubValue: u32,
    pub ProtocolDataOffset: u32,
    pub ProtocolDataLength: u32,
    pub FixedProtocolReturnData: u32,
    pub ProtocolDataRequestSubValue2: u32,
    pub ProtocolDataRequestSubValue3: u32,
    pub ProtocolDataRequestSubValue4: u32,
}
import "golang.org/x/sys/windows"

type STORAGE_PROTOCOL_SPECIFIC_DATA struct {
	ProtocolType int32
	DataType uint32
	ProtocolDataRequestValue uint32
	ProtocolDataRequestSubValue uint32
	ProtocolDataOffset uint32
	ProtocolDataLength uint32
	FixedProtocolReturnData uint32
	ProtocolDataRequestSubValue2 uint32
	ProtocolDataRequestSubValue3 uint32
	ProtocolDataRequestSubValue4 uint32
}
type
  STORAGE_PROTOCOL_SPECIFIC_DATA = record
    ProtocolType: Integer;
    DataType: DWORD;
    ProtocolDataRequestValue: DWORD;
    ProtocolDataRequestSubValue: DWORD;
    ProtocolDataOffset: DWORD;
    ProtocolDataLength: DWORD;
    FixedProtocolReturnData: DWORD;
    ProtocolDataRequestSubValue2: DWORD;
    ProtocolDataRequestSubValue3: DWORD;
    ProtocolDataRequestSubValue4: DWORD;
  end;
const STORAGE_PROTOCOL_SPECIFIC_DATA = extern struct {
    ProtocolType: i32,
    DataType: u32,
    ProtocolDataRequestValue: u32,
    ProtocolDataRequestSubValue: u32,
    ProtocolDataOffset: u32,
    ProtocolDataLength: u32,
    FixedProtocolReturnData: u32,
    ProtocolDataRequestSubValue2: u32,
    ProtocolDataRequestSubValue3: u32,
    ProtocolDataRequestSubValue4: u32,
};
type
  STORAGE_PROTOCOL_SPECIFIC_DATA {.bycopy.} = object
    ProtocolType: int32
    DataType: uint32
    ProtocolDataRequestValue: uint32
    ProtocolDataRequestSubValue: uint32
    ProtocolDataOffset: uint32
    ProtocolDataLength: uint32
    FixedProtocolReturnData: uint32
    ProtocolDataRequestSubValue2: uint32
    ProtocolDataRequestSubValue3: uint32
    ProtocolDataRequestSubValue4: uint32
struct STORAGE_PROTOCOL_SPECIFIC_DATA
{
    int ProtocolType;
    uint DataType;
    uint ProtocolDataRequestValue;
    uint ProtocolDataRequestSubValue;
    uint ProtocolDataOffset;
    uint ProtocolDataLength;
    uint FixedProtocolReturnData;
    uint ProtocolDataRequestSubValue2;
    uint ProtocolDataRequestSubValue3;
    uint ProtocolDataRequestSubValue4;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_PROTOCOL_SPECIFIC_DATA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ProtocolType : STORAGE_PROTOCOL_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DataType : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ProtocolDataRequestValue : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ProtocolDataRequestSubValue : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ProtocolDataOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ProtocolDataLength : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; FixedProtocolReturnData : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ProtocolDataRequestSubValue2 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ProtocolDataRequestSubValue3 : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ProtocolDataRequestSubValue4 : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_PROTOCOL_SPECIFIC_DATA
    #field int ProtocolType
    #field int DataType
    #field int ProtocolDataRequestValue
    #field int ProtocolDataRequestSubValue
    #field int ProtocolDataOffset
    #field int ProtocolDataLength
    #field int FixedProtocolReturnData
    #field int ProtocolDataRequestSubValue2
    #field int ProtocolDataRequestSubValue3
    #field int ProtocolDataRequestSubValue4
#endstruct

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