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

CDROM_TOC_ATIP_DATA_BLOCK

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

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

フィールド

フィールドサイズx64x86説明
_bitfield1BYTE1+0+0ATIP情報の第1ビットフィールド。書込パワー等の属性を含む。
_bitfield2BYTE1+1+1ATIP情報の第2ビットフィールド。リファレンス速度等を含む。
_bitfield3BYTE1+2+2ATIP情報の第3ビットフィールド。追加属性を含む。
Reserved7BYTE1+3+3予約フィールド。0を設定する。
LeadInMsfBYTE3+4+4リードイン領域開始位置のMSFを保持する3バイト配列。
Reserved8BYTE1+7+7予約フィールド。0を設定する。
LeadOutMsfBYTE3+8+8リードアウト領域開始位置のMSFを保持する3バイト配列。
Reserved9BYTE1+11+11予約フィールド。0を設定する。
A1ValuesBYTE3+12+12メーカー固有のA1値を保持する3バイト配列。
Reserved10BYTE1+15+15予約フィールド。0を設定する。
A2ValuesBYTE3+16+16メーカー固有のA2値を保持する3バイト配列。
Reserved11BYTE1+19+19予約フィールド。0を設定する。
A3ValuesBYTE3+20+20メーカー固有のA3値を保持する3バイト配列。
Reserved12BYTE1+23+23予約フィールド。0を設定する。

各言語での定義

#include <windows.h>

// CDROM_TOC_ATIP_DATA_BLOCK  (x64 24 / x86 24 バイト)
typedef struct CDROM_TOC_ATIP_DATA_BLOCK {
    BYTE _bitfield1;
    BYTE _bitfield2;
    BYTE _bitfield3;
    BYTE Reserved7;
    BYTE LeadInMsf[3];
    BYTE Reserved8;
    BYTE LeadOutMsf[3];
    BYTE Reserved9;
    BYTE A1Values[3];
    BYTE Reserved10;
    BYTE A2Values[3];
    BYTE Reserved11;
    BYTE A3Values[3];
    BYTE Reserved12;
} CDROM_TOC_ATIP_DATA_BLOCK;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CDROM_TOC_ATIP_DATA_BLOCK
{
    public byte _bitfield1;
    public byte _bitfield2;
    public byte _bitfield3;
    public byte Reserved7;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] LeadInMsf;
    public byte Reserved8;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] LeadOutMsf;
    public byte Reserved9;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] A1Values;
    public byte Reserved10;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] A2Values;
    public byte Reserved11;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] A3Values;
    public byte Reserved12;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CDROM_TOC_ATIP_DATA_BLOCK
    Public _bitfield1 As Byte
    Public _bitfield2 As Byte
    Public _bitfield3 As Byte
    Public Reserved7 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public LeadInMsf() As Byte
    Public Reserved8 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public LeadOutMsf() As Byte
    Public Reserved9 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public A1Values() As Byte
    Public Reserved10 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public A2Values() As Byte
    Public Reserved11 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public A3Values() As Byte
    Public Reserved12 As Byte
End Structure
import ctypes
from ctypes import wintypes

