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

DVD_DISC_CONTROL_BLOCK_LIST

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

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

フィールド

フィールドサイズx64x86説明
headerDVD_DISC_CONTROL_BLOCK_HEADER48/40+0+0DCBの共通ヘッダを保持するDVD_DISC_CONTROL_BLOCK_HEADER。
Reserved0BYTE1+48+40予約領域。将来の拡張用で通常は0。
ReadabldDCBsBYTE1+49+41読み取り可能なDCBの数を示すバイト配列。綴りはreadableの意。
Reserved1BYTE1+50+42予約領域。将来の拡張用で通常は0。
WritableDCBsBYTE1+51+43書き込み可能なDCBの数を示すバイト配列。
DcbsDVD_DISC_CONTROL_BLOCK_LIST_DCB4+52+44DCBリストの各エントリを保持するDVD_DISC_CONTROL_BLOCK_LIST_DCB配列。

各言語での定義

#include <windows.h>

// DVD_DISC_CONTROL_BLOCK_HEADER  (x64 48 / x86 40 バイト)
typedef struct DVD_DISC_CONTROL_BLOCK_HEADER {
    BYTE ContentDescriptor[4];
    _ProhibitedActions_e__Union ProhibitedActions;
    BYTE VendorId[32];
} DVD_DISC_CONTROL_BLOCK_HEADER;

// DVD_DISC_CONTROL_BLOCK_LIST_DCB  (x64 4 / x86 4 バイト)
typedef struct DVD_DISC_CONTROL_BLOCK_LIST_DCB {
    BYTE DcbIdentifier[4];
} DVD_DISC_CONTROL_BLOCK_LIST_DCB;

