Win32 API 日本語リファレンス
ホームStorage.VirtualDiskService › VDS_DISK_PROP2

VDS_DISK_PROP2

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

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

フィールド

フィールドサイズx64x86説明
idGUID16+0+0ディスクを一意に識別するGUID。
statusVDS_DISK_STATUS4+16+16ディスクの状態を示すVDS_DISK_STATUS列挙値。
OfflineReasonVDS_DISK_OFFLINE_REASON4+20+20ディスクがオフラインである理由を示すVDS_DISK_OFFLINE_REASON列挙値。
ReserveModeVDS_LUN_RESERVE_MODE4+24+24LUNの予約モードを示すVDS_LUN_RESERVE_MODE列挙値。
healthVDS_HEALTH4+28+28ディスクの正常性を示すVDS_HEALTH列挙値。
dwDeviceTypeDWORD4+32+32デバイスの種類を示すFILE_DEVICE_*値。
dwMediaTypeDWORD4+36+36メディアの種類を示すMEDIA_TYPE値。
ullSizeULONGLONG8+40+40ディスクの総容量をバイト単位で示す。
ulBytesPerSectorDWORD4+48+481セクターあたりのバイト数。
ulSectorsPerTrackDWORD4+52+521トラックあたりのセクター数。
ulTracksPerCylinderDWORD4+56+561シリンダーあたりのトラック数。
ulFlagsDWORD4+60+60ディスクの属性を示すVDS_DISK_FLAGビットフラグ。
BusTypeVDS_STORAGE_BUS_TYPE4+64+64ディスクが接続されるバスの種類を示すVDS_STORAGE_BUS_TYPE列挙値。
PartitionStyleVDS_PARTITION_STYLE4+68+68パーティション形式(MBR/GPT)を示すVDS_PARTITION_STYLE列挙値。
Anonymous_Anonymous_e__Union16+72+72パーティション形式に応じた署名情報を格納する無名共用体。
pwszDiskAddressLPWSTR8/4+88+88ディスクのアドレス文字列(ワイド文字)。
pwszNameLPWSTR8/4+96+92ディスクの内部名を表すワイド文字列。
pwszFriendlyNameLPWSTR8/4+104+96ユーザー向け表示名を表すワイド文字列。
pwszAdaptorNameLPWSTR8/4+112+100ディスクを制御するアダプター名を表すワイド文字列。
pwszDevicePathLPWSTR8/4+120+104デバイスインスタンスパスを表すワイド文字列。
pwszLocationPathLPWSTR8/4+128+108ディスクの物理的な位置パスを表すワイド文字列。

共用体: _Anonymous_e__Union x64 16B / x86 16B

フィールドサイズx64x86
dwSignatureDWORD4+0+0
DiskGuidGUID16+0+0

各言語での定義

#include <windows.h>

// VDS_DISK_PROP2  (x64 136 / x86 112 バイト)
typedef struct VDS_DISK_PROP2 {
    GUID id;
    VDS_DISK_STATUS status;
    VDS_DISK_OFFLINE_REASON OfflineReason;
    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;
    LPWSTR pwszLocationPath;
} VDS_DISK_PROP2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_DISK_PROP2
{
    public Guid id;
    public int status;
    public int OfflineReason;
    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;
    public IntPtr pwszLocationPath;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_DISK_PROP2
    Public id As Guid
    Public status As Integer
    Public OfflineReason 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
    Public pwszLocationPath As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class VDS_DISK_PROP2(ctypes.Structure):
    _fields_ = [
        ("id", GUID),
        ("status", ctypes.c_int),
        ("OfflineReason", 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),
        ("pwszLocationPath", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct VDS_DISK_PROP2 {
    pub id: GUID,
    pub status: i32,
    pub OfflineReason: 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,
    pub pwszLocationPath: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type VDS_DISK_PROP2 struct {
	id windows.GUID
	status int32
	OfflineReason 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
	pwszLocationPath uintptr
}
type
  VDS_DISK_PROP2 = record
    id: TGUID;
    status: Integer;
    OfflineReason: 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;
    pwszLocationPath: Pointer;
  end;
const VDS_DISK_PROP2 = extern struct {
    id: GUID,
    status: i32,
    OfflineReason: 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,
    pwszLocationPath: ?*anyopaque,
};
type
  VDS_DISK_PROP2 {.bycopy.} = object
    id: GUID
    status: int32
    OfflineReason: 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: pointer
    pwszLocationPath: pointer
struct VDS_DISK_PROP2
{
    GUID id;
    int status;
    int OfflineReason;
    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;
    void* pwszLocationPath;
}

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_PROP2 サイズ: 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 も可)
; OfflineReason : VDS_DISK_OFFLINE_REASON (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ReserveMode : VDS_LUN_RESERVE_MODE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; health : VDS_HEALTH (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwDeviceType : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwMediaType : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (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 も可)
; pwszLocationPath : LPWSTR (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_DISK_PROP2 サイズ: 136 バイト(x64)
dim st, 34    ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; status : VDS_DISK_STATUS (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; OfflineReason : VDS_DISK_OFFLINE_REASON (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ReserveMode : VDS_LUN_RESERVE_MODE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; health : VDS_HEALTH (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwDeviceType : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwMediaType : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (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,上位
; pwszLocationPath : LPWSTR (+128, 8byte)  qpoke st,128,値 / qpeek(st,128)  ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; ※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_PROP2
    #field GUID id
    #field int status
    #field int OfflineReason
    #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
    #field intptr pwszLocationPath
#endstruct

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