Win32 API 日本語リファレンス
ホームNetworking.Clustering › CLUSPROP_PARTITION_INFO_EX

CLUSPROP_PARTITION_INFO_EX

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

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

フィールド

フィールドサイズx64x86説明
BaseCLUSPROP_VALUE8+0+0値ヘッダ(構文とデータ長)を表すCLUSPROP_VALUE。
Base2CLUS_PARTITION_INFO_EX1160+8+8拡張パーティション情報を表すCLUS_PARTITION_INFO_EX。

各言語での定義

#include <windows.h>

// CLUSPROP_SYNTAX  (x64 4 / x86 4 バイト)
typedef struct CLUSPROP_SYNTAX {
    DWORD dw;
    _Anonymous_e__Struct Anonymous;
} CLUSPROP_SYNTAX;

// CLUSPROP_VALUE  (x64 8 / x86 8 バイト)
typedef struct CLUSPROP_VALUE {
    CLUSPROP_SYNTAX Syntax;
    DWORD cbLength;
} CLUSPROP_VALUE;

// CLUS_PARTITION_INFO_EX  (x64 1160 / x86 1160 バイト)
typedef struct CLUS_PARTITION_INFO_EX {
    DWORD dwFlags;
    WCHAR szDeviceName[260];
    WCHAR szVolumeLabel[260];
    DWORD dwSerialNumber;
    DWORD rgdwMaximumComponentLength;
    DWORD dwFileSystemFlags;
    WCHAR szFileSystem[32];
    ULONGLONG TotalSizeInBytes;
    ULONGLONG FreeSizeInBytes;
    DWORD DeviceNumber;
    DWORD PartitionNumber;
    GUID VolumeGuid;
} CLUS_PARTITION_INFO_EX;

