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

CDROM_TOC_ATIP_DATA

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

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

フィールド

フィールドサイズx64x86説明
LengthBYTE2+0+0ATIPデータの長さをビッグエンディアン2バイトで示す。
Reserved1BYTE1+2+2予約フィールド。0を設定する。
Reserved2BYTE1+3+3予約フィールド。0を設定する。
DescriptorsCDROM_TOC_ATIP_DATA_BLOCK24+4+4ATIPの各エントリを保持するCDROM_TOC_ATIP_DATA_BLOCK配列。

各言語での定義

#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;

// CDROM_TOC_ATIP_DATA  (x64 28 / x86 28 バイト)
typedef struct CDROM_TOC_ATIP_DATA {
    BYTE Length[2];
    BYTE Reserved1;
    BYTE Reserved2;
    CDROM_TOC_ATIP_DATA_BLOCK Descriptors[1];
} CDROM_TOC_ATIP_DATA;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CDROM_TOC_ATIP_DATA
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Length;
    public byte Reserved1;
    public byte Reserved2;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public CDROM_TOC_ATIP_DATA_BLOCK[] Descriptors;
}
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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CDROM_TOC_ATIP_DATA
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Length() As Byte
    Public Reserved1 As Byte
    Public Reserved2 As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Descriptors() As CDROM_TOC_ATIP_DATA_BLOCK
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),
    ]

class CDROM_TOC_ATIP_DATA(ctypes.Structure):
    _fields_ = [
        ("Length", ctypes.c_ubyte * 2),
        ("Reserved1", ctypes.c_ubyte),
        ("Reserved2", ctypes.c_ubyte),
        ("Descriptors", CDROM_TOC_ATIP_DATA_BLOCK * 1),
    ]
#[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,
}

#[repr(C)]
pub struct CDROM_TOC_ATIP_DATA {
    pub Length: [u8; 2],
    pub Reserved1: u8,
    pub Reserved2: u8,
    pub Descriptors: [CDROM_TOC_ATIP_DATA_BLOCK; 1],
}
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 struct {
	Length [2]byte
	Reserved1 byte
	Reserved2 byte
	Descriptors [1]CDROM_TOC_ATIP_DATA_BLOCK
}
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;

  CDROM_TOC_ATIP_DATA = record
    Length: array[0..1] of Byte;
    Reserved1: Byte;
    Reserved2: Byte;
    Descriptors: array[0..0] of CDROM_TOC_ATIP_DATA_BLOCK;
  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,
};

const CDROM_TOC_ATIP_DATA = extern struct {
    Length: [2]u8,
    Reserved1: u8,
    Reserved2: u8,
    Descriptors: [1]CDROM_TOC_ATIP_DATA_BLOCK,
};
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

  CDROM_TOC_ATIP_DATA {.bycopy.} = object
    Length: array[2, uint8]
    Reserved1: uint8
    Reserved2: uint8
    Descriptors: array[1, CDROM_TOC_ATIP_DATA_BLOCK]
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;
}

struct CDROM_TOC_ATIP_DATA
{
    ubyte[2] Length;
    ubyte Reserved1;
    ubyte Reserved2;
    CDROM_TOC_ATIP_DATA_BLOCK[1] Descriptors;
}

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 サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; Length : BYTE (+0, 2byte)  varptr(st)+0 を基点に操作(2byte:入れ子/配列)
; Reserved1 : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Reserved2 : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; Descriptors : CDROM_TOC_ATIP_DATA_BLOCK (+4, 24byte)  varptr(st)+4 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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

#defstruct global CDROM_TOC_ATIP_DATA
    #field byte Length 2
    #field byte Reserved1
    #field byte Reserved2
    #field CDROM_TOC_ATIP_DATA_BLOCK Descriptors 1
#endstruct

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