ホーム › System.Ioctl › PARTITION_INFORMATION_GPT
PARTITION_INFORMATION_GPT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PartitionType | GUID | 16 | +0 | +0 | GPTパーティション種別を示すGUID。 |
| PartitionId | GUID | 16 | +16 | +16 | パーティションを一意に識別するGUID。 |
| Attributes | GPT_ATTRIBUTES | 8 | +32 | +32 | パーティション属性を示すGPT_ATTRIBUTESフラグ。 |
| Name | WCHAR | 72 | +40 | +40 | パーティション名。NULL終端ワイド文字列。 |
各言語での定義
#include <windows.h>
// PARTITION_INFORMATION_GPT (x64 112 / x86 112 バイト)
typedef struct PARTITION_INFORMATION_GPT {
GUID PartitionType;
GUID PartitionId;
GPT_ATTRIBUTES Attributes;
WCHAR Name[36];
} PARTITION_INFORMATION_GPT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PARTITION_INFORMATION_GPT
{
public Guid PartitionType;
public Guid PartitionId;
public ulong Attributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)] public string Name;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PARTITION_INFORMATION_GPT
Public PartitionType As Guid
Public PartitionId As Guid
Public Attributes As ULong
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=36)> Public Name As String
End Structureimport ctypes
from ctypes import wintypes
class PARTITION_INFORMATION_GPT(ctypes.Structure):
_fields_ = [
("PartitionType", GUID),
("PartitionId", GUID),
("Attributes", ctypes.c_ulonglong),
("Name", ctypes.c_wchar * 36),
]#[repr(C)]
pub struct PARTITION_INFORMATION_GPT {
pub PartitionType: GUID,
pub PartitionId: GUID,
pub Attributes: u64,
pub Name: [u16; 36],
}import "golang.org/x/sys/windows"
type PARTITION_INFORMATION_GPT struct {
PartitionType windows.GUID
PartitionId windows.GUID
Attributes uint64
Name [36]uint16
}type
PARTITION_INFORMATION_GPT = record
PartitionType: TGUID;
PartitionId: TGUID;
Attributes: UInt64;
Name: array[0..35] of WideChar;
end;const PARTITION_INFORMATION_GPT = extern struct {
PartitionType: GUID,
PartitionId: GUID,
Attributes: u64,
Name: [36]u16,
};type
PARTITION_INFORMATION_GPT {.bycopy.} = object
PartitionType: GUID
PartitionId: GUID
Attributes: uint64
Name: array[36, uint16]struct PARTITION_INFORMATION_GPT
{
GUID PartitionType;
GUID PartitionId;
ulong Attributes;
wchar[36] Name;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PARTITION_INFORMATION_GPT サイズ: 112 バイト(x64)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; PartitionType : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; PartitionId : GUID (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; Attributes : GPT_ATTRIBUTES (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Name : WCHAR (+40, 72byte) varptr(st)+40 を基点に操作(72byte:入れ子/配列)
; ※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 PARTITION_INFORMATION_GPT
#field GUID PartitionType
#field GUID PartitionId
#field int64 Attributes
#field wchar Name 36
#endstruct
stdim st, PARTITION_INFORMATION_GPT ; NSTRUCT 変数を確保
st->Attributes = 100
mes "Attributes=" + st->Attributes