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

VDS_CREATE_VDISK_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
UniqueIdGUID16+0+0仮想ディスクに割り当てる一意の GUID 値です。
MaximumSizeULONGLONG8+16+16仮想ディスク オブジェクトの最大仮想サイズ (バイト単位) です。
BlockSizeInBytesDWORD4+24+24仮想ディスク オブジェクトの内部ブロック サイズ (バイト単位) です。
SectorSizeInBytesDWORD4+28+28仮想ディスク オブジェクトの内部セクター サイズ (バイト単位) です。
pParentPathLPWSTR8/4+32+32親仮想ディスク オブジェクトへの省略可能なパスを格納する NULL 終端のワイド文字列です。このメンバーは、新しい仮想ディスクを既存の仮想ディスクに関連付けます。
pSourcePathLPWSTR8/4+40+36新しい仮想ディスクにコピーするデータ ソースへの省略可能なパスを格納する NULL 終端のワイド文字列です。

公式ドキュメント

[Windows 8 および Windows Server 2012 以降、Virtual Disk Service COM インターフェイスは Windows Storage Management API に置き換えられています。]

仮想ディスクを作成するときに使用するパラメーターを格納します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// VDS_CREATE_VDISK_PARAMETERS  (x64 48 / x86 40 バイト)
typedef struct VDS_CREATE_VDISK_PARAMETERS {
    GUID UniqueId;
    ULONGLONG MaximumSize;
    DWORD BlockSizeInBytes;
    DWORD SectorSizeInBytes;
    LPWSTR pParentPath;
    LPWSTR pSourcePath;
} VDS_CREATE_VDISK_PARAMETERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_CREATE_VDISK_PARAMETERS
{
    public Guid UniqueId;
    public ulong MaximumSize;
    public uint BlockSizeInBytes;
    public uint SectorSizeInBytes;
    public IntPtr pParentPath;
    public IntPtr pSourcePath;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_CREATE_VDISK_PARAMETERS
    Public UniqueId As Guid
    Public MaximumSize As ULong
    Public BlockSizeInBytes As UInteger
    Public SectorSizeInBytes As UInteger
    Public pParentPath As IntPtr
    Public pSourcePath As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class VDS_CREATE_VDISK_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("UniqueId", GUID),
        ("MaximumSize", ctypes.c_ulonglong),
        ("BlockSizeInBytes", wintypes.DWORD),
        ("SectorSizeInBytes", wintypes.DWORD),
        ("pParentPath", ctypes.c_void_p),
        ("pSourcePath", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct VDS_CREATE_VDISK_PARAMETERS {
    pub UniqueId: GUID,
    pub MaximumSize: u64,
    pub BlockSizeInBytes: u32,
    pub SectorSizeInBytes: u32,
    pub pParentPath: *mut core::ffi::c_void,
    pub pSourcePath: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type VDS_CREATE_VDISK_PARAMETERS struct {
	UniqueId windows.GUID
	MaximumSize uint64
	BlockSizeInBytes uint32
	SectorSizeInBytes uint32
	pParentPath uintptr
	pSourcePath uintptr
}
type
  VDS_CREATE_VDISK_PARAMETERS = record
    UniqueId: TGUID;
    MaximumSize: UInt64;
    BlockSizeInBytes: DWORD;
    SectorSizeInBytes: DWORD;
    pParentPath: Pointer;
    pSourcePath: Pointer;
  end;
const VDS_CREATE_VDISK_PARAMETERS = extern struct {
    UniqueId: GUID,
    MaximumSize: u64,
    BlockSizeInBytes: u32,
    SectorSizeInBytes: u32,
    pParentPath: ?*anyopaque,
    pSourcePath: ?*anyopaque,
};
type
  VDS_CREATE_VDISK_PARAMETERS {.bycopy.} = object
    UniqueId: GUID
    MaximumSize: uint64
    BlockSizeInBytes: uint32
    SectorSizeInBytes: uint32
    pParentPath: pointer
    pSourcePath: pointer
struct VDS_CREATE_VDISK_PARAMETERS
{
    GUID UniqueId;
    ulong MaximumSize;
    uint BlockSizeInBytes;
    uint SectorSizeInBytes;
    void* pParentPath;
    void* pSourcePath;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VDS_CREATE_VDISK_PARAMETERS サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; UniqueId : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; MaximumSize : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; BlockSizeInBytes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; SectorSizeInBytes : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; pParentPath : LPWSTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; pSourcePath : LPWSTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_CREATE_VDISK_PARAMETERS サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; UniqueId : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; MaximumSize : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; BlockSizeInBytes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; SectorSizeInBytes : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; pParentPath : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pSourcePath : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※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_CREATE_VDISK_PARAMETERS
    #field GUID UniqueId
    #field int64 MaximumSize
    #field int BlockSizeInBytes
    #field int SectorSizeInBytes
    #field intptr pParentPath
    #field intptr pSourcePath
#endstruct

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