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

DEVICE_COPY_OFFLOAD_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のサイズをバイト単位で格納します。このメンバーの値は、構造体にメンバーが追加されると変化します。
SizeDWORD4+4+4返されるデータの合計サイズをバイト単位で指定します。これには、この構造体に続くデータが含まれる場合があります。
MaximumTokenLifetimeDWORD4+8+8トークンの最大有効期間 (秒単位)。
DefaultTokenLifetimeDWORD4+12+12トークンの既定の有効期間 (秒単位)。
MaximumTransferSizeULONGLONG8+16+16最大転送サイズ (バイト単位)。
OptimalTransferCountULONGLONG8+24+24最適な転送サイズ (バイト単位)。
MaximumDataDescriptorsDWORD4+32+32データ記述子の最大数。
MaximumTransferLengthPerDescriptorDWORD4+36+36記述子あたりの最大転送長 (ブロック単位)。
OptimalTransferLengthPerDescriptorDWORD4+40+40記述子あたりの最適な転送長。
OptimalTransferLengthGranularityWORD2+44+44最適な転送長の粒度 (ブロック単位)。この長さの整数倍でない転送長は、遅延する場合があります。
ReservedBYTE2+46+46予約済みです。

公式ドキュメント

DEVICE_COPY_OFFLOAD_DESCRIPTOR 構造体は、IOCTL_STORAGE_QUERY_PROPERTY 要求から返されるクエリ結果構造体の 1 つです。この構造体には、ストレージデバイスのコピーオフロード機能が格納されます。

解説(Remarks)

この構造体は、STORAGE_PROPERTY_QUERYPropertyId メンバーに StorageDeviceCopyOffloadProperty が設定されている場合に、IOCTL_STORAGE_QUERY_PROPERTY 要求から返されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// DEVICE_COPY_OFFLOAD_DESCRIPTOR  (x64 48 / x86 48 バイト)
typedef struct DEVICE_COPY_OFFLOAD_DESCRIPTOR {
    DWORD Version;
    DWORD Size;
    DWORD MaximumTokenLifetime;
    DWORD DefaultTokenLifetime;
    ULONGLONG MaximumTransferSize;
    ULONGLONG OptimalTransferCount;
    DWORD MaximumDataDescriptors;
    DWORD MaximumTransferLengthPerDescriptor;
    DWORD OptimalTransferLengthPerDescriptor;
    WORD OptimalTransferLengthGranularity;
    BYTE Reserved[2];
} DEVICE_COPY_OFFLOAD_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_COPY_OFFLOAD_DESCRIPTOR
{
    public uint Version;
    public uint Size;
    public uint MaximumTokenLifetime;
    public uint DefaultTokenLifetime;
    public ulong MaximumTransferSize;
    public ulong OptimalTransferCount;
    public uint MaximumDataDescriptors;
    public uint MaximumTransferLengthPerDescriptor;
    public uint OptimalTransferLengthPerDescriptor;
    public ushort OptimalTransferLengthGranularity;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_COPY_OFFLOAD_DESCRIPTOR
    Public Version As UInteger
    Public Size As UInteger
    Public MaximumTokenLifetime As UInteger
    Public DefaultTokenLifetime As UInteger
    Public MaximumTransferSize As ULong
    Public OptimalTransferCount As ULong
    Public MaximumDataDescriptors As UInteger
    Public MaximumTransferLengthPerDescriptor As UInteger
    Public OptimalTransferLengthPerDescriptor As UInteger
    Public OptimalTransferLengthGranularity As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DEVICE_COPY_OFFLOAD_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("MaximumTokenLifetime", wintypes.DWORD),
        ("DefaultTokenLifetime", wintypes.DWORD),
        ("MaximumTransferSize", ctypes.c_ulonglong),
        ("OptimalTransferCount", ctypes.c_ulonglong),
        ("MaximumDataDescriptors", wintypes.DWORD),
        ("MaximumTransferLengthPerDescriptor", wintypes.DWORD),
        ("OptimalTransferLengthPerDescriptor", wintypes.DWORD),
        ("OptimalTransferLengthGranularity", ctypes.c_ushort),
        ("Reserved", ctypes.c_ubyte * 2),
    ]
