ホーム › System.Ioctl › STORAGE_ZONED_DEVICE_DESCRIPTOR
STORAGE_ZONED_DEVICE_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体全体のサイズをバイト単位で示す。 |
| DeviceType | STORAGE_ZONED_DEVICE_TYPES | 4 | +8 | +8 | ゾーン化デバイスの種類を示すSTORAGE_ZONED_DEVICE_TYPES列挙値。HM-SMR等。 |
| ZoneCount | DWORD | 4 | +12 | +12 | デバイス上のゾーンの総数。 |
| ZoneAttributes | _ZoneAttributes_e__Union | 8/4 | +16 | +16 | ゾーンの属性を保持する共用体。順次書き込み必須等の制約を示す。 |
| ZoneGroupCount | DWORD | 4 | +24 | +20 | ZoneGroup配列に含まれるゾーングループ数。 |
| ZoneGroup | STORAGE_ZONE_GROUP | 16 | +32 | +24 | STORAGE_ZONE_GROUP構造体の可変長配列。各ゾーングループの情報を保持する。 |
共用体: _ZoneAttributes_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| SequentialRequiredZone | _SequentialRequiredZone_e__Struct | 8/4 | +0 | +0 |
| SequentialPreferredZone | _SequentialPreferredZone_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// STORAGE_ZONE_GROUP (x64 16 / x86 16 バイト)
typedef struct STORAGE_ZONE_GROUP {
DWORD ZoneCount;
STORAGE_ZONE_TYPES ZoneType;
ULONGLONG ZoneSize;
} STORAGE_ZONE_GROUP;
// STORAGE_ZONED_DEVICE_DESCRIPTOR (x64 48 / x86 40 バイト)
typedef struct STORAGE_ZONED_DEVICE_DESCRIPTOR {
DWORD Version;
DWORD Size;
STORAGE_ZONED_DEVICE_TYPES DeviceType;
DWORD ZoneCount;
_ZoneAttributes_e__Union ZoneAttributes;
DWORD ZoneGroupCount;
STORAGE_ZONE_GROUP ZoneGroup[1];
} STORAGE_ZONED_DEVICE_DESCRIPTOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_ZONE_GROUP
{
public uint ZoneCount;
public int ZoneType;
public ulong ZoneSize;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_ZONED_DEVICE_DESCRIPTOR
{
public uint Version;
public uint Size;
public int DeviceType;
public uint ZoneCount;
public _ZoneAttributes_e__Union ZoneAttributes;
public uint ZoneGroupCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public STORAGE_ZONE_GROUP[] ZoneGroup;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_ZONE_GROUP
Public ZoneCount As UInteger
Public ZoneType As Integer
Public ZoneSize As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_ZONED_DEVICE_DESCRIPTOR
Public Version As UInteger
Public Size As UInteger
Public DeviceType As Integer
Public ZoneCount As UInteger
Public ZoneAttributes As _ZoneAttributes_e__Union
Public ZoneGroupCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ZoneGroup() As STORAGE_ZONE_GROUP
End Structureimport ctypes
from ctypes import wintypes
class STORAGE_ZONE_GROUP(ctypes.Structure):
_fields_ = [
("ZoneCount", wintypes.DWORD),
("ZoneType", ctypes.c_int),
("ZoneSize", ctypes.c_ulonglong),
]
class STORAGE_ZONED_DEVICE_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("DeviceType", ctypes.c_int),
("ZoneCount", wintypes.DWORD),
("ZoneAttributes", _ZoneAttributes_e__Union),
("ZoneGroupCount", wintypes.DWORD),
("ZoneGroup", STORAGE_ZONE_GROUP * 1),
]#[repr(C)]
pub struct STORAGE_ZONE_GROUP {
pub ZoneCount: u32,
pub ZoneType: i32,
pub ZoneSize: u64,
}
#[repr(C)]
pub struct STORAGE_ZONED_DEVICE_DESCRIPTOR {
pub Version: u32,
pub Size: u32,
pub DeviceType: i32,
pub ZoneCount: u32,
pub ZoneAttributes: _ZoneAttributes_e__Union,
pub ZoneGroupCount: u32,
pub ZoneGroup: [STORAGE_ZONE_GROUP; 1],
}import "golang.org/x/sys/windows"
type STORAGE_ZONE_GROUP struct {
ZoneCount uint32
ZoneType int32
ZoneSize uint64
}
type STORAGE_ZONED_DEVICE_DESCRIPTOR struct {
Version uint32
Size uint32
DeviceType int32
ZoneCount uint32
ZoneAttributes _ZoneAttributes_e__Union
ZoneGroupCount uint32
ZoneGroup [1]STORAGE_ZONE_GROUP
}type
STORAGE_ZONE_GROUP = record
ZoneCount: DWORD;
ZoneType: Integer;
ZoneSize: UInt64;
end;
STORAGE_ZONED_DEVICE_DESCRIPTOR = record
Version: DWORD;
Size: DWORD;
DeviceType: Integer;
ZoneCount: DWORD;
ZoneAttributes: _ZoneAttributes_e__Union;
ZoneGroupCount: DWORD;
ZoneGroup: array[0..0] of STORAGE_ZONE_GROUP;
end;const STORAGE_ZONE_GROUP = extern struct {
ZoneCount: u32,
ZoneType: i32,
ZoneSize: u64,
};
const STORAGE_ZONED_DEVICE_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
DeviceType: i32,
ZoneCount: u32,
ZoneAttributes: _ZoneAttributes_e__Union,
ZoneGroupCount: u32,
ZoneGroup: [1]STORAGE_ZONE_GROUP,
};type
STORAGE_ZONE_GROUP {.bycopy.} = object
ZoneCount: uint32
ZoneType: int32
ZoneSize: uint64
STORAGE_ZONED_DEVICE_DESCRIPTOR {.bycopy.} = object
Version: uint32
Size: uint32
DeviceType: int32
ZoneCount: uint32
ZoneAttributes: _ZoneAttributes_e__Union
ZoneGroupCount: uint32
ZoneGroup: array[1, STORAGE_ZONE_GROUP]struct STORAGE_ZONE_GROUP
{
uint ZoneCount;
int ZoneType;
ulong ZoneSize;
}
struct STORAGE_ZONED_DEVICE_DESCRIPTOR
{
uint Version;
uint Size;
int DeviceType;
uint ZoneCount;
_ZoneAttributes_e__Union ZoneAttributes;
uint ZoneGroupCount;
STORAGE_ZONE_GROUP[1] ZoneGroup;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STORAGE_ZONED_DEVICE_DESCRIPTOR サイズ: 40 バイト(x86)
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 も可)
; DeviceType : STORAGE_ZONED_DEVICE_TYPES (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ZoneCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ZoneAttributes : _ZoneAttributes_e__Union (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ZoneGroupCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ZoneGroup : STORAGE_ZONE_GROUP (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_ZONED_DEVICE_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 も可)
; DeviceType : STORAGE_ZONED_DEVICE_TYPES (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ZoneCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ZoneAttributes : _ZoneAttributes_e__Union (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ZoneGroupCount : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ZoneGroup : STORAGE_ZONE_GROUP (+32, 16byte) varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STORAGE_ZONE_GROUP
#field int ZoneCount
#field int ZoneType
#field int64 ZoneSize
#endstruct
#defstruct global STORAGE_ZONED_DEVICE_DESCRIPTOR
#field int Version
#field int Size
#field int DeviceType
#field int ZoneCount
#field byte ZoneAttributes 8
#field int ZoneGroupCount
#field STORAGE_ZONE_GROUP ZoneGroup 1
#endstruct
stdim st, STORAGE_ZONED_DEVICE_DESCRIPTOR ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。