ホーム › Storage.VirtualDiskService › VDS_PARTITION_INFO_MBR
VDS_PARTITION_INFO_MBR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| partitionType | BYTE | 1 | +0 | +0 | MBRパーティションの種類を示す1バイトのタイプコード。 |
| bootIndicator | BOOLEAN | 1 | +1 | +1 | 起動可能(アクティブ)パーティションか否かを示すBOOLEAN値。 |
| recognizedPartition | BOOLEAN | 1 | +2 | +2 | OSが認識可能なパーティションか否かを示すBOOLEAN値。 |
| hiddenSectors | DWORD | 4 | +4 | +4 | パーティション前の隠しセクター数。 |
各言語での定義
#include <windows.h>
// VDS_PARTITION_INFO_MBR (x64 8 / x86 8 バイト)
typedef struct VDS_PARTITION_INFO_MBR {
BYTE partitionType;
BOOLEAN bootIndicator;
BOOLEAN recognizedPartition;
DWORD hiddenSectors;
} VDS_PARTITION_INFO_MBR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_PARTITION_INFO_MBR
{
public byte partitionType;
[MarshalAs(UnmanagedType.U1)] public bool bootIndicator;
[MarshalAs(UnmanagedType.U1)] public bool recognizedPartition;
public uint hiddenSectors;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_PARTITION_INFO_MBR
Public partitionType As Byte
<MarshalAs(UnmanagedType.U1)> Public bootIndicator As Boolean
<MarshalAs(UnmanagedType.U1)> Public recognizedPartition As Boolean
Public hiddenSectors As UInteger
End Structureimport ctypes
from ctypes import wintypes
class VDS_PARTITION_INFO_MBR(ctypes.Structure):
_fields_ = [
("partitionType", ctypes.c_ubyte),
("bootIndicator", ctypes.c_byte),
("recognizedPartition", ctypes.c_byte),
("hiddenSectors", wintypes.DWORD),
]#[repr(C)]
pub struct VDS_PARTITION_INFO_MBR {
pub partitionType: u8,
pub bootIndicator: u8,
pub recognizedPartition: u8,
pub hiddenSectors: u32,
}import "golang.org/x/sys/windows"
type VDS_PARTITION_INFO_MBR struct {
partitionType byte
bootIndicator byte
recognizedPartition byte
hiddenSectors uint32
}type
VDS_PARTITION_INFO_MBR = record
partitionType: Byte;
bootIndicator: ByteBool;
recognizedPartition: ByteBool;
hiddenSectors: DWORD;
end;const VDS_PARTITION_INFO_MBR = extern struct {
partitionType: u8,
bootIndicator: u8,
recognizedPartition: u8,
hiddenSectors: u32,
};type
VDS_PARTITION_INFO_MBR {.bycopy.} = object
partitionType: uint8
bootIndicator: uint8
recognizedPartition: uint8
hiddenSectors: uint32struct VDS_PARTITION_INFO_MBR
{
ubyte partitionType;
ubyte bootIndicator;
ubyte recognizedPartition;
uint hiddenSectors;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_PARTITION_INFO_MBR サイズ: 8 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VDS_PARTITION_INFO_MBR
#field byte partitionType
#field bool1 bootIndicator
#field bool1 recognizedPartition
#field int hiddenSectors
#endstruct
stdim st, VDS_PARTITION_INFO_MBR ; NSTRUCT 変数を確保
st->partitionType = 100
mes "partitionType=" + st->partitionType