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

VDS_VOLUME_PROP2

構造体
サイズx64: 72 バイト / x86: 64 バイト

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

フィールド

フィールドサイズx64x86説明
idGUID16+0+0ボリュームを一意に識別するGUID。
typeVDS_VOLUME_TYPE4+16+16ボリュームの種別を示すVDS_VOLUME_TYPE列挙値。
statusVDS_VOLUME_STATUS4+20+20ボリュームの状態を示すVDS_VOLUME_STATUS列挙値。
healthVDS_HEALTH4+24+24ボリュームの正常性を示すVDS_HEALTH列挙値。
TransitionStateVDS_TRANSITION_STATE4+28+28ボリュームの遷移状態を示すVDS_TRANSITION_STATE列挙値。
ullSizeULONGLONG8+32+32ボリュームの容量をバイト単位で示す。
ulFlagsDWORD4+40+40ボリュームの属性を示すVDS_VOLUME_FLAGビットフラグ。
RecommendedFileSystemTypeVDS_FILE_SYSTEM_TYPE4+44+44推奨されるファイルシステム種別を示すVDS_FILE_SYSTEM_TYPE列挙値。
cbUniqueIdDWORD4+48+48pUniqueId が指す一意IDのサイズをバイト単位で示す。
pwszNameLPWSTR8/4+56+52ボリュームの内部名を表すワイド文字列。
pUniqueIdBYTE*8/4+64+56ボリュームの一意な識別子バイト列へのポインター。

各言語での定義

#include <windows.h>

// VDS_VOLUME_PROP2  (x64 72 / x86 64 バイト)
typedef struct VDS_VOLUME_PROP2 {
    GUID id;
    VDS_VOLUME_TYPE type;
    VDS_VOLUME_STATUS status;
    VDS_HEALTH health;
    VDS_TRANSITION_STATE TransitionState;
    ULONGLONG ullSize;
    DWORD ulFlags;
    VDS_FILE_SYSTEM_TYPE RecommendedFileSystemType;
    DWORD cbUniqueId;
    LPWSTR pwszName;
    BYTE* pUniqueId;
} VDS_VOLUME_PROP2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_VOLUME_PROP2
{
    public Guid id;
    public int type;
    public int status;
    public int health;
    public int TransitionState;
    public ulong ullSize;
    public uint ulFlags;
    public int RecommendedFileSystemType;
    public uint cbUniqueId;
    public IntPtr pwszName;
    public IntPtr pUniqueId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_VOLUME_PROP2
    Public id As Guid
    Public type As Integer
    Public status As Integer
    Public health As Integer
    Public TransitionState As Integer
    Public ullSize As ULong
    Public ulFlags As UInteger
    Public RecommendedFileSystemType As Integer
    Public cbUniqueId As UInteger
    Public pwszName As IntPtr
    Public pUniqueId As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class VDS_VOLUME_PROP2(ctypes.Structure):
    _fields_ = [
        ("id", GUID),
        ("type", ctypes.c_int),
        ("status", ctypes.c_int),
        ("health", ctypes.c_int),
        ("TransitionState", ctypes.c_int),
        ("ullSize", ctypes.c_ulonglong),
        ("ulFlags", wintypes.DWORD),
        ("RecommendedFileSystemType", ctypes.c_int),
        ("cbUniqueId", wintypes.DWORD),
        ("pwszName", ctypes.c_void_p),
        ("pUniqueId", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct VDS_VOLUME_PROP2 {
    pub id: GUID,
    pub type: i32,
    pub status: i32,
    pub health: i32,
    pub TransitionState: i32,
    pub ullSize: u64,
    pub ulFlags: u32,
    pub RecommendedFileSystemType: i32,
    pub cbUniqueId: u32,
    pub pwszName: *mut core::ffi::c_void,
    pub pUniqueId: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type VDS_VOLUME_PROP2 struct {
	id windows.GUID
	type int32
	status int32
	health int32
	TransitionState int32
	ullSize uint64
	ulFlags uint32
	RecommendedFileSystemType int32
	cbUniqueId uint32
	pwszName uintptr
	pUniqueId uintptr
}
type
  VDS_VOLUME_PROP2 = record
    id: TGUID;
    type: Integer;
    status: Integer;
    health: Integer;
    TransitionState: Integer;
    ullSize: UInt64;
    ulFlags: DWORD;
    RecommendedFileSystemType: Integer;
    cbUniqueId: DWORD;
    pwszName: Pointer;
    pUniqueId: Pointer;
  end;
const VDS_VOLUME_PROP2 = extern struct {
    id: GUID,
    type: i32,
    status: i32,
    health: i32,
    TransitionState: i32,
    ullSize: u64,
    ulFlags: u32,
    RecommendedFileSystemType: i32,
    cbUniqueId: u32,
    pwszName: ?*anyopaque,
    pUniqueId: ?*anyopaque,
};
type
  VDS_VOLUME_PROP2 {.bycopy.} = object
    id: GUID
    type: int32
    status: int32
    health: int32
    TransitionState: int32
    ullSize: uint64
    ulFlags: uint32
    RecommendedFileSystemType: int32
    cbUniqueId: uint32
    pwszName: pointer
    pUniqueId: pointer
struct VDS_VOLUME_PROP2
{
    GUID id;
    int type;
    int status;
    int health;
    int TransitionState;
    ulong ullSize;
    uint ulFlags;
    int RecommendedFileSystemType;
    uint cbUniqueId;
    void* pwszName;
    void* pUniqueId;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VDS_VOLUME_PROP2 サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; type : VDS_VOLUME_TYPE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; status : VDS_VOLUME_STATUS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; health : VDS_HEALTH (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; TransitionState : VDS_TRANSITION_STATE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ullSize : ULONGLONG (+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 も可)
; RecommendedFileSystemType : VDS_FILE_SYSTEM_TYPE (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; cbUniqueId : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; pwszName : LPWSTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pUniqueId : BYTE* (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_VOLUME_PROP2 サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; type : VDS_VOLUME_TYPE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; status : VDS_VOLUME_STATUS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; health : VDS_HEALTH (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; TransitionState : VDS_TRANSITION_STATE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ullSize : ULONGLONG (+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 も可)
; RecommendedFileSystemType : VDS_FILE_SYSTEM_TYPE (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; cbUniqueId : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; pwszName : LPWSTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; pUniqueId : BYTE* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※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_VOLUME_PROP2
    #field GUID id
    #field int type
    #field int status
    #field int health
    #field int TransitionState
    #field int64 ullSize
    #field int ulFlags
    #field int RecommendedFileSystemType
    #field int cbUniqueId
    #field intptr pwszName
    #field intptr pUniqueId
#endstruct

stdim st, VDS_VOLUME_PROP2        ; NSTRUCT 変数を確保
st->type = 100
mes "type=" + st->type