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

DEVICE_LB_PROVISIONING_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
_bitfieldBYTE1+8+8シンプロビジョニング有効/UNMAP対応等を表すビットフィールド。
Reserved1BYTE7+9+9将来の拡張のために予約されたバイト領域。
OptimalUnmapGranularityULONGLONG8+16+16UNMAP操作の最適な粒度をバイト単位で示す。
UnmapGranularityAlignmentULONGLONG8+24+24UNMAP粒度の整列オフセットをバイト単位で示す。
MaxUnmapLbaCountDWORD4+32+321回のUNMAPで指定できる最大LBA数。
MaxUnmapBlockDescriptorCountDWORD4+36+361回のUNMAPで指定できる最大ブロックディスクリプタ数。

各言語での定義

#include <windows.h>

// DEVICE_LB_PROVISIONING_DESCRIPTOR  (x64 40 / x86 40 バイト)
typedef struct DEVICE_LB_PROVISIONING_DESCRIPTOR {
    DWORD Version;
    DWORD Size;
    BYTE _bitfield;
    BYTE Reserved1[7];
    ULONGLONG OptimalUnmapGranularity;
    ULONGLONG UnmapGranularityAlignment;
    DWORD MaxUnmapLbaCount;
    DWORD MaxUnmapBlockDescriptorCount;
} DEVICE_LB_PROVISIONING_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_LB_PROVISIONING_DESCRIPTOR
{
    public uint Version;
    public uint Size;
    public byte _bitfield;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] Reserved1;
    public ulong OptimalUnmapGranularity;
    public ulong UnmapGranularityAlignment;
    public uint MaxUnmapLbaCount;
    public uint MaxUnmapBlockDescriptorCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_LB_PROVISIONING_DESCRIPTOR
    Public Version As UInteger
    Public Size As UInteger
    Public _bitfield As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)> Public Reserved1() As Byte
    Public OptimalUnmapGranularity As ULong
    Public UnmapGranularityAlignment As ULong
    Public MaxUnmapLbaCount As UInteger
    Public MaxUnmapBlockDescriptorCount As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DEVICE_LB_PROVISIONING_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("_bitfield", ctypes.c_ubyte),
        ("Reserved1", ctypes.c_ubyte * 7),
        ("OptimalUnmapGranularity", ctypes.c_ulonglong),
        ("UnmapGranularityAlignment", ctypes.c_ulonglong),
        ("MaxUnmapLbaCount", wintypes.DWORD),
        ("MaxUnmapBlockDescriptorCount", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DEVICE_LB_PROVISIONING_DESCRIPTOR {
    pub Version: u32,
    pub Size: u32,
    pub _bitfield: u8,
    pub Reserved1: [u8; 7],
    pub OptimalUnmapGranularity: u64,
    pub UnmapGranularityAlignment: u64,
    pub MaxUnmapLbaCount: u32,
    pub MaxUnmapBlockDescriptorCount: u32,
}
import "golang.org/x/sys/windows"

type DEVICE_LB_PROVISIONING_DESCRIPTOR struct {
	Version uint32
	Size uint32
	_bitfield byte
	Reserved1 [7]byte
	OptimalUnmapGranularity uint64
	UnmapGranularityAlignment uint64
	MaxUnmapLbaCount uint32
	MaxUnmapBlockDescriptorCount uint32
}
type
  DEVICE_LB_PROVISIONING_DESCRIPTOR = record
    Version: DWORD;
    Size: DWORD;
    _bitfield: Byte;
    Reserved1: array[0..6] of Byte;
    OptimalUnmapGranularity: UInt64;
    UnmapGranularityAlignment: UInt64;
    MaxUnmapLbaCount: DWORD;
    MaxUnmapBlockDescriptorCount: DWORD;
  end;
const DEVICE_LB_PROVISIONING_DESCRIPTOR = extern struct {
    Version: u32,
    Size: u32,
    _bitfield: u8,
    Reserved1: [7]u8,
    OptimalUnmapGranularity: u64,
    UnmapGranularityAlignment: u64,
    MaxUnmapLbaCount: u32,
    MaxUnmapBlockDescriptorCount: u32,
};
type
  DEVICE_LB_PROVISIONING_DESCRIPTOR {.bycopy.} = object
    Version: uint32
    Size: uint32
    _bitfield: uint8
    Reserved1: array[7, uint8]
    OptimalUnmapGranularity: uint64
    UnmapGranularityAlignment: uint64
    MaxUnmapLbaCount: uint32
    MaxUnmapBlockDescriptorCount: uint32
struct DEVICE_LB_PROVISIONING_DESCRIPTOR
{
    uint Version;
    uint Size;
    ubyte _bitfield;
    ubyte[7] Reserved1;
    ulong OptimalUnmapGranularity;
    ulong UnmapGranularityAlignment;
    uint MaxUnmapLbaCount;
    uint MaxUnmapBlockDescriptorCount;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICE_LB_PROVISIONING_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; _bitfield : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; Reserved1 : BYTE (+9, 7byte)  varptr(st)+9 を基点に操作(7byte:入れ子/配列)
; OptimalUnmapGranularity : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; UnmapGranularityAlignment : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; MaxUnmapLbaCount : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; MaxUnmapBlockDescriptorCount : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICE_LB_PROVISIONING_DESCRIPTOR
    #field int Version
    #field int Size
    #field byte _bitfield
    #field byte Reserved1 7
    #field int64 OptimalUnmapGranularity
    #field int64 UnmapGranularityAlignment
    #field int MaxUnmapLbaCount
    #field int MaxUnmapBlockDescriptorCount
#endstruct

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