Win32 API 日本語リファレンス
ホームMedia.DirectShow › AM_DVDCOPY_TITLEKEY

AM_DVDCOPY_TITLEKEY

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

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

フィールド

フィールドサイズx64x86説明
KeyFlagsDWORD4+0+0タイトルキーに関する属性フラグ。
Reserved1DWORD8+4+4予約フィールド配列。将来の拡張用で通常は0。
TitleKeyBYTE6+12+12タイトルキー配列。CSS復号に用いる鍵情報。
Reserved2BYTE2+18+18予約フィールド配列。将来の拡張用で通常は0。

各言語での定義

#include <windows.h>

// AM_DVDCOPY_TITLEKEY  (x64 20 / x86 20 バイト)
typedef struct AM_DVDCOPY_TITLEKEY {
    DWORD KeyFlags;
    DWORD Reserved1[2];
    BYTE TitleKey[6];
    BYTE Reserved2[2];
} AM_DVDCOPY_TITLEKEY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AM_DVDCOPY_TITLEKEY
{
    public uint KeyFlags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] Reserved1;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] TitleKey;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AM_DVDCOPY_TITLEKEY
    Public KeyFlags As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved1() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public TitleKey() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved2() As Byte
End Structure
import ctypes
from ctypes import wintypes

class AM_DVDCOPY_TITLEKEY(ctypes.Structure):
    _fields_ = [
        ("KeyFlags", wintypes.DWORD),
        ("Reserved1", wintypes.DWORD * 2),
        ("TitleKey", ctypes.c_ubyte * 6),
        ("Reserved2", ctypes.c_ubyte * 2),
    ]
#[repr(C)]
pub struct AM_DVDCOPY_TITLEKEY {
    pub KeyFlags: u32,
    pub Reserved1: [u32; 2],
    pub TitleKey: [u8; 6],
    pub Reserved2: [u8; 2],
}
import "golang.org/x/sys/windows"

type AM_DVDCOPY_TITLEKEY struct {
	KeyFlags uint32
	Reserved1 [2]uint32
	TitleKey [6]byte
	Reserved2 [2]byte
}
type
  AM_DVDCOPY_TITLEKEY = record
    KeyFlags: DWORD;
    Reserved1: array[0..1] of DWORD;
    TitleKey: array[0..5] of Byte;
    Reserved2: array[0..1] of Byte;
  end;
const AM_DVDCOPY_TITLEKEY = extern struct {
    KeyFlags: u32,
    Reserved1: [2]u32,
    TitleKey: [6]u8,
    Reserved2: [2]u8,
};
type
  AM_DVDCOPY_TITLEKEY {.bycopy.} = object
    KeyFlags: uint32
    Reserved1: array[2, uint32]
    TitleKey: array[6, uint8]
    Reserved2: array[2, uint8]
struct AM_DVDCOPY_TITLEKEY
{
    uint KeyFlags;
    uint[2] Reserved1;
    ubyte[6] TitleKey;
    ubyte[2] Reserved2;
}

HSP用 定義

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

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

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