ホーム › Storage.VirtualDiskService › VDS_DRIVE_PROP
VDS_DRIVE_PROP
構造体サイズ=各フィールドのバイト数(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 | ドライブのユーザー向け表示名を表すワイド文字列。 |
| pwszIdentification | LPWSTR | 8/4 | +32 | +28 | ドライブの識別文字列(ワイド文字)。 |
| ulFlags | DWORD | 4 | +40 | +32 | ドライブの属性を示すVDS_DRIVE_FLAGビットフラグ。 |
| status | VDS_DRIVE_STATUS | 4 | +44 | +36 | ドライブの状態を示すVDS_DRIVE_STATUS列挙値。 |
| health | VDS_HEALTH | 4 | +48 | +40 | ドライブの正常性を示すVDS_HEALTH列挙値。 |
| sInternalBusNumber | SHORT | 2 | +52 | +44 | ドライブが接続される内部バス番号を示す符号付き値。 |
| sSlotNumber | SHORT | 2 | +54 | +46 | ドライブが装着されるスロット番号を示す符号付き値。 |
各言語での定義
#include <windows.h>
// VDS_DRIVE_PROP (x64 56 / x86 48 バイト)
typedef struct VDS_DRIVE_PROP {
GUID id;
ULONGLONG ullSize;
LPWSTR pwszFriendlyName;
LPWSTR pwszIdentification;
DWORD ulFlags;
VDS_DRIVE_STATUS status;
VDS_HEALTH health;
SHORT sInternalBusNumber;
SHORT sSlotNumber;
} VDS_DRIVE_PROP;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_DRIVE_PROP
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_DRIVE_PROP
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
End Structureimport ctypes
from ctypes import wintypes
class VDS_DRIVE_PROP(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),
]#[repr(C)]
pub struct VDS_DRIVE_PROP {
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,
}import "golang.org/x/sys/windows"
type VDS_DRIVE_PROP struct {
id windows.GUID
ullSize uint64
pwszFriendlyName uintptr
pwszIdentification uintptr
ulFlags uint32
status int32
health int32
sInternalBusNumber int16
sSlotNumber int16
}type
VDS_DRIVE_PROP = record
id: TGUID;
ullSize: UInt64;
pwszFriendlyName: Pointer;
pwszIdentification: Pointer;
ulFlags: DWORD;
status: Integer;
health: Integer;
sInternalBusNumber: Smallint;
sSlotNumber: Smallint;
end;const VDS_DRIVE_PROP = extern struct {
id: GUID,
ullSize: u64,
pwszFriendlyName: ?*anyopaque,
pwszIdentification: ?*anyopaque,
ulFlags: u32,
status: i32,
health: i32,
sInternalBusNumber: i16,
sSlotNumber: i16,
};type
VDS_DRIVE_PROP {.bycopy.} = object
id: GUID
ullSize: uint64
pwszFriendlyName: pointer
pwszIdentification: pointer
ulFlags: uint32
status: int32
health: int32
sInternalBusNumber: int16
sSlotNumber: int16struct VDS_DRIVE_PROP
{
GUID id;
ulong ullSize;
void* pwszFriendlyName;
void* pwszIdentification;
uint ulFlags;
int status;
int health;
short sInternalBusNumber;
short sSlotNumber;
}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_PROP サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 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)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_DRIVE_PROP サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 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)
; ※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_PROP
#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
#endstruct
stdim st, VDS_DRIVE_PROP ; NSTRUCT 変数を確保
st->ullSize = 100
mes "ullSize=" + st->ullSize