ホーム › System.Ioctl › DEVICE_DSM_REPORT_ZONES_DATA
DEVICE_DSM_REPORT_ZONES_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Size | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| ZoneCount | DWORD | 4 | +4 | +4 | ZoneDescriptors配列に含まれるゾーン記述子の数。 |
| Attributes | STORAGE_ZONES_ATTRIBUTES | 4 | +8 | +8 | ゾーン全体の属性を示すSTORAGE_ZONES_ATTRIBUTES。 |
| Reserved0 | DWORD | 4 | +12 | +12 | 将来の拡張のために予約された32ビット領域。 |
| ZoneDescriptors | STORAGE_ZONE_DESCRIPTOR | 32 | +16 | +16 | STORAGE_ZONE_DESCRIPTOR構造体の可変長配列。各ゾーンの情報を保持する。 |
各言語での定義
#include <windows.h>
// STORAGE_ZONE_DESCRIPTOR (x64 32 / x86 32 バイト)
typedef struct STORAGE_ZONE_DESCRIPTOR {
DWORD Size;
STORAGE_ZONE_TYPES ZoneType;
STORAGE_ZONE_CONDITION ZoneCondition;
BOOLEAN ResetWritePointerRecommend;
BYTE Reserved0[3];
ULONGLONG ZoneSize;
ULONGLONG WritePointerOffset;
} STORAGE_ZONE_DESCRIPTOR;
// DEVICE_DSM_REPORT_ZONES_DATA (x64 48 / x86 48 バイト)
typedef struct DEVICE_DSM_REPORT_ZONES_DATA {
DWORD Size;
DWORD ZoneCount;
STORAGE_ZONES_ATTRIBUTES Attributes;
DWORD Reserved0;
STORAGE_ZONE_DESCRIPTOR ZoneDescriptors[1];
} DEVICE_DSM_REPORT_ZONES_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_ZONE_DESCRIPTOR
{
public uint Size;
public int ZoneType;
public int ZoneCondition;
[MarshalAs(UnmanagedType.U1)] public bool ResetWritePointerRecommend;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
public ulong ZoneSize;
public ulong WritePointerOffset;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_DSM_REPORT_ZONES_DATA
{
public uint Size;
public uint ZoneCount;
public int Attributes;
public uint Reserved0;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public STORAGE_ZONE_DESCRIPTOR[] ZoneDescriptors;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_ZONE_DESCRIPTOR
Public Size As UInteger
Public ZoneType As Integer
Public ZoneCondition As Integer
<MarshalAs(UnmanagedType.U1)> Public ResetWritePointerRecommend As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
Public ZoneSize As ULong
Public WritePointerOffset As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_DSM_REPORT_ZONES_DATA
Public Size As UInteger
Public ZoneCount As UInteger
Public Attributes As Integer
Public Reserved0 As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ZoneDescriptors() As STORAGE_ZONE_DESCRIPTOR
End Structureimport ctypes
from ctypes import wintypes
class STORAGE_ZONE_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Size", wintypes.DWORD),
("ZoneType", ctypes.c_int),
("ZoneCondition", ctypes.c_int),
("ResetWritePointerRecommend", ctypes.c_byte),
("Reserved0", ctypes.c_ubyte * 3),
("ZoneSize", ctypes.c_ulonglong),
("WritePointerOffset", ctypes.c_ulonglong),
]
class DEVICE_DSM_REPORT_ZONES_DATA(ctypes.Structure):
_fields_ = [
("Size", wintypes.DWORD),
("ZoneCount", wintypes.DWORD),
("Attributes", ctypes.c_int),
("Reserved0", wintypes.DWORD),
("ZoneDescriptors", STORAGE_ZONE_DESCRIPTOR * 1),
]#[repr(C)]
pub struct STORAGE_ZONE_DESCRIPTOR {
pub Size: u32,
pub ZoneType: i32,
pub ZoneCondition: i32,
pub ResetWritePointerRecommend: u8,
pub Reserved0: [u8; 3],
pub ZoneSize: u64,
pub WritePointerOffset: u64,
}
#[repr(C)]
pub struct DEVICE_DSM_REPORT_ZONES_DATA {
pub Size: u32,
pub ZoneCount: u32,
pub Attributes: i32,
pub Reserved0: u32,
pub ZoneDescriptors: [STORAGE_ZONE_DESCRIPTOR; 1],
}import "golang.org/x/sys/windows"
type STORAGE_ZONE_DESCRIPTOR struct {
Size uint32
ZoneType int32
ZoneCondition int32
ResetWritePointerRecommend byte
Reserved0 [3]byte
ZoneSize uint64
WritePointerOffset uint64
}
type DEVICE_DSM_REPORT_ZONES_DATA struct {
Size uint32
ZoneCount uint32
Attributes int32
Reserved0 uint32
ZoneDescriptors [1]STORAGE_ZONE_DESCRIPTOR
}type
STORAGE_ZONE_DESCRIPTOR = record
Size: DWORD;
ZoneType: Integer;
ZoneCondition: Integer;
ResetWritePointerRecommend: ByteBool;
Reserved0: array[0..2] of Byte;
ZoneSize: UInt64;
WritePointerOffset: UInt64;
end;
DEVICE_DSM_REPORT_ZONES_DATA = record
Size: DWORD;
ZoneCount: DWORD;
Attributes: Integer;
Reserved0: DWORD;
ZoneDescriptors: array[0..0] of STORAGE_ZONE_DESCRIPTOR;
end;const STORAGE_ZONE_DESCRIPTOR = extern struct {
Size: u32,
ZoneType: i32,
ZoneCondition: i32,
ResetWritePointerRecommend: u8,
Reserved0: [3]u8,
ZoneSize: u64,
WritePointerOffset: u64,
};
const DEVICE_DSM_REPORT_ZONES_DATA = extern struct {
Size: u32,
ZoneCount: u32,
Attributes: i32,
Reserved0: u32,
ZoneDescriptors: [1]STORAGE_ZONE_DESCRIPTOR,
};type
STORAGE_ZONE_DESCRIPTOR {.bycopy.} = object
Size: uint32
ZoneType: int32
ZoneCondition: int32
ResetWritePointerRecommend: uint8
Reserved0: array[3, uint8]
ZoneSize: uint64
WritePointerOffset: uint64
DEVICE_DSM_REPORT_ZONES_DATA {.bycopy.} = object
Size: uint32
ZoneCount: uint32
Attributes: int32
Reserved0: uint32
ZoneDescriptors: array[1, STORAGE_ZONE_DESCRIPTOR]struct STORAGE_ZONE_DESCRIPTOR
{
uint Size;
int ZoneType;
int ZoneCondition;
ubyte ResetWritePointerRecommend;
ubyte[3] Reserved0;
ulong ZoneSize;
ulong WritePointerOffset;
}
struct DEVICE_DSM_REPORT_ZONES_DATA
{
uint Size;
uint ZoneCount;
int Attributes;
uint Reserved0;
STORAGE_ZONE_DESCRIPTOR[1] ZoneDescriptors;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICE_DSM_REPORT_ZONES_DATA サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Size : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ZoneCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Attributes : STORAGE_ZONES_ATTRIBUTES (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Reserved0 : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ZoneDescriptors : STORAGE_ZONE_DESCRIPTOR (+16, 32byte) varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STORAGE_ZONE_DESCRIPTOR
#field int Size
#field int ZoneType
#field int ZoneCondition
#field bool1 ResetWritePointerRecommend
#field byte Reserved0 3
#field int64 ZoneSize
#field int64 WritePointerOffset
#endstruct
#defstruct global DEVICE_DSM_REPORT_ZONES_DATA
#field int Size
#field int ZoneCount
#field int Attributes
#field int Reserved0
#field STORAGE_ZONE_DESCRIPTOR ZoneDescriptors 1
#endstruct
stdim st, DEVICE_DSM_REPORT_ZONES_DATA ; NSTRUCT 変数を確保
st->Size = 100
mes "Size=" + st->Size