// DVD_DISC_CONTROL_BLOCK_LIST  (x64 56 / x86 48 バイト)
typedef struct DVD_DISC_CONTROL_BLOCK_LIST {
    DVD_DISC_CONTROL_BLOCK_HEADER header;
    BYTE Reserved0;
    BYTE ReadabldDCBs;
    BYTE Reserved1;
    BYTE WritableDCBs;
    DVD_DISC_CONTROL_BLOCK_LIST_DCB Dcbs[1];
} DVD_DISC_CONTROL_BLOCK_LIST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_DISC_CONTROL_BLOCK_HEADER
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] ContentDescriptor;
    public _ProhibitedActions_e__Union ProhibitedActions;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] VendorId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_DISC_CONTROL_BLOCK_LIST_DCB
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] DcbIdentifier;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_DISC_CONTROL_BLOCK_LIST
{
    public DVD_DISC_CONTROL_BLOCK_HEADER header;
    public byte Reserved0;
    public byte ReadabldDCBs;
    public byte Reserved1;
    public byte WritableDCBs;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DVD_DISC_CONTROL_BLOCK_LIST_DCB[] Dcbs;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_DISC_CONTROL_BLOCK_HEADER
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public ContentDescriptor() As Byte
    Public ProhibitedActions As _ProhibitedActions_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public VendorId() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_DISC_CONTROL_BLOCK_LIST_DCB
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public DcbIdentifier() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_DISC_CONTROL_BLOCK_LIST
    Public header As DVD_DISC_CONTROL_BLOCK_HEADER
    Public Reserved0 As Byte
    Public ReadabldDCBs As Byte
    Public Reserved1 As Byte
    Public WritableDCBs As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Dcbs() As DVD_DISC_CONTROL_BLOCK_LIST_DCB
End Structure
import ctypes
from ctypes import wintypes

class DVD_DISC_CONTROL_BLOCK_HEADER(ctypes.Structure):
    _fields_ = [
        ("ContentDescriptor", ctypes.c_ubyte * 4),
        ("ProhibitedActions", _ProhibitedActions_e__Union),
        ("VendorId", ctypes.c_ubyte * 32),
    ]

class DVD_DISC_CONTROL_BLOCK_LIST_DCB(ctypes.Structure):
    _fields_ = [
        ("DcbIdentifier", ctypes.c_ubyte * 4),
    ]

class DVD_DISC_CONTROL_BLOCK_LIST(ctypes.Structure):
    _fields_ = [
        ("header", DVD_DISC_CONTROL_BLOCK_HEADER),
        ("Reserved0", ctypes.c_ubyte),
        ("ReadabldDCBs", ctypes.c_ubyte),
        ("Reserved1", ctypes.c_ubyte),
        ("WritableDCBs", ctypes.c_ubyte),
        ("Dcbs", DVD_DISC_CONTROL_BLOCK_LIST_DCB * 1),
    ]
#[repr(C)]
pub struct DVD_DISC_CONTROL_BLOCK_HEADER {
    pub ContentDescriptor: [u8; 4],
    pub ProhibitedActions: _ProhibitedActions_e__Union,
    pub VendorId: [u8; 32],
}

#[repr(C)]
pub struct DVD_DISC_CONTROL_BLOCK_LIST_DCB {
    pub DcbIdentifier: [u8; 4],
}

#[repr(C)]
pub struct DVD_DISC_CONTROL_BLOCK_LIST {
    pub header: DVD_DISC_CONTROL_BLOCK_HEADER,
    pub Reserved0: u8,
    pub ReadabldDCBs: u8,
    pub Reserved1: u8,
    pub WritableDCBs: u8,
    pub Dcbs: [DVD_DISC_CONTROL_BLOCK_LIST_DCB; 1],
}
import "golang.org/x/sys/windows"

type DVD_DISC_CONTROL_BLOCK_HEADER struct {
	ContentDescriptor [4]byte
	ProhibitedActions _ProhibitedActions_e__Union
	VendorId [32]byte
}

type DVD_DISC_CONTROL_BLOCK_LIST_DCB struct {
	DcbIdentifier [4]byte
}

type DVD_DISC_CONTROL_BLOCK_LIST struct {
	header DVD_DISC_CONTROL_BLOCK_HEADER
	Reserved0 byte
	ReadabldDCBs byte
	Reserved1 byte
	WritableDCBs byte
	Dcbs [1]DVD_DISC_CONTROL_BLOCK_LIST_DCB
}
type
  DVD_DISC_CONTROL_BLOCK_HEADER = record
    ContentDescriptor: array[0..3] of Byte;
    ProhibitedActions: _ProhibitedActions_e__Union;
    VendorId: array[0..31] of Byte;
  end;

  DVD_DISC_CONTROL_BLOCK_LIST_DCB = record
    DcbIdentifier: array[0..3] of Byte;
  end;

  DVD_DISC_CONTROL_BLOCK_LIST = record
    header: DVD_DISC_CONTROL_BLOCK_HEADER;
    Reserved0: Byte;
    ReadabldDCBs: Byte;
    Reserved1: Byte;
    WritableDCBs: Byte;
    Dcbs: array[0..0] of DVD_DISC_CONTROL_BLOCK_LIST_DCB;
  end;
const DVD_DISC_CONTROL_BLOCK_HEADER = extern struct {
    ContentDescriptor: [4]u8,
    ProhibitedActions: _ProhibitedActions_e__Union,
    VendorId: [32]u8,
};

const DVD_DISC_CONTROL_BLOCK_LIST_DCB = extern struct {
    DcbIdentifier: [4]u8,
};

const DVD_DISC_CONTROL_BLOCK_LIST = extern struct {
    header: DVD_DISC_CONTROL_BLOCK_HEADER,
    Reserved0: u8,
    ReadabldDCBs: u8,
    Reserved1: u8,
    WritableDCBs: u8,
    Dcbs: [1]DVD_DISC_CONTROL_BLOCK_LIST_DCB,
};
type
  DVD_DISC_CONTROL_BLOCK_HEADER {.bycopy.} = object
    ContentDescriptor: array[4, uint8]
    ProhibitedActions: _ProhibitedActions_e__Union
    VendorId: array[32, uint8]

  DVD_DISC_CONTROL_BLOCK_LIST_DCB {.bycopy.} = object
    DcbIdentifier: array[4, uint8]

  DVD_DISC_CONTROL_BLOCK_LIST {.bycopy.} = object
    header: DVD_DISC_CONTROL_BLOCK_HEADER
    Reserved0: uint8
    ReadabldDCBs: uint8
    Reserved1: uint8
    WritableDCBs: uint8
    Dcbs: array[1, DVD_DISC_CONTROL_BLOCK_LIST_DCB]
struct DVD_DISC_CONTROL_BLOCK_HEADER
{
    ubyte[4] ContentDescriptor;
    _ProhibitedActions_e__Union ProhibitedActions;
    ubyte[32] VendorId;
}

struct DVD_DISC_CONTROL_BLOCK_LIST_DCB
{
    ubyte[4] DcbIdentifier;
}

struct DVD_DISC_CONTROL_BLOCK_LIST
{
    DVD_DISC_CONTROL_BLOCK_HEADER header;
    ubyte Reserved0;
    ubyte ReadabldDCBs;
    ubyte Reserved1;
    ubyte WritableDCBs;
    DVD_DISC_CONTROL_BLOCK_LIST_DCB[1] Dcbs;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DVD_DISC_CONTROL_BLOCK_LIST サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; header : DVD_DISC_CONTROL_BLOCK_HEADER (+0, 40byte)  varptr(st)+0 を基点に操作(40byte:入れ子/配列)
; Reserved0 : BYTE (+40, 1byte)  poke st,40,値  /  値 = peek(st,40)
; ReadabldDCBs : BYTE (+41, 1byte)  poke st,41,値  /  値 = peek(st,41)
; Reserved1 : BYTE (+42, 1byte)  poke st,42,値  /  値 = peek(st,42)
; WritableDCBs : BYTE (+43, 1byte)  poke st,43,値  /  値 = peek(st,43)
; Dcbs : DVD_DISC_CONTROL_BLOCK_LIST_DCB (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_DISC_CONTROL_BLOCK_LIST サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; header : DVD_DISC_CONTROL_BLOCK_HEADER (+0, 48byte)  varptr(st)+0 を基点に操作(48byte:入れ子/配列)
; Reserved0 : BYTE (+48, 1byte)  poke st,48,値  /  値 = peek(st,48)
; ReadabldDCBs : BYTE (+49, 1byte)  poke st,49,値  /  値 = peek(st,49)
; Reserved1 : BYTE (+50, 1byte)  poke st,50,値  /  値 = peek(st,50)
; WritableDCBs : BYTE (+51, 1byte)  poke st,51,値  /  値 = peek(st,51)
; Dcbs : DVD_DISC_CONTROL_BLOCK_LIST_DCB (+52, 4byte)  varptr(st)+52 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DVD_DISC_CONTROL_BLOCK_HEADER
    #field byte ContentDescriptor 4
    #field byte ProhibitedActions 8
    #field byte VendorId 32
#endstruct

#defstruct global DVD_DISC_CONTROL_BLOCK_LIST_DCB
    #field byte DcbIdentifier 4
#endstruct

#defstruct global DVD_DISC_CONTROL_BLOCK_LIST
    #field DVD_DISC_CONTROL_BLOCK_HEADER header
    #field byte Reserved0
    #field byte ReadabldDCBs
    #field byte Reserved1
    #field byte WritableDCBs
    #field DVD_DISC_CONTROL_BLOCK_LIST_DCB Dcbs 1
#endstruct

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