ホーム › Storage.VirtualDiskService › VDS_DISK_PROP
VDS_DISK_PROP
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| id | GUID | 16 | +0 | +0 | ディスクを一意に識別するGUID。 |
| status | VDS_DISK_STATUS | 4 | +16 | +16 | ディスクの状態を示すVDS_DISK_STATUS列挙値。 |
| ReserveMode | VDS_LUN_RESERVE_MODE | 4 | +20 | +20 | LUNの予約モードを示すVDS_LUN_RESERVE_MODE列挙値。 |
| health | VDS_HEALTH | 4 | +24 | +24 | ディスクの正常性を示すVDS_HEALTH列挙値。 |
| dwDeviceType | DWORD | 4 | +28 | +28 | デバイスの種類を示すFILE_DEVICE_*値。 |
| dwMediaType | DWORD | 4 | +32 | +32 | メディアの種類を示すMEDIA_TYPE値。 |
| ullSize | ULONGLONG | 8 | +40 | +40 | ディスクの総容量をバイト単位で示す。 |
| ulBytesPerSector | DWORD | 4 | +48 | +48 | 1セクターあたりのバイト数。 |
| ulSectorsPerTrack | DWORD | 4 | +52 | +52 | 1トラックあたりのセクター数。 |
| ulTracksPerCylinder | DWORD | 4 | +56 | +56 | 1シリンダーあたりのトラック数。 |
| ulFlags | DWORD | 4 | +60 | +60 | ディスクの属性を示すVDS_DISK_FLAGビットフラグ。 |
| BusType | VDS_STORAGE_BUS_TYPE | 4 | +64 | +64 | ディスクが接続されるバスの種類を示すVDS_STORAGE_BUS_TYPE列挙値。 |
| PartitionStyle | VDS_PARTITION_STYLE | 4 | +68 | +68 | パーティション形式(MBR/GPT)を示すVDS_PARTITION_STYLE列挙値。 |
| Anonymous | _Anonymous_e__Union | 16 | +72 | +72 | パーティション形式に応じた署名情報を格納する無名共用体。 |
| pwszDiskAddress | LPWSTR | 8/4 | +88 | +88 | ディスクのアドレス文字列(ワイド文字)。 |
| pwszName | LPWSTR | 8/4 | +96 | +92 | ディスクの内部名(\\?\PhysicalDrive 等)を表すワイド文字列。 |
| pwszFriendlyName | LPWSTR | 8/4 | +104 | +96 | ユーザー向け表示名を表すワイド文字列。 |
| pwszAdaptorName | LPWSTR | 8/4 | +112 | +100 | ディスクを制御するアダプター名を表すワイド文字列。 |
| pwszDevicePath | LPWSTR | 8/4 | +120 | +104 | デバイスインスタンスパスを表すワイド文字列。 |
共用体: _Anonymous_e__Union x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| dwSignature | DWORD | 4 | +0 | +0 |
| DiskGuid | GUID | 16 | +0 | +0 |
各言語での定義
#include <windows.h>
// VDS_DISK_PROP (x64 128 / x86 112 バイト)
typedef struct VDS_DISK_PROP {
GUID id;
VDS_DISK_STATUS status;
VDS_LUN_RESERVE_MODE ReserveMode;
VDS_HEALTH health;
DWORD dwDeviceType;
DWORD dwMediaType;
ULONGLONG ullSize;
DWORD ulBytesPerSector;
DWORD ulSectorsPerTrack;
DWORD ulTracksPerCylinder;
DWORD ulFlags;
VDS_STORAGE_BUS_TYPE BusType;
VDS_PARTITION_STYLE PartitionStyle;
_Anonymous_e__Union Anonymous;
LPWSTR pwszDiskAddress;
LPWSTR pwszName;
LPWSTR pwszFriendlyName;
LPWSTR pwszAdaptorName;
LPWSTR pwszDevicePath;
} VDS_DISK_PROP;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_DISK_PROP
{
public Guid id;
public int status;
public int ReserveMode;
public int health;
public uint dwDeviceType;
public uint dwMediaType;
public ulong ullSize;
public uint ulBytesPerSector;
public uint ulSectorsPerTrack;
public uint ulTracksPerCylinder;
public uint ulFlags;
public int BusType;
public int PartitionStyle;
public _Anonymous_e__Union Anonymous;
public IntPtr pwszDiskAddress;
public IntPtr pwszName;
public IntPtr pwszFriendlyName;
public IntPtr pwszAdaptorName;
public IntPtr pwszDevicePath;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_DISK_PROP
Public id As Guid
Public status As Integer
Public ReserveMode As Integer
Public health As Integer
Public dwDeviceType As UInteger
Public dwMediaType As UInteger
Public ullSize As ULong
Public ulBytesPerSector As UInteger
Public ulSectorsPerTrack As UInteger
Public ulTracksPerCylinder As UInteger
Public ulFlags As UInteger
Public BusType As Integer
Public PartitionStyle As Integer
Public Anonymous As _Anonymous_e__Union
Public pwszDiskAddress As IntPtr
Public pwszName As IntPtr
Public pwszFriendlyName As IntPtr
Public pwszAdaptorName As IntPtr
Public pwszDevicePath As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class VDS_DISK_PROP(ctypes.Structure):
_fields_ = [
("id", GUID),
("status", ctypes.c_int),
("ReserveMode", ctypes.c_int),
("health", ctypes.c_int),
("dwDeviceType", wintypes.DWORD),
("dwMediaType", wintypes.DWORD),
("ullSize", ctypes.c_ulonglong),
("ulBytesPerSector", wintypes.DWORD),
("ulSectorsPerTrack", wintypes.DWORD),
("ulTracksPerCylinder", wintypes.DWORD),
("ulFlags", wintypes.DWORD),
("BusType", ctypes.c_int),
("PartitionStyle", ctypes.c_int),
("Anonymous", _Anonymous_e__Union),
("pwszDiskAddress", ctypes.c_void_p),
("pwszName", ctypes.c_void_p),
("pwszFriendlyName", ctypes.c_void_p),
("pwszAdaptorName", ctypes.c_void_p),
("pwszDevicePath", ctypes.c_void_p),
]#[repr(C)]
pub struct VDS_DISK_PROP {
pub id: GUID,
pub status: i32,
pub ReserveMode: i32,
pub health: i32,
pub dwDeviceType: u32,
pub dwMediaType: u32,
pub ullSize: u64,
pub ulBytesPerSector: u32,
pub ulSectorsPerTrack: u32,
pub ulTracksPerCylinder: u32,
pub ulFlags: u32,
pub BusType: i32,
pub PartitionStyle: i32,
pub Anonymous: _Anonymous_e__Union,
pub pwszDiskAddress: *mut core::ffi::c_void,
pub pwszName: *mut core::ffi::c_void,
pub pwszFriendlyName: *mut core::ffi::c_void,
pub pwszAdaptorName: *mut core::ffi::c_void,
pub pwszDevicePath: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type VDS_DISK_PROP struct {
id windows.GUID
status int32
ReserveMode int32
health int32
dwDeviceType uint32
dwMediaType uint32
ullSize uint64
ulBytesPerSector uint32
ulSectorsPerTrack uint32
ulTracksPerCylinder uint32
ulFlags uint32
BusType int32
PartitionStyle int32
Anonymous _Anonymous_e__Union
pwszDiskAddress uintptr
pwszName uintptr
pwszFriendlyName uintptr
pwszAdaptorName uintptr
pwszDevicePath uintptr
}type
VDS_DISK_PROP = record
id: TGUID;
status: Integer;
ReserveMode: Integer;
health: Integer;
dwDeviceType: DWORD;
dwMediaType: DWORD;
ullSize: UInt64;
ulBytesPerSector: DWORD;
ulSectorsPerTrack: DWORD;
ulTracksPerCylinder: DWORD;
ulFlags: DWORD;
BusType: Integer;
PartitionStyle: Integer;
Anonymous: _Anonymous_e__Union;
pwszDiskAddress: Pointer;
pwszName: Pointer;
pwszFriendlyName: Pointer;
pwszAdaptorName: Pointer;
pwszDevicePath: Pointer;
end;const VDS_DISK_PROP = extern struct {
id: GUID,
status: i32,
ReserveMode: i32,
health: i32,
dwDeviceType: u32,
dwMediaType: u32,
ullSize: u64,
ulBytesPerSector: u32,
ulSectorsPerTrack: u32,
ulTracksPerCylinder: u32,
ulFlags: u32,
BusType: i32,
PartitionStyle: i32,
Anonymous: _Anonymous_e__Union,
pwszDiskAddress: ?*anyopaque,
pwszName: ?*anyopaque,
pwszFriendlyName: ?*anyopaque,
pwszAdaptorName: ?*anyopaque,
pwszDevicePath: ?*anyopaque,
};type
VDS_DISK_PROP {.bycopy.} = object
id: GUID
status: int32
ReserveMode: int32
health: int32
dwDeviceType: uint32
dwMediaType: uint32
ullSize: uint64
ulBytesPerSector: uint32
ulSectorsPerTrack: uint32
ulTracksPerCylinder: uint32
ulFlags: uint32
BusType: int32
PartitionStyle: int32
Anonymous: _Anonymous_e__Union
pwszDiskAddress: pointer
pwszName: pointer
pwszFriendlyName: pointer
pwszAdaptorName: pointer
pwszDevicePath: pointerstruct VDS_DISK_PROP
{
GUID id;
int status;
int ReserveMode;
int health;
uint dwDeviceType;
uint dwMediaType;
ulong ullSize;
uint ulBytesPerSector;
uint ulSectorsPerTrack;
uint ulTracksPerCylinder;
uint ulFlags;
int BusType;
int PartitionStyle;
_Anonymous_e__Union Anonymous;
void* pwszDiskAddress;
void* pwszName;
void* pwszFriendlyName;
void* pwszAdaptorName;
void* pwszDevicePath;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VDS_DISK_PROP サイズ: 112 バイト(x86)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; id : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; status : VDS_DISK_STATUS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ReserveMode : VDS_LUN_RESERVE_MODE (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; health : VDS_HEALTH (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwDeviceType : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwMediaType : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ullSize : ULONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ulBytesPerSector : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ulSectorsPerTrack : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ulTracksPerCylinder : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ulFlags : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; BusType : VDS_STORAGE_BUS_TYPE (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; PartitionStyle : VDS_PARTITION_STYLE (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+72, 16byte) varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; pwszDiskAddress : LPWSTR (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; pwszName : LPWSTR (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; pwszFriendlyName : LPWSTR (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; pwszAdaptorName : LPWSTR (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; pwszDevicePath : LPWSTR (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_DISK_PROP サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; id : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; status : VDS_DISK_STATUS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ReserveMode : VDS_LUN_RESERVE_MODE (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; health : VDS_HEALTH (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwDeviceType : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwMediaType : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ullSize : ULONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ulBytesPerSector : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ulSectorsPerTrack : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ulTracksPerCylinder : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ulFlags : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; BusType : VDS_STORAGE_BUS_TYPE (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; PartitionStyle : VDS_PARTITION_STYLE (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+72, 16byte) varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; pwszDiskAddress : LPWSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; pwszName : LPWSTR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; pwszFriendlyName : LPWSTR (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; pwszAdaptorName : LPWSTR (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; pwszDevicePath : LPWSTR (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global VDS_DISK_PROP
#field GUID id
#field int status
#field int ReserveMode
#field int health
#field int dwDeviceType
#field int dwMediaType
#field int64 ullSize
#field int ulBytesPerSector
#field int ulSectorsPerTrack
#field int ulTracksPerCylinder
#field int ulFlags
#field int BusType
#field int PartitionStyle
#field byte Anonymous 16
#field intptr pwszDiskAddress
#field intptr pwszName
#field intptr pwszFriendlyName
#field intptr pwszAdaptorName
#field intptr pwszDevicePath
#endstruct
stdim st, VDS_DISK_PROP ; NSTRUCT 変数を確保
st->status = 100
mes "status=" + st->status
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。