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

CLUS_PARTITION_INFO_EX

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0パーティション属性を示すフラグである。CLUSPROP_PIFLAG_*等のビット組み合わせを表す。
szDeviceNameWCHAR520+4+4ドライブ文字やマウントパス等のデバイス名である。WCHAR固定長文字列で格納する。
szVolumeLabelWCHAR520+524+524ボリュームラベル文字列である。WCHAR固定長で格納する。
dwSerialNumberDWORD4+1044+1044ボリュームのシリアル番号である。フォーマット時に割り当てられる。
rgdwMaximumComponentLengthDWORD4+1048+1048ファイルシステムが許容するパス構成要素の最大文字数である。
dwFileSystemFlagsDWORD4+1052+1052ファイルシステムの機能フラグである。FILE_*属性のビット集合を保持する。
szFileSystemWCHAR64+1056+1056ファイルシステム名(NTFS等)を示すWCHAR固定長文字列である。
TotalSizeInBytesULONGLONG8+1120+1120ボリューム総容量をバイト単位で示す64ビット値である。
FreeSizeInBytesULONGLONG8+1128+1128ボリュームの空き容量をバイト単位で示す64ビット値である。
DeviceNumberDWORD4+1136+1136物理ディスクのデバイス番号である。ディスクを一意に識別する。
PartitionNumberDWORD4+1140+1140ディスク内のパーティション番号である。1始まりで識別する。
VolumeGuidGUID16+1144+1144ボリュームを一意に識別するGUIDである。

各言語での定義

#include <windows.h>

// 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;
using System;
using System.Runtime.InteropServices;

[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;
}
Imports System.Runtime.InteropServices

<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
import ctypes
from ctypes import wintypes

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),
    ]
#[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,
}
import "golang.org/x/sys/windows"

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
  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;
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,
};
type
  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
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLUS_PARTITION_INFO_EX サイズ: 1160 バイト(x64)
dim st, 290    ; 4byte整数×290(構造体サイズ 1160 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; szDeviceName : WCHAR (+4, 520byte)  varptr(st)+4 を基点に操作(520byte:入れ子/配列)
; szVolumeLabel : WCHAR (+524, 520byte)  varptr(st)+524 を基点に操作(520byte:入れ子/配列)
; dwSerialNumber : DWORD (+1044, 4byte)  st.261 = 値  /  値 = st.261   (lpoke/lpeek も可)
; rgdwMaximumComponentLength : DWORD (+1048, 4byte)  st.262 = 値  /  値 = st.262   (lpoke/lpeek も可)
; dwFileSystemFlags : DWORD (+1052, 4byte)  st.263 = 値  /  値 = st.263   (lpoke/lpeek も可)
; szFileSystem : WCHAR (+1056, 64byte)  varptr(st)+1056 を基点に操作(64byte:入れ子/配列)
; TotalSizeInBytes : ULONGLONG (+1120, 8byte)  qpoke st,1120,値 / qpeek(st,1120)  ※IronHSPのみ。3.7/3.8は lpoke st,1120,下位 : lpoke st,1124,上位
; FreeSizeInBytes : ULONGLONG (+1128, 8byte)  qpoke st,1128,値 / qpeek(st,1128)  ※IronHSPのみ。3.7/3.8は lpoke st,1128,下位 : lpoke st,1132,上位
; DeviceNumber : DWORD (+1136, 4byte)  st.284 = 値  /  値 = st.284   (lpoke/lpeek も可)
; PartitionNumber : DWORD (+1140, 4byte)  st.285 = 値  /  値 = st.285   (lpoke/lpeek も可)
; VolumeGuid : GUID (+1144, 16byte)  varptr(st)+1144 を基点に操作(16byte:入れ子/配列)
; ※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 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

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