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_PIFLAGS 列挙型で列挙されます。

CLUSPROP_PIFLAG_STICKY (1)

ドライブ文字が固定 (sticky) です。

CLUSPROP_PIFLAG_REMOVABLE (2)

ストレージ クラス リソースはリムーバブルです。

CLUSPROP_PIFLAG_USABLE (4)

ストレージ クラス リソースは、クラスター サービスが使用可能なファイル システムでフォーマットされています。

CLUSPROP_PIFLAG_DEFAULT_QUORUM (8)

SetClusterQuorumResource 関数でパーティションが指定されなかった場合、クォーラム ファイルの格納にこのパーティションを使用します。物理ディスク リソースの場合、50MB を超える最小の NTFS パーティションにこのフラグが自動的に設定されます。

szDeviceNameWCHAR520+4+4ストレージ クラス リソースのデバイス名です ("C:" など)。バックスラッシュは含まれません。
szVolumeLabelWCHAR520+524+524ストレージ クラス リソースのボリューム ラベルです。
dwSerialNumberDWORD4+1044+1044ストレージ クラス リソース ボリュームのシリアル番号です。
rgdwMaximumComponentLengthDWORD4+1048+1048指定されたファイル システムがサポートするファイル名コンポーネントの最大長 (文字数) です。ファイル名コンポーネントとは、ファイル名のうちバックスラッシュで区切られた部分を指します。
dwFileSystemFlagsDWORD4+1052+1052

ファイル システムを記述するフラグです。次のフラグのうち 1 つ以上を指定できます。

FS_CASE_SENSITIVE (1)

ファイル システムは大文字と小文字を区別するファイル名をサポートします。

FS_CASE_IS_PRESERVED (2)

ファイル システムは、ストレージ クラス リソースに名前を配置する際にファイル名の大文字と小文字を保持します。

FS_UNICODE_STORED_ON_DISK (4)

ファイル システムは、ストレージ クラス リソース上に格納されるファイル名での Unicode をサポートします。

FS_PERSISTENT_ACLS (8)

ファイル システムはアクセス制御リスト (ACL) を保持し、適用します。

szFileSystemWCHAR64+1056+1056ファイル システムの名前です ("FAT" や "NTFS" など)。
TotalSizeInBytesULONGLONG8+1120+1120ボリュームの合計サイズをバイト単位で指定します。この値は適切にアラインメントされていない場合があるため、UNALIGNED ポインターを使用してアクセスしてください。
FreeSizeInBytesULONGLONG8+1128+1128ボリューム上の未割り当て領域のサイズをバイト単位で指定します。この値は適切にアラインメントされていない場合があるため、UNALIGNED ポインターを使用してアクセスしてください。
DeviceNumberDWORD4+1136+1136デバイス番号です。
PartitionNumberDWORD4+1140+1140パーティション番号です。
VolumeGuidGUID16+1144+1144ボリュームに関連付けられたグローバル一意識別子 (GUID) です。

公式ドキュメント

ストレージ クラス リソースのボリュームとファイル システムを記述します。この構造体は CLUSPROP_PARTITION_INFO 構造体のデータ メンバーとして、また一部の制御コード操作の戻り値として使用されます。

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

各言語での定義

#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