ホーム › Networking.Clustering › CLUS_PARTITION_INFO
CLUS_PARTITION_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwFlags | DWORD | 4 | +0 | +0 | パーティション属性を示すフラグである。CLUSPROP_PIFLAG_*等のビット組み合わせで使用可否を表す。 |
| szDeviceName | WCHAR | 520 | +4 | +4 | ドライブ文字やマウントパス等のデバイス名である。WCHAR固定長文字列で格納する。 |
| szVolumeLabel | WCHAR | 520 | +524 | +524 | ボリュームラベル文字列である。WCHAR固定長で格納する。 |
| dwSerialNumber | DWORD | 4 | +1044 | +1044 | ボリュームのシリアル番号である。フォーマット時に割り当てられる。 |
| rgdwMaximumComponentLength | DWORD | 4 | +1048 | +1048 | ファイルシステムが許容するパス構成要素の最大文字数である。 |
| dwFileSystemFlags | DWORD | 4 | +1052 | +1052 | ファイルシステムの機能フラグである。FILE_*属性のビット集合を保持する。 |
| szFileSystem | WCHAR | 64 | +1056 | +1056 | ファイルシステム名(NTFS等)を示すWCHAR固定長文字列である。 |
各言語での定義
#include <windows.h>
// CLUS_PARTITION_INFO (x64 1120 / x86 1120 バイト)
typedef struct CLUS_PARTITION_INFO {
DWORD dwFlags;
WCHAR szDeviceName[260];
WCHAR szVolumeLabel[260];
DWORD dwSerialNumber;
DWORD rgdwMaximumComponentLength;
DWORD dwFileSystemFlags;
WCHAR szFileSystem[32];
} CLUS_PARTITION_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUS_PARTITION_INFO
{
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;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUS_PARTITION_INFO
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
End Structureimport ctypes
from ctypes import wintypes
class CLUS_PARTITION_INFO(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),
]#[repr(C)]
pub struct CLUS_PARTITION_INFO {
pub dwFlags: u32,
pub szDeviceName: [u16; 260],
pub szVolumeLabel: [u16; 260],
pub dwSerialNumber: u32,
pub rgdwMaximumComponentLength: u32,
pub dwFileSystemFlags: u32,
pub szFileSystem: [u16; 32],
}import "golang.org/x/sys/windows"
type CLUS_PARTITION_INFO struct {
dwFlags uint32
szDeviceName [260]uint16
szVolumeLabel [260]uint16
dwSerialNumber uint32
rgdwMaximumComponentLength uint32
dwFileSystemFlags uint32
szFileSystem [32]uint16
}type
CLUS_PARTITION_INFO = 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;
end;const CLUS_PARTITION_INFO = extern struct {
dwFlags: u32,
szDeviceName: [260]u16,
szVolumeLabel: [260]u16,
dwSerialNumber: u32,
rgdwMaximumComponentLength: u32,
dwFileSystemFlags: u32,
szFileSystem: [32]u16,
};type
CLUS_PARTITION_INFO {.bycopy.} = object
dwFlags: uint32
szDeviceName: array[260, uint16]
szVolumeLabel: array[260, uint16]
dwSerialNumber: uint32
rgdwMaximumComponentLength: uint32
dwFileSystemFlags: uint32
szFileSystem: array[32, uint16]struct CLUS_PARTITION_INFO
{
uint dwFlags;
wchar[260] szDeviceName;
wchar[260] szVolumeLabel;
uint dwSerialNumber;
uint rgdwMaximumComponentLength;
uint dwFileSystemFlags;
wchar[32] szFileSystem;
}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 サイズ: 1120 バイト(x64)
dim st, 280 ; 4byte整数×280(構造体サイズ 1120 / 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:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CLUS_PARTITION_INFO
#field int dwFlags
#field wchar szDeviceName 260
#field wchar szVolumeLabel 260
#field int dwSerialNumber
#field int rgdwMaximumComponentLength
#field int dwFileSystemFlags
#field wchar szFileSystem 32
#endstruct
stdim st, CLUS_PARTITION_INFO ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags