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

KS_DVDCOPY_TITLEKEY

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

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

フィールド

フィールドサイズx64x86説明
KeyFlagsDWORD4+0+0タイトルキーに関するフラグの集合である。
ReservedNTDWORD8+4+4NT用予約フィールドで、0を設定する。
TitleKeyBYTE6+12+12DVDタイトルキーを格納するバイト配列である。
ReservedBYTE2+18+18予約バイト配列で、0を設定する。

各言語での定義

#include <windows.h>

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

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

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

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

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

HSP用 定義

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

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

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