Win32 API 日本語リファレンス
ホームSystem.Ioctl › STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY

STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
EntryLengthDWORD4+0+0このエントリの長さ(バイト)。
DependencyTypeFlagsDWORD4+4+4依存関係の種別を示すフラグ。
ProviderSpecificFlagsDWORD4+8+8ストレージプロバイダ固有のフラグ。
VirtualStorageTypeVIRTUAL_STORAGE_TYPE20+12+12仮想ストレージの種別(VHD/VHDX等)を示す構造体。
AncestorLevelDWORD4+32+32依存チェーンにおける祖先のレベル。
HostVolumeNameOffsetDWORD4+36+36ホストボリューム名へのオフセット(バイト)。
HostVolumeNameSizeDWORD4+40+40ホストボリューム名のサイズ(バイト)。
DependentVolumeNameOffsetDWORD4+44+44依存ボリューム名へのオフセット(バイト)。
DependentVolumeNameSizeDWORD4+48+48依存ボリューム名のサイズ(バイト)。
RelativePathOffsetDWORD4+52+52相対パスへのオフセット(バイト)。
RelativePathSizeDWORD4+56+56相対パスのサイズ(バイト)。
DependentDeviceNameOffsetDWORD4+60+60依存デバイス名へのオフセット(バイト)。
DependentDeviceNameSizeDWORD4+64+64依存デバイス名のサイズ(バイト)。

各言語での定義

#include <windows.h>

// VIRTUAL_STORAGE_TYPE  (x64 20 / x86 20 バイト)
typedef struct VIRTUAL_STORAGE_TYPE {
    DWORD DeviceId;
    GUID VendorId;
} VIRTUAL_STORAGE_TYPE;

// STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY  (x64 68 / x86 68 バイト)
typedef struct STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY {
    DWORD EntryLength;
    DWORD DependencyTypeFlags;
    DWORD ProviderSpecificFlags;
    VIRTUAL_STORAGE_TYPE VirtualStorageType;
    DWORD AncestorLevel;
    DWORD HostVolumeNameOffset;
    DWORD HostVolumeNameSize;
    DWORD DependentVolumeNameOffset;
    DWORD DependentVolumeNameSize;
    DWORD RelativePathOffset;
    DWORD RelativePathSize;
    DWORD DependentDeviceNameOffset;
    DWORD DependentDeviceNameSize;
} STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VIRTUAL_STORAGE_TYPE
{
    public uint DeviceId;
    public Guid VendorId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY
{
    public uint EntryLength;
    public uint DependencyTypeFlags;
    public uint ProviderSpecificFlags;
    public VIRTUAL_STORAGE_TYPE VirtualStorageType;
    public uint AncestorLevel;
    public uint HostVolumeNameOffset;
    public uint HostVolumeNameSize;
    public uint DependentVolumeNameOffset;
    public uint DependentVolumeNameSize;
    public uint RelativePathOffset;
    public uint RelativePathSize;
    public uint DependentDeviceNameOffset;
    public uint DependentDeviceNameSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VIRTUAL_STORAGE_TYPE
    Public DeviceId As UInteger
    Public VendorId As Guid
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY
    Public EntryLength As UInteger
    Public DependencyTypeFlags As UInteger
    Public ProviderSpecificFlags As UInteger
    Public VirtualStorageType As VIRTUAL_STORAGE_TYPE
    Public AncestorLevel As UInteger
    Public HostVolumeNameOffset As UInteger
    Public HostVolumeNameSize As UInteger
    Public DependentVolumeNameOffset As UInteger
    Public DependentVolumeNameSize As UInteger
    Public RelativePathOffset As UInteger
    Public RelativePathSize As UInteger
    Public DependentDeviceNameOffset As UInteger
    Public DependentDeviceNameSize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class VIRTUAL_STORAGE_TYPE(ctypes.Structure):
    _fields_ = [
        ("DeviceId", wintypes.DWORD),
        ("VendorId", GUID),
    ]

class STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY(ctypes.Structure):
    _fields_ = [
        ("EntryLength", wintypes.DWORD),
        ("DependencyTypeFlags", wintypes.DWORD),
        ("ProviderSpecificFlags", wintypes.DWORD),
        ("VirtualStorageType", VIRTUAL_STORAGE_TYPE),
        ("AncestorLevel", wintypes.DWORD),
        ("HostVolumeNameOffset", wintypes.DWORD),
        ("HostVolumeNameSize", wintypes.DWORD),
        ("DependentVolumeNameOffset", wintypes.DWORD),
        ("DependentVolumeNameSize", wintypes.DWORD),
        ("RelativePathOffset", wintypes.DWORD),
        ("RelativePathSize", wintypes.DWORD),
        ("DependentDeviceNameOffset", wintypes.DWORD),
        ("DependentDeviceNameSize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct VIRTUAL_STORAGE_TYPE {
    pub DeviceId: u32,
    pub VendorId: GUID,
}

#[repr(C)]
pub struct STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY {
    pub EntryLength: u32,
    pub DependencyTypeFlags: u32,
    pub ProviderSpecificFlags: u32,
    pub VirtualStorageType: VIRTUAL_STORAGE_TYPE,
    pub AncestorLevel: u32,
    pub HostVolumeNameOffset: u32,
    pub HostVolumeNameSize: u32,
    pub DependentVolumeNameOffset: u32,
    pub DependentVolumeNameSize: u32,
    pub RelativePathOffset: u32,
    pub RelativePathSize: u32,
    pub DependentDeviceNameOffset: u32,
    pub DependentDeviceNameSize: u32,
}
import "golang.org/x/sys/windows"

type VIRTUAL_STORAGE_TYPE struct {
	DeviceId uint32
	VendorId windows.GUID
}

type STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY struct {
	EntryLength uint32
	DependencyTypeFlags uint32
	ProviderSpecificFlags uint32
	VirtualStorageType VIRTUAL_STORAGE_TYPE
	AncestorLevel uint32
	HostVolumeNameOffset uint32
	HostVolumeNameSize uint32
	DependentVolumeNameOffset uint32
	DependentVolumeNameSize uint32
	RelativePathOffset uint32
	RelativePathSize uint32
	DependentDeviceNameOffset uint32
	DependentDeviceNameSize uint32
}
type
  VIRTUAL_STORAGE_TYPE = record
    DeviceId: DWORD;
    VendorId: TGUID;
  end;

  STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY = record
    EntryLength: DWORD;
    DependencyTypeFlags: DWORD;
    ProviderSpecificFlags: DWORD;
    VirtualStorageType: VIRTUAL_STORAGE_TYPE;
    AncestorLevel: DWORD;
    HostVolumeNameOffset: DWORD;
    HostVolumeNameSize: DWORD;
    DependentVolumeNameOffset: DWORD;
    DependentVolumeNameSize: DWORD;
    RelativePathOffset: DWORD;
    RelativePathSize: DWORD;
    DependentDeviceNameOffset: DWORD;
    DependentDeviceNameSize: DWORD;
  end;
const VIRTUAL_STORAGE_TYPE = extern struct {
    DeviceId: u32,
    VendorId: GUID,
};

const STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY = extern struct {
    EntryLength: u32,
    DependencyTypeFlags: u32,
    ProviderSpecificFlags: u32,
    VirtualStorageType: VIRTUAL_STORAGE_TYPE,
    AncestorLevel: u32,
    HostVolumeNameOffset: u32,
    HostVolumeNameSize: u32,
    DependentVolumeNameOffset: u32,
    DependentVolumeNameSize: u32,
    RelativePathOffset: u32,
    RelativePathSize: u32,
    DependentDeviceNameOffset: u32,
    DependentDeviceNameSize: u32,
};
type
  VIRTUAL_STORAGE_TYPE {.bycopy.} = object
    DeviceId: uint32
    VendorId: GUID

  STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY {.bycopy.} = object
    EntryLength: uint32
    DependencyTypeFlags: uint32
    ProviderSpecificFlags: uint32
    VirtualStorageType: VIRTUAL_STORAGE_TYPE
    AncestorLevel: uint32
    HostVolumeNameOffset: uint32
    HostVolumeNameSize: uint32
    DependentVolumeNameOffset: uint32
    DependentVolumeNameSize: uint32
    RelativePathOffset: uint32
    RelativePathSize: uint32
    DependentDeviceNameOffset: uint32
    DependentDeviceNameSize: uint32
struct VIRTUAL_STORAGE_TYPE
{
    uint DeviceId;
    GUID VendorId;
}

struct STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY
{
    uint EntryLength;
    uint DependencyTypeFlags;
    uint ProviderSpecificFlags;
    VIRTUAL_STORAGE_TYPE VirtualStorageType;
    uint AncestorLevel;
    uint HostVolumeNameOffset;
    uint HostVolumeNameSize;
    uint DependentVolumeNameOffset;
    uint DependentVolumeNameSize;
    uint RelativePathOffset;
    uint RelativePathSize;
    uint DependentDeviceNameOffset;
    uint DependentDeviceNameSize;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY サイズ: 68 バイト(x64)
dim st, 17    ; 4byte整数×17(構造体サイズ 68 / 4 切り上げ)
; EntryLength : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DependencyTypeFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ProviderSpecificFlags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; VirtualStorageType : VIRTUAL_STORAGE_TYPE (+12, 20byte)  varptr(st)+12 を基点に操作(20byte:入れ子/配列)
; AncestorLevel : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; HostVolumeNameOffset : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; HostVolumeNameSize : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; DependentVolumeNameOffset : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; DependentVolumeNameSize : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; RelativePathOffset : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; RelativePathSize : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; DependentDeviceNameOffset : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; DependentDeviceNameSize : 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 VIRTUAL_STORAGE_TYPE
    #field int DeviceId
    #field GUID VendorId
#endstruct

#defstruct global STORAGE_QUERY_DEPENDENT_VOLUME_LEV2_ENTRY
    #field int EntryLength
    #field int DependencyTypeFlags
    #field int ProviderSpecificFlags
    #field VIRTUAL_STORAGE_TYPE VirtualStorageType
    #field int AncestorLevel
    #field int HostVolumeNameOffset
    #field int HostVolumeNameSize
    #field int DependentVolumeNameOffset
    #field int DependentVolumeNameSize
    #field int RelativePathOffset
    #field int RelativePathSize
    #field int DependentDeviceNameOffset
    #field int DependentDeviceNameSize
#endstruct

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