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

STORAGE_OFFLOAD_READ_OUTPUT

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

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

フィールド

フィールドサイズx64x86説明
OffloadReadFlagsDWORD4+0+0オフロード読み取り結果のフラグ。範囲切り詰め発生等を示す。
ReservedDWORD4+4+4将来の拡張のために予約された32ビット領域。
LengthProtectedULONGLONG8+8+8トークンで保護(表現)されたデータ長をバイト単位で示す。
TokenLengthDWORD4+16+16生成されたトークンのバイト長。
TokenSTORAGE_OFFLOAD_TOKEN512+24+20生成されたコピーオフロードトークンを保持するSTORAGE_OFFLOAD_TOKEN構造体。

各言語での定義

#include <windows.h>

// STORAGE_OFFLOAD_TOKEN  (x64 512 / x86 512 バイト)
typedef struct STORAGE_OFFLOAD_TOKEN {
    BYTE TokenType[4];
    BYTE Reserved[2];
    BYTE TokenIdLength[2];
    _Anonymous_e__Union Anonymous;
} STORAGE_OFFLOAD_TOKEN;

// STORAGE_OFFLOAD_READ_OUTPUT  (x64 536 / x86 536 バイト)
typedef struct STORAGE_OFFLOAD_READ_OUTPUT {
    DWORD OffloadReadFlags;
    DWORD Reserved;
    ULONGLONG LengthProtected;
    DWORD TokenLength;
    STORAGE_OFFLOAD_TOKEN Token;
} STORAGE_OFFLOAD_READ_OUTPUT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_OFFLOAD_TOKEN
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] TokenType;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] TokenIdLength;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_OFFLOAD_READ_OUTPUT
{
    public uint OffloadReadFlags;
    public uint Reserved;
    public ulong LengthProtected;
    public uint TokenLength;
    public STORAGE_OFFLOAD_TOKEN Token;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_OFFLOAD_TOKEN
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public TokenType() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public TokenIdLength() As Byte
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_OFFLOAD_READ_OUTPUT
    Public OffloadReadFlags As UInteger
    Public Reserved As UInteger
    Public LengthProtected As ULong
    Public TokenLength As UInteger
    Public Token As STORAGE_OFFLOAD_TOKEN
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_OFFLOAD_TOKEN(ctypes.Structure):
    _fields_ = [
        ("TokenType", ctypes.c_ubyte * 4),
        ("Reserved", ctypes.c_ubyte * 2),
        ("TokenIdLength", ctypes.c_ubyte * 2),
        ("Anonymous", _Anonymous_e__Union),
    ]

class STORAGE_OFFLOAD_READ_OUTPUT(ctypes.Structure):
    _fields_ = [
        ("OffloadReadFlags", wintypes.DWORD),
        ("Reserved", wintypes.DWORD),
        ("LengthProtected", ctypes.c_ulonglong),
        ("TokenLength", wintypes.DWORD),
        ("Token", STORAGE_OFFLOAD_TOKEN),
    ]
#[repr(C)]
pub struct STORAGE_OFFLOAD_TOKEN {
    pub TokenType: [u8; 4],
    pub Reserved: [u8; 2],
    pub TokenIdLength: [u8; 2],
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct STORAGE_OFFLOAD_READ_OUTPUT {
    pub OffloadReadFlags: u32,
    pub Reserved: u32,
    pub LengthProtected: u64,
    pub TokenLength: u32,
    pub Token: STORAGE_OFFLOAD_TOKEN,
}
import "golang.org/x/sys/windows"

type STORAGE_OFFLOAD_TOKEN struct {
	TokenType [4]byte
	Reserved [2]byte
	TokenIdLength [2]byte
	Anonymous _Anonymous_e__Union
}

type STORAGE_OFFLOAD_READ_OUTPUT struct {
	OffloadReadFlags uint32
	Reserved uint32
	LengthProtected uint64
	TokenLength uint32
	Token STORAGE_OFFLOAD_TOKEN
}
type
  STORAGE_OFFLOAD_TOKEN = record
    TokenType: array[0..3] of Byte;
    Reserved: array[0..1] of Byte;
    TokenIdLength: array[0..1] of Byte;
    Anonymous: _Anonymous_e__Union;
  end;

  STORAGE_OFFLOAD_READ_OUTPUT = record
    OffloadReadFlags: DWORD;
    Reserved: DWORD;
    LengthProtected: UInt64;
    TokenLength: DWORD;
    Token: STORAGE_OFFLOAD_TOKEN;
  end;
const STORAGE_OFFLOAD_TOKEN = extern struct {
    TokenType: [4]u8,
    Reserved: [2]u8,
    TokenIdLength: [2]u8,
    Anonymous: _Anonymous_e__Union,
};

const STORAGE_OFFLOAD_READ_OUTPUT = extern struct {
    OffloadReadFlags: u32,
    Reserved: u32,
    LengthProtected: u64,
    TokenLength: u32,
    Token: STORAGE_OFFLOAD_TOKEN,
};
type
  STORAGE_OFFLOAD_TOKEN {.bycopy.} = object
    TokenType: array[4, uint8]
    Reserved: array[2, uint8]
    TokenIdLength: array[2, uint8]
    Anonymous: _Anonymous_e__Union

  STORAGE_OFFLOAD_READ_OUTPUT {.bycopy.} = object
    OffloadReadFlags: uint32
    Reserved: uint32
    LengthProtected: uint64
    TokenLength: uint32
    Token: STORAGE_OFFLOAD_TOKEN
struct STORAGE_OFFLOAD_TOKEN
{
    ubyte[4] TokenType;
    ubyte[2] Reserved;
    ubyte[2] TokenIdLength;
    _Anonymous_e__Union Anonymous;
}

struct STORAGE_OFFLOAD_READ_OUTPUT
{
    uint OffloadReadFlags;
    uint Reserved;
    ulong LengthProtected;
    uint TokenLength;
    STORAGE_OFFLOAD_TOKEN Token;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STORAGE_OFFLOAD_READ_OUTPUT サイズ: 536 バイト(x86)
dim st, 134    ; 4byte整数×134(構造体サイズ 536 / 4 切り上げ)
; OffloadReadFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Reserved : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; LengthProtected : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; TokenLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Token : STORAGE_OFFLOAD_TOKEN (+20, 512byte)  varptr(st)+20 を基点に操作(512byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_OFFLOAD_READ_OUTPUT サイズ: 536 バイト(x64)
dim st, 134    ; 4byte整数×134(構造体サイズ 536 / 4 切り上げ)
; OffloadReadFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Reserved : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; LengthProtected : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; TokenLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Token : STORAGE_OFFLOAD_TOKEN (+24, 512byte)  varptr(st)+24 を基点に操作(512byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STORAGE_OFFLOAD_TOKEN
    #field byte TokenType 4
    #field byte Reserved 2
    #field byte TokenIdLength 2
    #field byte Anonymous 504
#endstruct

#defstruct global STORAGE_OFFLOAD_READ_OUTPUT
    #field int OffloadReadFlags
    #field int Reserved
    #field int64 LengthProtected
    #field int TokenLength
    #field STORAGE_OFFLOAD_TOKEN Token
#endstruct

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