ホーム › System.SystemServices › TAPE_GET_MEDIA_PARAMETERS
TAPE_GET_MEDIA_PARAMETERS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Capacity | LONGLONG | 8 | +0 | +0 | メディアの総容量をバイト単位で示す。 |
| Remaining | LONGLONG | 8 | +8 | +8 | メディアの残り容量をバイト単位で示す。 |
| BlockSize | DWORD | 4 | +16 | +16 | 現在のブロックサイズ(バイト)。 |
| PartitionCount | DWORD | 4 | +20 | +20 | メディア上のパーティション数。 |
| WriteProtected | BOOLEAN | 1 | +24 | +24 | メディアが書き込み保護されているか否かを示す。 |
各言語での定義
#include <windows.h>
// TAPE_GET_MEDIA_PARAMETERS (x64 32 / x86 32 バイト)
typedef struct TAPE_GET_MEDIA_PARAMETERS {
LONGLONG Capacity;
LONGLONG Remaining;
DWORD BlockSize;
DWORD PartitionCount;
BOOLEAN WriteProtected;
} TAPE_GET_MEDIA_PARAMETERS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TAPE_GET_MEDIA_PARAMETERS
{
public long Capacity;
public long Remaining;
public uint BlockSize;
public uint PartitionCount;
[MarshalAs(UnmanagedType.U1)] public bool WriteProtected;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TAPE_GET_MEDIA_PARAMETERS
Public Capacity As Long
Public Remaining As Long
Public BlockSize As UInteger
Public PartitionCount As UInteger
<MarshalAs(UnmanagedType.U1)> Public WriteProtected As Boolean
End Structureimport ctypes
from ctypes import wintypes
class TAPE_GET_MEDIA_PARAMETERS(ctypes.Structure):
_fields_ = [
("Capacity", ctypes.c_longlong),
("Remaining", ctypes.c_longlong),
("BlockSize", wintypes.DWORD),
("PartitionCount", wintypes.DWORD),
("WriteProtected", ctypes.c_byte),
]#[repr(C)]
pub struct TAPE_GET_MEDIA_PARAMETERS {
pub Capacity: i64,
pub Remaining: i64,
pub BlockSize: u32,
pub PartitionCount: u32,
pub WriteProtected: u8,
}import "golang.org/x/sys/windows"
type TAPE_GET_MEDIA_PARAMETERS struct {
Capacity int64
Remaining int64
BlockSize uint32
PartitionCount uint32
WriteProtected byte
}type
TAPE_GET_MEDIA_PARAMETERS = record
Capacity: Int64;
Remaining: Int64;
BlockSize: DWORD;
PartitionCount: DWORD;
WriteProtected: ByteBool;
end;const TAPE_GET_MEDIA_PARAMETERS = extern struct {
Capacity: i64,
Remaining: i64,
BlockSize: u32,
PartitionCount: u32,
WriteProtected: u8,
};type
TAPE_GET_MEDIA_PARAMETERS {.bycopy.} = object
Capacity: int64
Remaining: int64
BlockSize: uint32
PartitionCount: uint32
WriteProtected: uint8struct TAPE_GET_MEDIA_PARAMETERS
{
long Capacity;
long Remaining;
uint BlockSize;
uint PartitionCount;
ubyte WriteProtected;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TAPE_GET_MEDIA_PARAMETERS サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Capacity : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Remaining : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; BlockSize : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; PartitionCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; WriteProtected : BOOLEAN (+24, 1byte) poke st,24,値 / 値 = peek(st,24)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TAPE_GET_MEDIA_PARAMETERS
#field int64 Capacity
#field int64 Remaining
#field int BlockSize
#field int PartitionCount
#field bool1 WriteProtected
#endstruct
stdim st, TAPE_GET_MEDIA_PARAMETERS ; NSTRUCT 変数を確保
st->Capacity = 100
mes "Capacity=" + st->Capacity