Win32 API 日本語リファレンス
ホームDevices.Dvd › DVD_RAM_SPARE_AREA_INFORMATION

DVD_RAM_SPARE_AREA_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
FreePrimarySpareSectorsBYTE4+0+0利用可能な一次スペアセクタ数を示すバイト配列。
FreeSupplementalSpareSectorsBYTE4+4+4利用可能な補助スペアセクタ数を示すバイト配列。
AllocatedSupplementalSpareSectorsBYTE4+8+8割り当て済み補助スペアセクタ数を示すバイト配列。

各言語での定義

#include <windows.h>

// DVD_RAM_SPARE_AREA_INFORMATION  (x64 12 / x86 12 バイト)
typedef struct DVD_RAM_SPARE_AREA_INFORMATION {
    BYTE FreePrimarySpareSectors[4];
    BYTE FreeSupplementalSpareSectors[4];
    BYTE AllocatedSupplementalSpareSectors[4];
} DVD_RAM_SPARE_AREA_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_RAM_SPARE_AREA_INFORMATION
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] FreePrimarySpareSectors;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] FreeSupplementalSpareSectors;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] AllocatedSupplementalSpareSectors;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_RAM_SPARE_AREA_INFORMATION
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public FreePrimarySpareSectors() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public FreeSupplementalSpareSectors() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public AllocatedSupplementalSpareSectors() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DVD_RAM_SPARE_AREA_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("FreePrimarySpareSectors", ctypes.c_ubyte * 4),
        ("FreeSupplementalSpareSectors", ctypes.c_ubyte * 4),
        ("AllocatedSupplementalSpareSectors", ctypes.c_ubyte * 4),
    ]
#[repr(C)]
pub struct DVD_RAM_SPARE_AREA_INFORMATION {
    pub FreePrimarySpareSectors: [u8; 4],
    pub FreeSupplementalSpareSectors: [u8; 4],
    pub AllocatedSupplementalSpareSectors: [u8; 4],
}
import "golang.org/x/sys/windows"

type DVD_RAM_SPARE_AREA_INFORMATION struct {
	FreePrimarySpareSectors [4]byte
	FreeSupplementalSpareSectors [4]byte
	AllocatedSupplementalSpareSectors [4]byte
}
type
  DVD_RAM_SPARE_AREA_INFORMATION = record
    FreePrimarySpareSectors: array[0..3] of Byte;
    FreeSupplementalSpareSectors: array[0..3] of Byte;
    AllocatedSupplementalSpareSectors: array[0..3] of Byte;
  end;
const DVD_RAM_SPARE_AREA_INFORMATION = extern struct {
    FreePrimarySpareSectors: [4]u8,
    FreeSupplementalSpareSectors: [4]u8,
    AllocatedSupplementalSpareSectors: [4]u8,
};
type
  DVD_RAM_SPARE_AREA_INFORMATION {.bycopy.} = object
    FreePrimarySpareSectors: array[4, uint8]
    FreeSupplementalSpareSectors: array[4, uint8]
    AllocatedSupplementalSpareSectors: array[4, uint8]
struct DVD_RAM_SPARE_AREA_INFORMATION
{
    ubyte[4] FreePrimarySpareSectors;
    ubyte[4] FreeSupplementalSpareSectors;
    ubyte[4] AllocatedSupplementalSpareSectors;
}

HSP用 定義

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

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

stdim st, DVD_RAM_SPARE_AREA_INFORMATION        ; NSTRUCT 変数を確保