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

VDS_PARTITION_INFORMATION_EX

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

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

フィールド

フィールドサイズx64x86説明
dwPartitionStyle__VDS_PARTITION_STYLE4+0+0パーティション形式を示す__VDS_PARTITION_STYLE列挙値。
ullStartingOffsetULONGLONG8+8+8パーティションの開始オフセットをバイト単位で示す。
ullPartitionLengthULONGLONG8+16+16パーティションの長さをバイト単位で示す。
dwPartitionNumberDWORD4+24+24パーティション番号(1始まり)。
bRewritePartitionBOOLEAN1+28+28パーティションエントリを書き換えるか否かを示すBOOLEAN値。
Anonymous_Anonymous_e__Union112+32+32形式に応じたMBR/GPT固有情報を格納する無名共用体。

共用体: _Anonymous_e__Union x64 112B / x86 112B

フィールドサイズx64x86
MbrVDS_PARTITION_INFO_MBR8+0+0
GptVDS_PARTITION_INFO_GPT112+0+0

各言語での定義

#include <windows.h>

// VDS_PARTITION_INFORMATION_EX  (x64 144 / x86 144 バイト)
typedef struct VDS_PARTITION_INFORMATION_EX {
    __VDS_PARTITION_STYLE dwPartitionStyle;
    ULONGLONG ullStartingOffset;
    ULONGLONG ullPartitionLength;
    DWORD dwPartitionNumber;
    BOOLEAN bRewritePartition;
    _Anonymous_e__Union Anonymous;
} VDS_PARTITION_INFORMATION_EX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_PARTITION_INFORMATION_EX
{
    public int dwPartitionStyle;
    public ulong ullStartingOffset;
    public ulong ullPartitionLength;
    public uint dwPartitionNumber;
    [MarshalAs(UnmanagedType.U1)] public bool bRewritePartition;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_PARTITION_INFORMATION_EX
    Public dwPartitionStyle As Integer
    Public ullStartingOffset As ULong
    Public ullPartitionLength As ULong
    Public dwPartitionNumber As UInteger
    <MarshalAs(UnmanagedType.U1)> Public bRewritePartition As Boolean
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class VDS_PARTITION_INFORMATION_EX(ctypes.Structure):
    _fields_ = [
        ("dwPartitionStyle", ctypes.c_int),
        ("ullStartingOffset", ctypes.c_ulonglong),
        ("ullPartitionLength", ctypes.c_ulonglong),
        ("dwPartitionNumber", wintypes.DWORD),
        ("bRewritePartition", ctypes.c_byte),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct VDS_PARTITION_INFORMATION_EX {
    pub dwPartitionStyle: i32,
    pub ullStartingOffset: u64,
    pub ullPartitionLength: u64,
    pub dwPartitionNumber: u32,
    pub bRewritePartition: u8,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type VDS_PARTITION_INFORMATION_EX struct {
	dwPartitionStyle int32
	ullStartingOffset uint64
	ullPartitionLength uint64
	dwPartitionNumber uint32
	bRewritePartition byte
	Anonymous _Anonymous_e__Union
}
type
  VDS_PARTITION_INFORMATION_EX = record
    dwPartitionStyle: Integer;
    ullStartingOffset: UInt64;
    ullPartitionLength: UInt64;
    dwPartitionNumber: DWORD;
    bRewritePartition: ByteBool;
    Anonymous: _Anonymous_e__Union;
  end;
const VDS_PARTITION_INFORMATION_EX = extern struct {
    dwPartitionStyle: i32,
    ullStartingOffset: u64,
    ullPartitionLength: u64,
    dwPartitionNumber: u32,
    bRewritePartition: u8,
    Anonymous: _Anonymous_e__Union,
};
type
  VDS_PARTITION_INFORMATION_EX {.bycopy.} = object
    dwPartitionStyle: int32
    ullStartingOffset: uint64
    ullPartitionLength: uint64
    dwPartitionNumber: uint32
    bRewritePartition: uint8
    Anonymous: _Anonymous_e__Union
struct VDS_PARTITION_INFORMATION_EX
{
    int dwPartitionStyle;
    ulong ullStartingOffset;
    ulong ullPartitionLength;
    uint dwPartitionNumber;
    ubyte bRewritePartition;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_PARTITION_INFORMATION_EX サイズ: 144 バイト(x64)
dim st, 36    ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; dwPartitionStyle : __VDS_PARTITION_STYLE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ullStartingOffset : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ullPartitionLength : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwPartitionNumber : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; bRewritePartition : BOOLEAN (+28, 1byte)  poke st,28,値  /  値 = peek(st,28)
; Anonymous : _Anonymous_e__Union (+32, 112byte)  varptr(st)+32 を基点に操作(112byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VDS_PARTITION_INFORMATION_EX
    #field int dwPartitionStyle
    #field int64 ullStartingOffset
    #field int64 ullPartitionLength
    #field int dwPartitionNumber
    #field bool1 bRewritePartition
    #field byte Anonymous 112
#endstruct

stdim st, VDS_PARTITION_INFORMATION_EX        ; NSTRUCT 変数を確保
st->dwPartitionStyle = 100
mes "dwPartitionStyle=" + st->dwPartitionStyle
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。