Win32 API 日本語リファレンス
ホームSystem.Ioctl › DRIVE_LAYOUT_INFORMATION_MBR

DRIVE_LAYOUT_INFORMATION_MBR

構造体
サイズx64: 8 バイト / x86: 8 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
SignatureDWORD4+0+0MBRディスクのシグネチャ。
CheckSumDWORD4+4+4MBRのチェックサム値。

各言語での定義

#include <windows.h>

// DRIVE_LAYOUT_INFORMATION_MBR  (x64 8 / x86 8 バイト)
typedef struct DRIVE_LAYOUT_INFORMATION_MBR {
    DWORD Signature;
    DWORD CheckSum;
} DRIVE_LAYOUT_INFORMATION_MBR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DRIVE_LAYOUT_INFORMATION_MBR
{
    public uint Signature;
    public uint CheckSum;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DRIVE_LAYOUT_INFORMATION_MBR
    Public Signature As UInteger
    Public CheckSum As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DRIVE_LAYOUT_INFORMATION_MBR(ctypes.Structure):
    _fields_ = [
        ("Signature", wintypes.DWORD),
        ("CheckSum", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DRIVE_LAYOUT_INFORMATION_MBR {
    pub Signature: u32,
    pub CheckSum: u32,
}
import "golang.org/x/sys/windows"

type DRIVE_LAYOUT_INFORMATION_MBR struct {
	Signature uint32
	CheckSum uint32
}
type
  DRIVE_LAYOUT_INFORMATION_MBR = record
    Signature: DWORD;
    CheckSum: DWORD;
  end;
const DRIVE_LAYOUT_INFORMATION_MBR = extern struct {
    Signature: u32,
    CheckSum: u32,
};
type
  DRIVE_LAYOUT_INFORMATION_MBR {.bycopy.} = object
    Signature: uint32
    CheckSum: uint32
struct DRIVE_LAYOUT_INFORMATION_MBR
{
    uint Signature;
    uint CheckSum;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DRIVE_LAYOUT_INFORMATION_MBR サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; Signature : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; CheckSum : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DRIVE_LAYOUT_INFORMATION_MBR
    #field int Signature
    #field int CheckSum
#endstruct

stdim st, DRIVE_LAYOUT_INFORMATION_MBR        ; NSTRUCT 変数を確保
st->Signature = 100
mes "Signature=" + st->Signature