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

DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD

構造体
サイズx64: 64 バイト / x86: 60 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
CdbBYTE16+0+0発行されたコマンド記述子ブロック(CDB)を格納するバイト配列。
CommandBYTE16+16+16コマンドの補足情報を格納するバイト配列。
StartTimeULONGLONG8+32+32コマンド開始時刻を示すタイムスタンプ。
EndTimeULONGLONG8+40+40コマンド終了時刻を示すタイムスタンプ。
OperationStatusDWORD4+48+48操作のステータスコード。
OperationErrorDWORD4+52+52操作のエラーコード。
StackSpecific_StackSpecific_e__Union8/4+56+56ストレージスタック固有の追加情報を保持する共用体。

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

フィールドサイズx64x86
ExternalStack_ExternalStack_e__Struct8/4+0+0
AtaPort_AtaPort_e__Struct8/4+0+0
StorPort_StorPort_e__Struct8/4+0+0

各言語での定義

#include <windows.h>

// DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD  (x64 64 / x86 60 バイト)
#pragma pack(push, 1)
typedef struct DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD {
    BYTE Cdb[16];
    BYTE Command[16];
    ULONGLONG StartTime;
    ULONGLONG EndTime;
    DWORD OperationStatus;
    DWORD OperationError;
    _StackSpecific_e__Union StackSpecific;
} DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Cdb;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Command;
    public ulong StartTime;
    public ulong EndTime;
    public uint OperationStatus;
    public uint OperationError;
    public _StackSpecific_e__Union StackSpecific;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Cdb() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Command() As Byte
    Public StartTime As ULong
    Public EndTime As ULong
    Public OperationStatus As UInteger
    Public OperationError As UInteger
    Public StackSpecific As _StackSpecific_e__Union
End Structure
import ctypes
from ctypes import wintypes

class DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Cdb", ctypes.c_ubyte * 16),
        ("Command", ctypes.c_ubyte * 16),
        ("StartTime", ctypes.c_ulonglong),
        ("EndTime", ctypes.c_ulonglong),
        ("OperationStatus", wintypes.DWORD),
        ("OperationError", wintypes.DWORD),
        ("StackSpecific", _StackSpecific_e__Union),
    ]
#[repr(C, packed(1))]
pub struct DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD {
    pub Cdb: [u8; 16],
    pub Command: [u8; 16],
    pub StartTime: u64,
    pub EndTime: u64,
    pub OperationStatus: u32,
    pub OperationError: u32,
    pub StackSpecific: _StackSpecific_e__Union,
}
import "golang.org/x/sys/windows"

type DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD struct {
	Cdb [16]byte
	Command [16]byte
	StartTime uint64
	EndTime uint64
	OperationStatus uint32
	OperationError uint32
	StackSpecific _StackSpecific_e__Union
}
type
  DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD = packed record
    Cdb: array[0..15] of Byte;
    Command: array[0..15] of Byte;
    StartTime: UInt64;
    EndTime: UInt64;
    OperationStatus: DWORD;
    OperationError: DWORD;
    StackSpecific: _StackSpecific_e__Union;
  end;
const DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD = extern struct {
    Cdb: [16]u8,
    Command: [16]u8,
    StartTime: u64,
    EndTime: u64,
    OperationStatus: u32,
    OperationError: u32,
    StackSpecific: _StackSpecific_e__Union,
};
type
  DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD {.packed.} = object
    Cdb: array[16, uint8]
    Command: array[16, uint8]
    StartTime: uint64
    EndTime: uint64
    OperationStatus: uint32
    OperationError: uint32
    StackSpecific: _StackSpecific_e__Union
align(1)
struct DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD
{
    ubyte[16] Cdb;
    ubyte[16] Command;
    ulong StartTime;
    ulong EndTime;
    uint OperationStatus;
    uint OperationError;
    _StackSpecific_e__Union StackSpecific;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; Cdb : BYTE (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; Command : BYTE (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; StartTime : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; EndTime : ULONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; OperationStatus : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; OperationError : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; StackSpecific : _StackSpecific_e__Union (+56, 4byte)  varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Cdb : BYTE (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; Command : BYTE (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; StartTime : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; EndTime : ULONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; OperationStatus : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; OperationError : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; StackSpecific : _StackSpecific_e__Union (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD, pack=1
    #field byte Cdb 16
    #field byte Command 16
    #field int64 StartTime
    #field int64 EndTime
    #field int OperationStatus
    #field int OperationError
    #field byte StackSpecific 8
#endstruct

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