ホーム › System.Ioctl › STORAGE_PROTOCOL_DATA_DESCRIPTOR
STORAGE_PROTOCOL_DATA_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のサイズをバイト単位で示す。 |
| ProtocolSpecificData | STORAGE_PROTOCOL_SPECIFIC_DATA | 40 | +8 | +8 | プロトコル固有データを保持するSTORAGE_PROTOCOL_SPECIFIC_DATA構造体。 |
各言語での定義
#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;
// STORAGE_PROTOCOL_DATA_DESCRIPTOR (x64 48 / x86 48 バイト)
typedef struct STORAGE_PROTOCOL_DATA_DESCRIPTOR {
DWORD Version;
DWORD Size;
STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData;
} STORAGE_PROTOCOL_DATA_DESCRIPTOR;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_PROTOCOL_DATA_DESCRIPTOR
{
public uint Version;
public uint Size;
public STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData;
}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
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_PROTOCOL_DATA_DESCRIPTOR
Public Version As UInteger
Public Size As UInteger
Public ProtocolSpecificData As STORAGE_PROTOCOL_SPECIFIC_DATA
End Structureimport 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),
]
class STORAGE_PROTOCOL_DATA_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("ProtocolSpecificData", STORAGE_PROTOCOL_SPECIFIC_DATA),
]#[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,
}
#[repr(C)]
pub struct STORAGE_PROTOCOL_DATA_DESCRIPTOR {
pub Version: u32,
pub Size: u32,
pub ProtocolSpecificData: STORAGE_PROTOCOL_SPECIFIC_DATA,
}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_DATA_DESCRIPTOR struct {
Version uint32
Size uint32
ProtocolSpecificData STORAGE_PROTOCOL_SPECIFIC_DATA
}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;
STORAGE_PROTOCOL_DATA_DESCRIPTOR = record
Version: DWORD;
Size: DWORD;
ProtocolSpecificData: STORAGE_PROTOCOL_SPECIFIC_DATA;
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,
};
const STORAGE_PROTOCOL_DATA_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
ProtocolSpecificData: STORAGE_PROTOCOL_SPECIFIC_DATA,
};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
STORAGE_PROTOCOL_DATA_DESCRIPTOR {.bycopy.} = object
Version: uint32
Size: uint32
ProtocolSpecificData: STORAGE_PROTOCOL_SPECIFIC_DATAstruct STORAGE_PROTOCOL_SPECIFIC_DATA
{
int ProtocolType;
uint DataType;
uint ProtocolDataRequestValue;
uint ProtocolDataRequestSubValue;
uint ProtocolDataOffset;
uint ProtocolDataLength;
uint FixedProtocolReturnData;
uint ProtocolDataRequestSubValue2;
uint ProtocolDataRequestSubValue3;
uint ProtocolDataRequestSubValue4;
}
struct STORAGE_PROTOCOL_DATA_DESCRIPTOR
{
uint Version;
uint Size;
STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData;
}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_DATA_DESCRIPTOR サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ProtocolSpecificData : STORAGE_PROTOCOL_SPECIFIC_DATA (+8, 40byte) varptr(st)+8 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global STORAGE_PROTOCOL_DATA_DESCRIPTOR
#field int Version
#field int Size
#field STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData
#endstruct
stdim st, STORAGE_PROTOCOL_DATA_DESCRIPTOR ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version