ホーム › Storage.VirtualDiskService › VDS_DRIVE_LETTER_PROP
VDS_DRIVE_LETTER_PROP
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wcLetter | WCHAR | 2 | +0 | +0 | ドライブ文字(A〜Z)を表すワイド文字。 |
| volumeId | GUID | 16 | +4 | +4 | ドライブ文字が割り当てられたボリュームを識別するGUID。 |
| ulFlags | DWORD | 4 | +20 | +20 | ドライブ文字の属性を示すVDS_DRIVE_LETTER_FLAGビットフラグ。 |
| bUsed | BOOL | 4 | +24 | +24 | このドライブ文字が使用中か否かを示すBOOL値。 |
各言語での定義
#include <windows.h>
// VDS_DRIVE_LETTER_PROP (x64 28 / x86 28 バイト)
typedef struct VDS_DRIVE_LETTER_PROP {
WCHAR wcLetter;
GUID volumeId;
DWORD ulFlags;
BOOL bUsed;
} VDS_DRIVE_LETTER_PROP;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_DRIVE_LETTER_PROP
{
public char wcLetter;
public Guid volumeId;
public uint ulFlags;
[MarshalAs(UnmanagedType.Bool)] public bool bUsed;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_DRIVE_LETTER_PROP
Public wcLetter As Char
Public volumeId As Guid
Public ulFlags As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bUsed As Boolean
End Structureimport ctypes
from ctypes import wintypes
class VDS_DRIVE_LETTER_PROP(ctypes.Structure):
_fields_ = [
("wcLetter", ctypes.c_wchar),
("volumeId", GUID),
("ulFlags", wintypes.DWORD),
("bUsed", wintypes.BOOL),
]#[repr(C)]
pub struct VDS_DRIVE_LETTER_PROP {
pub wcLetter: u16,
pub volumeId: GUID,
pub ulFlags: u32,
pub bUsed: i32,
}import "golang.org/x/sys/windows"
type VDS_DRIVE_LETTER_PROP struct {
wcLetter uint16
volumeId windows.GUID
ulFlags uint32
bUsed int32
}type
VDS_DRIVE_LETTER_PROP = record
wcLetter: WideChar;
volumeId: TGUID;
ulFlags: DWORD;
bUsed: BOOL;
end;const VDS_DRIVE_LETTER_PROP = extern struct {
wcLetter: u16,
volumeId: GUID,
ulFlags: u32,
bUsed: i32,
};type
VDS_DRIVE_LETTER_PROP {.bycopy.} = object
wcLetter: uint16
volumeId: GUID
ulFlags: uint32
bUsed: int32struct VDS_DRIVE_LETTER_PROP
{
wchar wcLetter;
GUID volumeId;
uint ulFlags;
int bUsed;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_DRIVE_LETTER_PROP サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; wcLetter : WCHAR (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; volumeId : GUID (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; ulFlags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; bUsed : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (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_LETTER_PROP
#field short wcLetter
#field GUID volumeId
#field int ulFlags
#field bool bUsed
#endstruct
stdim st, VDS_DRIVE_LETTER_PROP ; NSTRUCT 変数を確保
st->wcLetter = 100
mes "wcLetter=" + st->wcLetter