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

DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT

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

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

フィールド

フィールドサイズx64x86説明
headerDVD_DISC_CONTROL_BLOCK_HEADER48/40+0+0DCBの共通ヘッダを保持するDVD_DISC_CONTROL_BLOCK_HEADER。
UpdateCountBYTE4+48+40更新回数を示す1バイト値。
WriteProtectActions_WriteProtectActions_e__Union8/4+56+44書き込み保護に関する許可/禁止操作を示す無名共用体。
Reserved0BYTE16+64+48予約領域。将来の拡張用で通常は0。
UpdatePasswordBYTE32+80+64更新に必要なパスワードを保持するバイト配列。
Reserved1BYTE32672+112+96予約領域。将来の拡張用で通常は0。

共用体: _WriteProtectActions_e__Union x64 8B / x86 4B

フィールドサイズx64x86
Anonymous_Anonymous_e__Struct8/4+0+0
AsByteBYTE4+0+0

各言語での定義

#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_WRITE_INHIBIT  (x64 32784 / x86 32768 バイト)
typedef struct DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT {
    DVD_DISC_CONTROL_BLOCK_HEADER header;
    BYTE UpdateCount[4];
    _WriteProtectActions_e__Union WriteProtectActions;
    BYTE Reserved0[16];
    BYTE UpdatePassword[32];
    BYTE Reserved1[32672];
} DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT;
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_WRITE_INHIBIT
{
    public DVD_DISC_CONTROL_BLOCK_HEADER header;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] UpdateCount;
    public _WriteProtectActions_e__Union WriteProtectActions;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Reserved0;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] UpdatePassword;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32672)] public byte[] Reserved1;
}
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_WRITE_INHIBIT
    Public header As DVD_DISC_CONTROL_BLOCK_HEADER
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public UpdateCount() As Byte
    Public WriteProtectActions As _WriteProtectActions_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Reserved0() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public UpdatePassword() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32672)> Public Reserved1() As Byte
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_WRITE_INHIBIT(ctypes.Structure):
    _fields_ = [
        ("header", DVD_DISC_CONTROL_BLOCK_HEADER),
        ("UpdateCount", ctypes.c_ubyte * 4),
        ("WriteProtectActions", _WriteProtectActions_e__Union),
        ("Reserved0", ctypes.c_ubyte * 16),
        ("UpdatePassword", ctypes.c_ubyte * 32),
        ("Reserved1", ctypes.c_ubyte * 32672),
    ]
#[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_WRITE_INHIBIT {
    pub header: DVD_DISC_CONTROL_BLOCK_HEADER,
    pub UpdateCount: [u8; 4],
    pub WriteProtectActions: _WriteProtectActions_e__Union,
    pub Reserved0: [u8; 16],
    pub UpdatePassword: [u8; 32],
    pub Reserved1: [u8; 32672],
}
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_WRITE_INHIBIT struct {
	header DVD_DISC_CONTROL_BLOCK_HEADER
	UpdateCount [4]byte
	WriteProtectActions _WriteProtectActions_e__Union
	Reserved0 [16]byte
	UpdatePassword [32]byte
	Reserved1 [32672]byte
}
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_WRITE_INHIBIT = record
    header: DVD_DISC_CONTROL_BLOCK_HEADER;
    UpdateCount: array[0..3] of Byte;
    WriteProtectActions: _WriteProtectActions_e__Union;
    Reserved0: array[0..15] of Byte;
    UpdatePassword: array[0..31] of Byte;
    Reserved1: array[0..32671] of Byte;
  end;
const DVD_DISC_CONTROL_BLOCK_HEADER = extern struct {
    ContentDescriptor: [4]u8,
    ProhibitedActions: _ProhibitedActions_e__Union,
    VendorId: [32]u8,
};

const DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT = extern struct {
    header: DVD_DISC_CONTROL_BLOCK_HEADER,
    UpdateCount: [4]u8,
    WriteProtectActions: _WriteProtectActions_e__Union,
    Reserved0: [16]u8,
    UpdatePassword: [32]u8,
    Reserved1: [32672]u8,
};
type
  DVD_DISC_CONTROL_BLOCK_HEADER {.bycopy.} = object
    ContentDescriptor: array[4, uint8]
    ProhibitedActions: _ProhibitedActions_e__Union
    VendorId: array[32, uint8]

  DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT {.bycopy.} = object
    header: DVD_DISC_CONTROL_BLOCK_HEADER
    UpdateCount: array[4, uint8]
    WriteProtectActions: _WriteProtectActions_e__Union
    Reserved0: array[16, uint8]
    UpdatePassword: array[32, uint8]
    Reserved1: array[32672, uint8]
struct DVD_DISC_CONTROL_BLOCK_HEADER
{
    ubyte[4] ContentDescriptor;
    _ProhibitedActions_e__Union ProhibitedActions;
    ubyte[32] VendorId;
}

struct DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT
{
    DVD_DISC_CONTROL_BLOCK_HEADER header;
    ubyte[4] UpdateCount;
    _WriteProtectActions_e__Union WriteProtectActions;
    ubyte[16] Reserved0;
    ubyte[32] UpdatePassword;
    ubyte[32672] Reserved1;
}

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_WRITE_INHIBIT サイズ: 32768 バイト(x86)
dim st, 8192    ; 4byte整数×8192(構造体サイズ 32768 / 4 切り上げ)
; header : DVD_DISC_CONTROL_BLOCK_HEADER (+0, 40byte)  varptr(st)+0 を基点に操作(40byte:入れ子/配列)
; UpdateCount : BYTE (+40, 4byte)  varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; WriteProtectActions : _WriteProtectActions_e__Union (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; Reserved0 : BYTE (+48, 16byte)  varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; UpdatePassword : BYTE (+64, 32byte)  varptr(st)+64 を基点に操作(32byte:入れ子/配列)
; Reserved1 : BYTE (+96, 32672byte)  varptr(st)+96 を基点に操作(32672byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT サイズ: 32784 バイト(x64)
dim st, 8196    ; 4byte整数×8196(構造体サイズ 32784 / 4 切り上げ)
; header : DVD_DISC_CONTROL_BLOCK_HEADER (+0, 48byte)  varptr(st)+0 を基点に操作(48byte:入れ子/配列)
; UpdateCount : BYTE (+48, 4byte)  varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; WriteProtectActions : _WriteProtectActions_e__Union (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; Reserved0 : BYTE (+64, 16byte)  varptr(st)+64 を基点に操作(16byte:入れ子/配列)
; UpdatePassword : BYTE (+80, 32byte)  varptr(st)+80 を基点に操作(32byte:入れ子/配列)
; Reserved1 : BYTE (+112, 32672byte)  varptr(st)+112 を基点に操作(32672byte:入れ子/配列)
; ※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_WRITE_INHIBIT
    #field DVD_DISC_CONTROL_BLOCK_HEADER header
    #field byte UpdateCount 4
    #field byte WriteProtectActions 8
    #field byte Reserved0 16
    #field byte UpdatePassword 32
    #field byte Reserved1 32672
#endstruct

stdim st, DVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT        ; NSTRUCT 変数を確保
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。