ホーム › Networking.Clustering › CLUS_PARTITION_INFO_EX2
CLUS_PARTITION_INFO_EX2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| GptPartitionId | GUID | 16 | +0 | +0 | GPTパーティション固有のIDを示すGUIDである。 |
| szPartitionName | WCHAR | 520 | +16 | +16 | パーティション名を示すWCHAR固定長文字列である。 |
| EncryptionFlags | DWORD | 4 | +536 | +536 | ボリュームの暗号化状態を示すフラグである。BitLocker等の有効状態を表す。 |
各言語での定義
#include <windows.h>
// CLUS_PARTITION_INFO_EX2 (x64 540 / x86 540 バイト)
typedef struct CLUS_PARTITION_INFO_EX2 {
GUID GptPartitionId;
WCHAR szPartitionName[260];
DWORD EncryptionFlags;
} CLUS_PARTITION_INFO_EX2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLUS_PARTITION_INFO_EX2
{
public Guid GptPartitionId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szPartitionName;
public uint EncryptionFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLUS_PARTITION_INFO_EX2
Public GptPartitionId As Guid
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szPartitionName As String
Public EncryptionFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CLUS_PARTITION_INFO_EX2(ctypes.Structure):
_fields_ = [
("GptPartitionId", GUID),
("szPartitionName", ctypes.c_wchar * 260),
("EncryptionFlags", wintypes.DWORD),
]#[repr(C)]
pub struct CLUS_PARTITION_INFO_EX2 {
pub GptPartitionId: GUID,
pub szPartitionName: [u16; 260],
pub EncryptionFlags: u32,
}import "golang.org/x/sys/windows"
type CLUS_PARTITION_INFO_EX2 struct {
GptPartitionId windows.GUID
szPartitionName [260]uint16
EncryptionFlags uint32
}type
CLUS_PARTITION_INFO_EX2 = record
GptPartitionId: TGUID;
szPartitionName: array[0..259] of WideChar;
EncryptionFlags: DWORD;
end;const CLUS_PARTITION_INFO_EX2 = extern struct {
GptPartitionId: GUID,
szPartitionName: [260]u16,
EncryptionFlags: u32,
};type
CLUS_PARTITION_INFO_EX2 {.bycopy.} = object
GptPartitionId: GUID
szPartitionName: array[260, uint16]
EncryptionFlags: uint32struct CLUS_PARTITION_INFO_EX2
{
GUID GptPartitionId;
wchar[260] szPartitionName;
uint EncryptionFlags;
}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_EX2 サイズ: 540 バイト(x64)
dim st, 135 ; 4byte整数×135(構造体サイズ 540 / 4 切り上げ)
; GptPartitionId : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; szPartitionName : WCHAR (+16, 520byte) varptr(st)+16 を基点に操作(520byte:入れ子/配列)
; EncryptionFlags : DWORD (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; ※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_EX2
#field GUID GptPartitionId
#field wchar szPartitionName 260
#field int EncryptionFlags
#endstruct
stdim st, CLUS_PARTITION_INFO_EX2 ; NSTRUCT 変数を確保
st->EncryptionFlags = 100
mes "EncryptionFlags=" + st->EncryptionFlags