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

DISK_INT13_INFO

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

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

フィールド

フィールドサイズx64x86説明
DriveSelectWORD2+0+0INT13におけるドライブ選択値。
MaxCylindersDWORD4+4+4最大シリンダ数。
SectorsPerTrackWORD2+8+81トラックあたりのセクタ数。
MaxHeadsWORD2+10+10最大ヘッド数。
NumberDrivesWORD2+12+12ドライブ数。

各言語での定義

#include <windows.h>

// DISK_INT13_INFO  (x64 16 / x86 16 バイト)
typedef struct DISK_INT13_INFO {
    WORD DriveSelect;
    DWORD MaxCylinders;
    WORD SectorsPerTrack;
    WORD MaxHeads;
    WORD NumberDrives;
} DISK_INT13_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISK_INT13_INFO
{
    public ushort DriveSelect;
    public uint MaxCylinders;
    public ushort SectorsPerTrack;
    public ushort MaxHeads;
    public ushort NumberDrives;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISK_INT13_INFO
    Public DriveSelect As UShort
    Public MaxCylinders As UInteger
    Public SectorsPerTrack As UShort
    Public MaxHeads As UShort
    Public NumberDrives As UShort
End Structure
import ctypes
from ctypes import wintypes

class DISK_INT13_INFO(ctypes.Structure):
    _fields_ = [
        ("DriveSelect", ctypes.c_ushort),
        ("MaxCylinders", wintypes.DWORD),
        ("SectorsPerTrack", ctypes.c_ushort),
        ("MaxHeads", ctypes.c_ushort),
        ("NumberDrives", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct DISK_INT13_INFO {
    pub DriveSelect: u16,
    pub MaxCylinders: u32,
    pub SectorsPerTrack: u16,
    pub MaxHeads: u16,
    pub NumberDrives: u16,
}
import "golang.org/x/sys/windows"

type DISK_INT13_INFO struct {
	DriveSelect uint16
	MaxCylinders uint32
	SectorsPerTrack uint16
	MaxHeads uint16
	NumberDrives uint16
}
type
  DISK_INT13_INFO = record
    DriveSelect: Word;
    MaxCylinders: DWORD;
    SectorsPerTrack: Word;
    MaxHeads: Word;
    NumberDrives: Word;
  end;
const DISK_INT13_INFO = extern struct {
    DriveSelect: u16,
    MaxCylinders: u32,
    SectorsPerTrack: u16,
    MaxHeads: u16,
    NumberDrives: u16,
};
type
  DISK_INT13_INFO {.bycopy.} = object
    DriveSelect: uint16
    MaxCylinders: uint32
    SectorsPerTrack: uint16
    MaxHeads: uint16
    NumberDrives: uint16
struct DISK_INT13_INFO
{
    ushort DriveSelect;
    uint MaxCylinders;
    ushort SectorsPerTrack;
    ushort MaxHeads;
    ushort NumberDrives;
}

HSP用 定義

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

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

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