// CLUSPROP_PARTITION_INFO_EX  (x64 1168 / x86 1168 バイト)
typedef struct CLUSPROP_PARTITION_INFO_EX {
    CLUSPROP_VALUE Base;
    CLUS_PARTITION_INFO_EX Base2;
} CLUSPROP_PARTITION_INFO_EX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_SYNTAX
{
    public uint dw;
    public _Anonymous_e__Struct Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_VALUE
{
    public CLUSPROP_SYNTAX Syntax;
    public uint cbLength;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUS_PARTITION_INFO_EX
{
    public uint dwFlags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDeviceName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szVolumeLabel;
    public uint dwSerialNumber;
    public uint rgdwMaximumComponentLength;
    public uint dwFileSystemFlags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szFileSystem;
    public ulong TotalSizeInBytes;
    public ulong FreeSizeInBytes;
    public uint DeviceNumber;
    public uint PartitionNumber;
    public Guid VolumeGuid;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUSPROP_PARTITION_INFO_EX
{
    public CLUSPROP_VALUE Base;
    public CLUS_PARTITION_INFO_EX Base2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_SYNTAX
    Public dw As UInteger
    Public Anonymous As _Anonymous_e__Struct
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_VALUE
    Public Syntax As CLUSPROP_SYNTAX
    Public cbLength As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUS_PARTITION_INFO_EX
    Public dwFlags As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDeviceName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szVolumeLabel As String
    Public dwSerialNumber As UInteger
    Public rgdwMaximumComponentLength As UInteger
    Public dwFileSystemFlags As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public szFileSystem As String
    Public TotalSizeInBytes As ULong
    Public FreeSizeInBytes As ULong
    Public DeviceNumber As UInteger
    Public PartitionNumber As UInteger
    Public VolumeGuid As Guid
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUSPROP_PARTITION_INFO_EX
    Public Base As CLUSPROP_VALUE
    Public Base2 As CLUS_PARTITION_INFO_EX
End Structure
import ctypes
from ctypes import wintypes

class CLUSPROP_SYNTAX(ctypes.Structure):
    _fields_ = [
        ("dw", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Struct),
    ]

class CLUSPROP_VALUE(ctypes.Structure):
    _fields_ = [
        ("Syntax", CLUSPROP_SYNTAX),
        ("cbLength", wintypes.DWORD),
    ]

class CLUS_PARTITION_INFO_EX(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("szDeviceName", ctypes.c_wchar * 260),
        ("szVolumeLabel", ctypes.c_wchar * 260),
        ("dwSerialNumber", wintypes.DWORD),
        ("rgdwMaximumComponentLength", wintypes.DWORD),
        ("dwFileSystemFlags", wintypes.DWORD),
        ("szFileSystem", ctypes.c_wchar * 32),
        ("TotalSizeInBytes", ctypes.c_ulonglong),
        ("FreeSizeInBytes", ctypes.c_ulonglong),
        ("DeviceNumber", wintypes.DWORD),
        ("PartitionNumber", wintypes.DWORD),
        ("VolumeGuid", GUID),
    ]

class CLUSPROP_PARTITION_INFO_EX(ctypes.Structure):
    _fields_ = [
        ("Base", CLUSPROP_VALUE),
        ("Base2", CLUS_PARTITION_INFO_EX),
    ]
#[repr(C)]
pub struct CLUSPROP_SYNTAX {
    pub dw: u32,
    pub Anonymous: _Anonymous_e__Struct,
}

#[repr(C)]
pub struct CLUSPROP_VALUE {
    pub Syntax: CLUSPROP_SYNTAX,
    pub cbLength: u32,
}

#[repr(C)]
pub struct CLUS_PARTITION_INFO_EX {
    pub dwFlags: u32,
    pub szDeviceName: [u16; 260],
    pub szVolumeLabel: [u16; 260],
    pub dwSerialNumber: u32,
    pub rgdwMaximumComponentLength: u32,
    pub dwFileSystemFlags: u32,
    pub szFileSystem: [u16; 32],
    pub TotalSizeInBytes: u64,
    pub FreeSizeInBytes: u64,
    pub DeviceNumber: u32,
    pub PartitionNumber: u32,
    pub VolumeGuid: GUID,
}

#[repr(C)]
pub struct CLUSPROP_PARTITION_INFO_EX {
    pub Base: CLUSPROP_VALUE,
    pub Base2: CLUS_PARTITION_INFO_EX,
}
import "golang.org/x/sys/windows"

type CLUSPROP_SYNTAX struct {
	dw uint32
	Anonymous _Anonymous_e__Struct
}

type CLUSPROP_VALUE struct {
	Syntax CLUSPROP_SYNTAX
	cbLength uint32
}

type CLUS_PARTITION_INFO_EX struct {
	dwFlags uint32
	szDeviceName [260]uint16
	szVolumeLabel [260]uint16
	dwSerialNumber uint32
	rgdwMaximumComponentLength uint32
	dwFileSystemFlags uint32
	szFileSystem [32]uint16
	TotalSizeInBytes uint64
	FreeSizeInBytes uint64
	DeviceNumber uint32
	PartitionNumber uint32
	VolumeGuid windows.GUID
}

type CLUSPROP_PARTITION_INFO_EX struct {
	Base CLUSPROP_VALUE
	Base2 CLUS_PARTITION_INFO_EX
}
type
  CLUSPROP_SYNTAX = record
    dw: DWORD;
    Anonymous: _Anonymous_e__Struct;
  end;

  CLUSPROP_VALUE = record
    Syntax: CLUSPROP_SYNTAX;
    cbLength: DWORD;
  end;

  CLUS_PARTITION_INFO_EX = record
    dwFlags: DWORD;
    szDeviceName: array[0..259] of WideChar;
    szVolumeLabel: array[0..259] of WideChar;
    dwSerialNumber: DWORD;
    rgdwMaximumComponentLength: DWORD;
    dwFileSystemFlags: DWORD;
    szFileSystem: array[0..31] of WideChar;
    TotalSizeInBytes: UInt64;
    FreeSizeInBytes: UInt64;
    DeviceNumber: DWORD;
    PartitionNumber: DWORD;
    VolumeGuid: TGUID;
  end;

  CLUSPROP_PARTITION_INFO_EX = record
    Base: CLUSPROP_VALUE;
    Base2: CLUS_PARTITION_INFO_EX;
  end;
const CLUSPROP_SYNTAX = extern struct {
    dw: u32,
    Anonymous: _Anonymous_e__Struct,
};

const CLUSPROP_VALUE = extern struct {
    Syntax: CLUSPROP_SYNTAX,
    cbLength: u32,
};

const CLUS_PARTITION_INFO_EX = extern struct {
    dwFlags: u32,
    szDeviceName: [260]u16,
    szVolumeLabel: [260]u16,
    dwSerialNumber: u32,
    rgdwMaximumComponentLength: u32,
    dwFileSystemFlags: u32,
    szFileSystem: [32]u16,
    TotalSizeInBytes: u64,
    FreeSizeInBytes: u64,
    DeviceNumber: u32,
    PartitionNumber: u32,
    VolumeGuid: GUID,
};

const CLUSPROP_PARTITION_INFO_EX = extern struct {
    Base: CLUSPROP_VALUE,
    Base2: CLUS_PARTITION_INFO_EX,
};
type
  CLUSPROP_SYNTAX {.bycopy.} = object
    dw: uint32
    Anonymous: _Anonymous_e__Struct

  CLUSPROP_VALUE {.bycopy.} = object
    Syntax: CLUSPROP_SYNTAX
    cbLength: uint32

  CLUS_PARTITION_INFO_EX {.bycopy.} = object
    dwFlags: uint32
    szDeviceName: array[260, uint16]
    szVolumeLabel: array[260, uint16]
    dwSerialNumber: uint32
    rgdwMaximumComponentLength: uint32
    dwFileSystemFlags: uint32
    szFileSystem: array[32, uint16]
    TotalSizeInBytes: uint64
    FreeSizeInBytes: uint64
    DeviceNumber: uint32
    PartitionNumber: uint32
    VolumeGuid: GUID

  CLUSPROP_PARTITION_INFO_EX {.bycopy.} = object
    Base: CLUSPROP_VALUE
    Base2: CLUS_PARTITION_INFO_EX
struct CLUSPROP_SYNTAX
{
    uint dw;
    _Anonymous_e__Struct Anonymous;
}

struct CLUSPROP_VALUE
{
    CLUSPROP_SYNTAX Syntax;
    uint cbLength;
}

struct CLUS_PARTITION_INFO_EX
{
    uint dwFlags;
    wchar[260] szDeviceName;
    wchar[260] szVolumeLabel;
    uint dwSerialNumber;
    uint rgdwMaximumComponentLength;
    uint dwFileSystemFlags;
    wchar[32] szFileSystem;
    ulong TotalSizeInBytes;
    ulong FreeSizeInBytes;
    uint DeviceNumber;
    uint PartitionNumber;
    GUID VolumeGuid;
}

struct CLUSPROP_PARTITION_INFO_EX
{
    CLUSPROP_VALUE Base;
    CLUS_PARTITION_INFO_EX Base2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLUSPROP_PARTITION_INFO_EX サイズ: 1168 バイト(x64)
dim st, 292    ; 4byte整数×292(構造体サイズ 1168 / 4 切り上げ)
; Base : CLUSPROP_VALUE (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Base2 : CLUS_PARTITION_INFO_EX (+8, 1160byte)  varptr(st)+8 を基点に操作(1160byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CLUSPROP_VALUE
    #field byte Syntax 4
    #field int cbLength
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global CLUS_PARTITION_INFO_EX
    #field int dwFlags
    #field wchar szDeviceName 260
    #field wchar szVolumeLabel 260
    #field int dwSerialNumber
    #field int rgdwMaximumComponentLength
    #field int dwFileSystemFlags
    #field wchar szFileSystem 32
    #field int64 TotalSizeInBytes
    #field int64 FreeSizeInBytes
    #field int DeviceNumber
    #field int PartitionNumber
    #field GUID VolumeGuid
#endstruct

#defstruct global CLUSPROP_PARTITION_INFO_EX
    #field CLUSPROP_VALUE Base
    #field CLUS_PARTITION_INFO_EX Base2
#endstruct

stdim st, CLUSPROP_PARTITION_INFO_EX        ; NSTRUCT 変数を確保