VDS_DRIVE_PROP2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| id | GUID | 16 | +0 | +0 | ドライブ オブジェクトの GUID です。 |
| ullSize | ULONGLONG | 8 | +16 | +16 | ドライブのサイズ (バイト単位)。 |
| pwszFriendlyName | LPWSTR | 8/4 | +24 | +24 | ドライブの名前を格納する NULL 終端のワイド文字列です。 |
| pwszIdentification | LPWSTR | 8/4 | +32 | +28 | ドライブの識別子を格納する NULL 終端のワイド文字列です。 |
| ulFlags | DWORD | 4 | +40 | +32 | |
| status | VDS_DRIVE_STATUS | 4 | +44 | +36 | ドライブの状態を指定する VDS_DRIVE_STATUS 列挙型の値です。 |
| health | VDS_HEALTH | 4 | +48 | +40 | ドライブの正常性状態を指定する VDS_HEALTH 列挙型の値です。このメンバーに有効な値は次のとおりです。 Windows Server 2008、Windows Vista および Windows Server 2003: VDS_H_REPLACED と VDS_H_PENDING_FAILURE はサポートされません。 VDS_H_UNKNOWN (0)VDS_H_HEALTHY (1)VDS_H_FAILED (8)VDS_H_REPLACED (9)VDS_H_PENDING_FAILURE (10) |
| sInternalBusNumber | SHORT | 2 | +52 | +44 | ドライブが接続されているバスの番号です。この番号は実装者が割り当てる値で、サブシステム内でバスを一意に識別します。サブシステムに含まれるバスの数による制約は受けず、VDS_SUB_SYSTEM_PROP 構造体の sNumberOfInternalBuses メンバーの値とは関係ありません。 |
| sSlotNumber | SHORT | 2 | +54 | +46 | ドライブが占有しているスロットの番号です。この番号は実装者が割り当てる値で、バス内でスロットを一意に識別します。バスに含まれるスロットの数による制約は受けず、VDS_SUB_SYSTEM_PROP 構造体の sMaxNumberOfSlotsEachBus メンバーの値とは関係ありません。 |
| ulEnclosureNumber | DWORD | 4 | +56 | +48 | ドライブを格納しているエンクロージャーの番号です。ULONG_MAX の値は、この番号がそのドライブに対して定義されていないことを示します。エンクロージャーの番号付けの方式には 0 から始まるものがあるため、0 はこのメンバーの有効な値です。このメンバーは IVdsSubSystem2::GetDrive2 メソッドの ulEnclosureNumber パラメーターに対応します。 |
| busType | VDS_STORAGE_BUS_TYPE | 4 | +60 | +52 | ドライブのバスの種類を指定する VDS_STORAGE_BUS_TYPE の値です。0 の場合は、バスの種類が不明であることを意味します。 |
| ulSpindleSpeed | DWORD | 4 | +64 | +56 | ドライブのスピンドル速度 (RPM 単位)。このメンバーの既定値は 0 です。0 の場合は、スピンドル速度が不明であることを意味します。1 の場合は、ドライブが回転する媒体を持たないことを意味します (たとえば、ソリッド ステート ドライブである可能性があります)。 - health.VDS_H_FAILED (8)- health.VDS_H_HEALTHY (1)- health.VDS_H_PENDING_FAILURE (10)- health.VDS_H_REPLACED (9)- health.VDS_H_UNKNOWN (0) |
公式ドキュメント
[Windows 8 および Windows Server 2012 以降、Virtual Disk Service COM インターフェイスは Windows Storage Management API に置き換えられています。]
ドライブ オブジェクトの プロパティを定義します。この構造体は VDS_DRIVE_PROP 構造体と同一ですが、エンクロージャー番号、バスの種類、およびスピンドル速度をメンバーとして含む点が異なります。
解説(Remarks)
この構造体は、IVdsDrive2::GetProperties2 メソッドがドライブ オブジェクトのプロパティを返すために使用されます。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// VDS_DRIVE_PROP2 (x64 72 / x86 64 バイト)
typedef struct VDS_DRIVE_PROP2 {
GUID id;
ULONGLONG ullSize;
LPWSTR pwszFriendlyName;
LPWSTR pwszIdentification;
DWORD ulFlags;
VDS_DRIVE_STATUS status;
VDS_HEALTH health;
SHORT sInternalBusNumber;
SHORT sSlotNumber;
DWORD ulEnclosureNumber;
VDS_STORAGE_BUS_TYPE busType;
DWORD ulSpindleSpeed;
} VDS_DRIVE_PROP2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_DRIVE_PROP2
{
public Guid id;
public ulong ullSize;
public IntPtr pwszFriendlyName;
public IntPtr pwszIdentification;
public uint ulFlags;
public int status;
public int health;
public short sInternalBusNumber;
public short sSlotNumber;
public uint ulEnclosureNumber;
public int busType;
public uint ulSpindleSpeed;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_DRIVE_PROP2
Public id As Guid
Public ullSize As ULong
Public pwszFriendlyName As IntPtr
Public pwszIdentification As IntPtr
Public ulFlags As UInteger
Public status As Integer
Public health As Integer
Public sInternalBusNumber As Short
Public sSlotNumber As Short
Public ulEnclosureNumber As UInteger
Public busType As Integer
Public ulSpindleSpeed As UInteger
End Structureimport ctypes
from ctypes import wintypes
class VDS_DRIVE_PROP2(ctypes.Structure):
_fields_ = [
("id", GUID),
("ullSize", ctypes.c_ulonglong),
("pwszFriendlyName", ctypes.c_void_p),
("pwszIdentification", ctypes.c_void_p),
("ulFlags", wintypes.DWORD),
("status", ctypes.c_int),
("health", ctypes.c_int),
("sInternalBusNumber", ctypes.c_short),
("sSlotNumber", ctypes.c_short),
("ulEnclosureNumber", wintypes.DWORD),
("busType", ctypes.c_int),
("ulSpindleSpeed", wintypes.DWORD),
]#[repr(C)]
pub struct VDS_DRIVE_PROP2 {
pub id: GUID,
pub ullSize: u64,
pub pwszFriendlyName: *mut core::ffi::c_void,
pub pwszIdentification: *mut core::ffi::c_void,
pub ulFlags: u32,
pub status: i32,
pub health: i32,
pub sInternalBusNumber: i16,
pub sSlotNumber: i16,
pub ulEnclosureNumber: u32,
pub busType: i32,
pub ulSpindleSpeed: u32,
}import "golang.org/x/sys/windows"
type VDS_DRIVE_PROP2 struct {
id windows.GUID
ullSize uint64
pwszFriendlyName uintptr
pwszIdentification uintptr
ulFlags uint32
status int32
health int32
sInternalBusNumber int16
sSlotNumber int16
ulEnclosureNumber uint32
busType int32
ulSpindleSpeed uint32
}type
VDS_DRIVE_PROP2 = record
id: TGUID;
ullSize: UInt64;
pwszFriendlyName: Pointer;
pwszIdentification: Pointer;
ulFlags: DWORD;
status: Integer;
health: Integer;
sInternalBusNumber: Smallint;
sSlotNumber: Smallint;
ulEnclosureNumber: DWORD;
busType: Integer;
ulSpindleSpeed: DWORD;
end;const VDS_DRIVE_PROP2 = extern struct {
id: GUID,
ullSize: u64,
pwszFriendlyName: ?*anyopaque,
pwszIdentification: ?*anyopaque,
ulFlags: u32,
status: i32,
health: i32,
sInternalBusNumber: i16,
sSlotNumber: i16,
ulEnclosureNumber: u32,
busType: i32,
ulSpindleSpeed: u32,
};type
VDS_DRIVE_PROP2 {.bycopy.} = object
id: GUID
ullSize: uint64
pwszFriendlyName: pointer
pwszIdentification: pointer
ulFlags: uint32
status: int32
health: int32
sInternalBusNumber: int16
sSlotNumber: int16
ulEnclosureNumber: uint32
busType: int32
ulSpindleSpeed: uint32struct VDS_DRIVE_PROP2
{
GUID id;
ulong ullSize;
void* pwszFriendlyName;
void* pwszIdentification;
uint ulFlags;
int status;
int health;
short sInternalBusNumber;
short sSlotNumber;
uint ulEnclosureNumber;
int busType;
uint ulSpindleSpeed;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VDS_DRIVE_PROP2 サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; id : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ullSize : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pwszFriendlyName : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; pwszIdentification : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ulFlags : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; status : VDS_DRIVE_STATUS (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; health : VDS_HEALTH (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; sInternalBusNumber : SHORT (+44, 2byte) wpoke st,44,値 / 値 = wpeek(st,44)
; sSlotNumber : SHORT (+46, 2byte) wpoke st,46,値 / 値 = wpeek(st,46)
; ulEnclosureNumber : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; busType : VDS_STORAGE_BUS_TYPE (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ulSpindleSpeed : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_DRIVE_PROP2 サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; id : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ullSize : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pwszFriendlyName : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pwszIdentification : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ulFlags : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; status : VDS_DRIVE_STATUS (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; health : VDS_HEALTH (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; sInternalBusNumber : SHORT (+52, 2byte) wpoke st,52,値 / 値 = wpeek(st,52)
; sSlotNumber : SHORT (+54, 2byte) wpoke st,54,値 / 値 = wpeek(st,54)
; ulEnclosureNumber : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; busType : VDS_STORAGE_BUS_TYPE (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; ulSpindleSpeed : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; ※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_DRIVE_PROP2
#field GUID id
#field int64 ullSize
#field intptr pwszFriendlyName
#field intptr pwszIdentification
#field int ulFlags
#field int status
#field int health
#field short sInternalBusNumber
#field short sSlotNumber
#field int ulEnclosureNumber
#field int busType
#field int ulSpindleSpeed
#endstruct
stdim st, VDS_DRIVE_PROP2 ; NSTRUCT 変数を確保
st->ullSize = 100
mes "ullSize=" + st->ullSize