class CDROM_TOC_ATIP_DATA_BLOCK(ctypes.Structure):
    _fields_ = [
        ("_bitfield1", ctypes.c_ubyte),
        ("_bitfield2", ctypes.c_ubyte),
        ("_bitfield3", ctypes.c_ubyte),
        ("Reserved7", ctypes.c_ubyte),
        ("LeadInMsf", ctypes.c_ubyte * 3),
        ("Reserved8", ctypes.c_ubyte),
        ("LeadOutMsf", ctypes.c_ubyte * 3),
        ("Reserved9", ctypes.c_ubyte),
        ("A1Values", ctypes.c_ubyte * 3),
        ("Reserved10", ctypes.c_ubyte),
        ("A2Values", ctypes.c_ubyte * 3),
        ("Reserved11", ctypes.c_ubyte),
        ("A3Values", ctypes.c_ubyte * 3),
        ("Reserved12", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct CDROM_TOC_ATIP_DATA_BLOCK {
    pub _bitfield1: u8,
    pub _bitfield2: u8,
    pub _bitfield3: u8,
    pub Reserved7: u8,
    pub LeadInMsf: [u8; 3],
    pub Reserved8: u8,
    pub LeadOutMsf: [u8; 3],
    pub Reserved9: u8,
    pub A1Values: [u8; 3],
    pub Reserved10: u8,
    pub A2Values: [u8; 3],
    pub Reserved11: u8,
    pub A3Values: [u8; 3],
    pub Reserved12: u8,
}
import "golang.org/x/sys/windows"

type CDROM_TOC_ATIP_DATA_BLOCK struct {
	_bitfield1 byte
	_bitfield2 byte
	_bitfield3 byte
	Reserved7 byte
	LeadInMsf [3]byte
	Reserved8 byte
	LeadOutMsf [3]byte
	Reserved9 byte
	A1Values [3]byte
	Reserved10 byte
	A2Values [3]byte
	Reserved11 byte
	A3Values [3]byte
	Reserved12 byte
}
type
  CDROM_TOC_ATIP_DATA_BLOCK = record
    _bitfield1: Byte;
    _bitfield2: Byte;
    _bitfield3: Byte;
    Reserved7: Byte;
    LeadInMsf: array[0..2] of Byte;
    Reserved8: Byte;
    LeadOutMsf: array[0..2] of Byte;
    Reserved9: Byte;
    A1Values: array[0..2] of Byte;
    Reserved10: Byte;
    A2Values: array[0..2] of Byte;
    Reserved11: Byte;
    A3Values: array[0..2] of Byte;
    Reserved12: Byte;
  end;
const CDROM_TOC_ATIP_DATA_BLOCK = extern struct {
    _bitfield1: u8,
    _bitfield2: u8,
    _bitfield3: u8,
    Reserved7: u8,
    LeadInMsf: [3]u8,
    Reserved8: u8,
    LeadOutMsf: [3]u8,
    Reserved9: u8,
    A1Values: [3]u8,
    Reserved10: u8,
    A2Values: [3]u8,
    Reserved11: u8,
    A3Values: [3]u8,
    Reserved12: u8,
};
type
  CDROM_TOC_ATIP_DATA_BLOCK {.bycopy.} = object
    _bitfield1: uint8
    _bitfield2: uint8
    _bitfield3: uint8
    Reserved7: uint8
    LeadInMsf: array[3, uint8]
    Reserved8: uint8
    LeadOutMsf: array[3, uint8]
    Reserved9: uint8
    A1Values: array[3, uint8]
    Reserved10: uint8
    A2Values: array[3, uint8]
    Reserved11: uint8
    A3Values: array[3, uint8]
    Reserved12: uint8
struct CDROM_TOC_ATIP_DATA_BLOCK
{
    ubyte _bitfield1;
    ubyte _bitfield2;
    ubyte _bitfield3;
    ubyte Reserved7;
    ubyte[3] LeadInMsf;
    ubyte Reserved8;
    ubyte[3] LeadOutMsf;
    ubyte Reserved9;
    ubyte[3] A1Values;
    ubyte Reserved10;
    ubyte[3] A2Values;
    ubyte Reserved11;
    ubyte[3] A3Values;
    ubyte Reserved12;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CDROM_TOC_ATIP_DATA_BLOCK サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; _bitfield1 : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; _bitfield2 : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; _bitfield3 : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Reserved7 : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; LeadInMsf : BYTE (+4, 3byte)  varptr(st)+4 を基点に操作(3byte:入れ子/配列)
; Reserved8 : BYTE (+7, 1byte)  poke st,7,値  /  値 = peek(st,7)
; LeadOutMsf : BYTE (+8, 3byte)  varptr(st)+8 を基点に操作(3byte:入れ子/配列)
; Reserved9 : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; A1Values : BYTE (+12, 3byte)  varptr(st)+12 を基点に操作(3byte:入れ子/配列)
; Reserved10 : BYTE (+15, 1byte)  poke st,15,値  /  値 = peek(st,15)
; A2Values : BYTE (+16, 3byte)  varptr(st)+16 を基点に操作(3byte:入れ子/配列)
; Reserved11 : BYTE (+19, 1byte)  poke st,19,値  /  値 = peek(st,19)
; A3Values : BYTE (+20, 3byte)  varptr(st)+20 を基点に操作(3byte:入れ子/配列)
; Reserved12 : BYTE (+23, 1byte)  poke st,23,値  /  値 = peek(st,23)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CDROM_TOC_ATIP_DATA_BLOCK
    #field byte _bitfield1
    #field byte _bitfield2
    #field byte _bitfield3
    #field byte Reserved7
    #field byte LeadInMsf 3
    #field byte Reserved8
    #field byte LeadOutMsf 3
    #field byte Reserved9
    #field byte A1Values 3
    #field byte Reserved10
    #field byte A2Values 3
    #field byte Reserved11
    #field byte A3Values 3
    #field byte Reserved12
#endstruct

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