ホーム › System.Ioctl › DISK_GEOMETRY
DISK_GEOMETRY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Cylinders | LONGLONG | 8 | +0 | +0 | ディスクのシリンダ数。 |
| MediaType | MEDIA_TYPE | 4 | +8 | +8 | メディアの種別を示す列挙値。 |
| TracksPerCylinder | DWORD | 4 | +12 | +12 | 1シリンダあたりのトラック数。 |
| SectorsPerTrack | DWORD | 4 | +16 | +16 | 1トラックあたりのセクタ数。 |
| BytesPerSector | DWORD | 4 | +20 | +20 | 1セクタあたりのバイト数。 |
各言語での定義
#include <windows.h>
// DISK_GEOMETRY (x64 24 / x86 24 バイト)
typedef struct DISK_GEOMETRY {
LONGLONG Cylinders;
MEDIA_TYPE MediaType;
DWORD TracksPerCylinder;
DWORD SectorsPerTrack;
DWORD BytesPerSector;
} DISK_GEOMETRY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISK_GEOMETRY
{
public long Cylinders;
public int MediaType;
public uint TracksPerCylinder;
public uint SectorsPerTrack;
public uint BytesPerSector;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISK_GEOMETRY
Public Cylinders As Long
Public MediaType As Integer
Public TracksPerCylinder As UInteger
Public SectorsPerTrack As UInteger
Public BytesPerSector As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DISK_GEOMETRY(ctypes.Structure):
_fields_ = [
("Cylinders", ctypes.c_longlong),
("MediaType", ctypes.c_int),
("TracksPerCylinder", wintypes.DWORD),
("SectorsPerTrack", wintypes.DWORD),
("BytesPerSector", wintypes.DWORD),
]#[repr(C)]
pub struct DISK_GEOMETRY {
pub Cylinders: i64,
pub MediaType: i32,
pub TracksPerCylinder: u32,
pub SectorsPerTrack: u32,
pub BytesPerSector: u32,
}import "golang.org/x/sys/windows"
type DISK_GEOMETRY struct {
Cylinders int64
MediaType int32
TracksPerCylinder uint32
SectorsPerTrack uint32
BytesPerSector uint32
}type
DISK_GEOMETRY = record
Cylinders: Int64;
MediaType: Integer;
TracksPerCylinder: DWORD;
SectorsPerTrack: DWORD;
BytesPerSector: DWORD;
end;const DISK_GEOMETRY = extern struct {
Cylinders: i64,
MediaType: i32,
TracksPerCylinder: u32,
SectorsPerTrack: u32,
BytesPerSector: u32,
};type
DISK_GEOMETRY {.bycopy.} = object
Cylinders: int64
MediaType: int32
TracksPerCylinder: uint32
SectorsPerTrack: uint32
BytesPerSector: uint32struct DISK_GEOMETRY
{
long Cylinders;
int MediaType;
uint TracksPerCylinder;
uint SectorsPerTrack;
uint BytesPerSector;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DISK_GEOMETRY サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Cylinders : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; MediaType : MEDIA_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; TracksPerCylinder : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; SectorsPerTrack : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; BytesPerSector : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DISK_GEOMETRY
#field int64 Cylinders
#field int MediaType
#field int TracksPerCylinder
#field int SectorsPerTrack
#field int BytesPerSector
#endstruct
stdim st, DISK_GEOMETRY ; NSTRUCT 変数を確保
st->Cylinders = 100
mes "Cylinders=" + st->Cylinders