#[repr(C)]
pub struct DEVICE_COPY_OFFLOAD_DESCRIPTOR {
    pub Version: u32,
    pub Size: u32,
    pub MaximumTokenLifetime: u32,
    pub DefaultTokenLifetime: u32,
    pub MaximumTransferSize: u64,
    pub OptimalTransferCount: u64,
    pub MaximumDataDescriptors: u32,
    pub MaximumTransferLengthPerDescriptor: u32,
    pub OptimalTransferLengthPerDescriptor: u32,
    pub OptimalTransferLengthGranularity: u16,
    pub Reserved: [u8; 2],
}
import "golang.org/x/sys/windows"

type DEVICE_COPY_OFFLOAD_DESCRIPTOR struct {
	Version uint32
	Size uint32
	MaximumTokenLifetime uint32
	DefaultTokenLifetime uint32
	MaximumTransferSize uint64
	OptimalTransferCount uint64
	MaximumDataDescriptors uint32
	MaximumTransferLengthPerDescriptor uint32
	OptimalTransferLengthPerDescriptor uint32
	OptimalTransferLengthGranularity uint16
	Reserved [2]byte
}
type
  DEVICE_COPY_OFFLOAD_DESCRIPTOR = record
    Version: DWORD;
    Size: DWORD;
    MaximumTokenLifetime: DWORD;
    DefaultTokenLifetime: DWORD;
    MaximumTransferSize: UInt64;
    OptimalTransferCount: UInt64;
    MaximumDataDescriptors: DWORD;
    MaximumTransferLengthPerDescriptor: DWORD;
    OptimalTransferLengthPerDescriptor: DWORD;
    OptimalTransferLengthGranularity: Word;
    Reserved: array[0..1] of Byte;
  end;
const DEVICE_COPY_OFFLOAD_DESCRIPTOR = extern struct {
    Version: u32,
    Size: u32,
    MaximumTokenLifetime: u32,
    DefaultTokenLifetime: u32,
    MaximumTransferSize: u64,
    OptimalTransferCount: u64,
    MaximumDataDescriptors: u32,
    MaximumTransferLengthPerDescriptor: u32,
    OptimalTransferLengthPerDescriptor: u32,
    OptimalTransferLengthGranularity: u16,
    Reserved: [2]u8,
};
type
  DEVICE_COPY_OFFLOAD_DESCRIPTOR {.bycopy.} = object
    Version: uint32
    Size: uint32
    MaximumTokenLifetime: uint32
    DefaultTokenLifetime: uint32
    MaximumTransferSize: uint64
    OptimalTransferCount: uint64
    MaximumDataDescriptors: uint32
    MaximumTransferLengthPerDescriptor: uint32
    OptimalTransferLengthPerDescriptor: uint32
    OptimalTransferLengthGranularity: uint16
    Reserved: array[2, uint8]
struct DEVICE_COPY_OFFLOAD_DESCRIPTOR
{
    uint Version;
    uint Size;
    uint MaximumTokenLifetime;
    uint DefaultTokenLifetime;
    ulong MaximumTransferSize;
    ulong OptimalTransferCount;
    uint MaximumDataDescriptors;
    uint MaximumTransferLengthPerDescriptor;
    uint OptimalTransferLengthPerDescriptor;
    ushort OptimalTransferLengthGranularity;
    ubyte[2] Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICE_COPY_OFFLOAD_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 も可)
; MaximumTokenLifetime : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; DefaultTokenLifetime : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; MaximumTransferSize : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; OptimalTransferCount : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; MaximumDataDescriptors : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; MaximumTransferLengthPerDescriptor : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; OptimalTransferLengthPerDescriptor : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; OptimalTransferLengthGranularity : WORD (+44, 2byte)  wpoke st,44,値  /  値 = wpeek(st,44)
; Reserved : BYTE (+46, 2byte)  varptr(st)+46 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICE_COPY_OFFLOAD_DESCRIPTOR
    #field int Version
    #field int Size
    #field int MaximumTokenLifetime
    #field int DefaultTokenLifetime
    #field int64 MaximumTransferSize
    #field int64 OptimalTransferCount
    #field int MaximumDataDescriptors
    #field int MaximumTransferLengthPerDescriptor
    #field int OptimalTransferLengthPerDescriptor
    #field short OptimalTransferLengthGranularity
    #field byte Reserved 2
#endstruct

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