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

DEVICE_STORAGE_RANGE_ATTRIBUTES

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

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

フィールド

フィールドサイズx64x86説明
LengthInBytesULONGLONG8+0+0属性が適用される範囲の長さをバイト単位で示す。
Anonymous_Anonymous_e__Union8/4+8+8範囲の属性(エラー状態等)をビット表現で保持する無名共用体。
ReservedDWORD4+16+12将来の拡張のために予約された32ビット領域。

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

フィールドサイズx64x86説明
AllFlagsDWORD4+0+0
Anonymous_Anonymous_e__Struct8/4+0+0範囲の属性(エラー状態等)をビット表現で保持する無名共用体。

各言語での定義

#include <windows.h>

// DEVICE_STORAGE_RANGE_ATTRIBUTES  (x64 24 / x86 16 バイト)
typedef struct DEVICE_STORAGE_RANGE_ATTRIBUTES {
    ULONGLONG LengthInBytes;
    _Anonymous_e__Union Anonymous;
    DWORD Reserved;
} DEVICE_STORAGE_RANGE_ATTRIBUTES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_STORAGE_RANGE_ATTRIBUTES
{
    public ulong LengthInBytes;
    public _Anonymous_e__Union Anonymous;
    public uint Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_STORAGE_RANGE_ATTRIBUTES
    Public LengthInBytes As ULong
    Public Anonymous As _Anonymous_e__Union
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DEVICE_STORAGE_RANGE_ATTRIBUTES(ctypes.Structure):
    _fields_ = [
        ("LengthInBytes", ctypes.c_ulonglong),
        ("Anonymous", _Anonymous_e__Union),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DEVICE_STORAGE_RANGE_ATTRIBUTES {
    pub LengthInBytes: u64,
    pub Anonymous: _Anonymous_e__Union,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type DEVICE_STORAGE_RANGE_ATTRIBUTES struct {
	LengthInBytes uint64
	Anonymous _Anonymous_e__Union
	Reserved uint32
}
type
  DEVICE_STORAGE_RANGE_ATTRIBUTES = record
    LengthInBytes: UInt64;
    Anonymous: _Anonymous_e__Union;
    Reserved: DWORD;
  end;
const DEVICE_STORAGE_RANGE_ATTRIBUTES = extern struct {
    LengthInBytes: u64,
    Anonymous: _Anonymous_e__Union,
    Reserved: u32,
};
type
  DEVICE_STORAGE_RANGE_ATTRIBUTES {.bycopy.} = object
    LengthInBytes: uint64
    Anonymous: _Anonymous_e__Union
    Reserved: uint32
struct DEVICE_STORAGE_RANGE_ATTRIBUTES
{
    ulong LengthInBytes;
    _Anonymous_e__Union Anonymous;
    uint Reserved;
}

HSP用 定義

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

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

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