ホーム › System.Ioctl › PARTITION_INFORMATION_MBR
PARTITION_INFORMATION_MBR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PartitionType | BYTE | 1 | +0 | +0 | パーティション種別を示すMBRタイプコード。 |
| BootIndicator | BOOLEAN | 1 | +1 | +1 | ブート可能パーティションかどうかを示す真偽値。 |
| RecognizedPartition | BOOLEAN | 1 | +2 | +2 | OSが認識可能なパーティションかどうかを示す真偽値。 |
| HiddenSectors | DWORD | 4 | +4 | +4 | パーティション前方の隠しセクタ数。 |
| PartitionId | GUID | 16 | +8 | +8 | パーティションを識別するGUID。 |
各言語での定義
#include <windows.h>
// PARTITION_INFORMATION_MBR (x64 24 / x86 24 バイト)
typedef struct PARTITION_INFORMATION_MBR {
BYTE PartitionType;
BOOLEAN BootIndicator;
BOOLEAN RecognizedPartition;
DWORD HiddenSectors;
GUID PartitionId;
} PARTITION_INFORMATION_MBR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PARTITION_INFORMATION_MBR
{
public byte PartitionType;
[MarshalAs(UnmanagedType.U1)] public bool BootIndicator;
[MarshalAs(UnmanagedType.U1)] public bool RecognizedPartition;
public uint HiddenSectors;
public Guid PartitionId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PARTITION_INFORMATION_MBR
Public PartitionType As Byte
<MarshalAs(UnmanagedType.U1)> Public BootIndicator As Boolean
<MarshalAs(UnmanagedType.U1)> Public RecognizedPartition As Boolean
Public HiddenSectors As UInteger
Public PartitionId As Guid
End Structureimport ctypes
from ctypes import wintypes
class PARTITION_INFORMATION_MBR(ctypes.Structure):
_fields_ = [
("PartitionType", ctypes.c_ubyte),
("BootIndicator", ctypes.c_byte),
("RecognizedPartition", ctypes.c_byte),
("HiddenSectors", wintypes.DWORD),
("PartitionId", GUID),
]#[repr(C)]
pub struct PARTITION_INFORMATION_MBR {
pub PartitionType: u8,
pub BootIndicator: u8,
pub RecognizedPartition: u8,
pub HiddenSectors: u32,
pub PartitionId: GUID,
}import "golang.org/x/sys/windows"
type PARTITION_INFORMATION_MBR struct {
PartitionType byte
BootIndicator byte
RecognizedPartition byte
HiddenSectors uint32
PartitionId windows.GUID
}type
PARTITION_INFORMATION_MBR = record
PartitionType: Byte;
BootIndicator: ByteBool;
RecognizedPartition: ByteBool;
HiddenSectors: DWORD;
PartitionId: TGUID;
end;const PARTITION_INFORMATION_MBR = extern struct {
PartitionType: u8,
BootIndicator: u8,
RecognizedPartition: u8,
HiddenSectors: u32,
PartitionId: GUID,
};type
PARTITION_INFORMATION_MBR {.bycopy.} = object
PartitionType: uint8
BootIndicator: uint8
RecognizedPartition: uint8
HiddenSectors: uint32
PartitionId: GUIDstruct PARTITION_INFORMATION_MBR
{
ubyte PartitionType;
ubyte BootIndicator;
ubyte RecognizedPartition;
uint HiddenSectors;
GUID PartitionId;
}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_MBR サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; PartitionType : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; BootIndicator : BOOLEAN (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; RecognizedPartition : BOOLEAN (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; HiddenSectors : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PartitionId : GUID (+8, 16byte) varptr(st)+8 を基点に操作(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 PARTITION_INFORMATION_MBR
#field byte PartitionType
#field bool1 BootIndicator
#field bool1 RecognizedPartition
#field int HiddenSectors
#field GUID PartitionId
#endstruct
stdim st, PARTITION_INFORMATION_MBR ; NSTRUCT 変数を確保
st->PartitionType = 100
mes "PartitionType=" + st->PartitionType