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

UDCR_TAG

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

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

フィールド

フィールドサイズx64x86説明
bVersionBYTE1+0+0UDCRタグの構造体バージョン。
KIDBYTE25+1+1コンテンツ暗号化のキーID(KID)配列。
ullBaseCounterULONGLONG8+32+32暗号化に用いる基準カウンタ値(64ビット)。
ullBaseCounterRangeULONGLONG8+40+40基準カウンタの有効範囲(64ビット)。
fScrambledBOOL4+48+48コンテンツがスクランブル(暗号化)されているか否か(BOOL)。
bStreamMarkBYTE1+52+52ストリームマーク。識別用バイト。
dwReserved1DWORD4+56+56予約フィールド。将来の拡張用で通常は0。
dwReserved2DWORD4+60+60予約フィールド。将来の拡張用で通常は0。

各言語での定義

#include <windows.h>

// UDCR_TAG  (x64 64 / x86 64 バイト)
typedef struct UDCR_TAG {
    BYTE bVersion;
    BYTE KID[25];
    ULONGLONG ullBaseCounter;
    ULONGLONG ullBaseCounterRange;
    BOOL fScrambled;
    BYTE bStreamMark;
    DWORD dwReserved1;
    DWORD dwReserved2;
} UDCR_TAG;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UDCR_TAG
{
    public byte bVersion;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public byte[] KID;
    public ulong ullBaseCounter;
    public ulong ullBaseCounterRange;
    [MarshalAs(UnmanagedType.Bool)] public bool fScrambled;
    public byte bStreamMark;
    public uint dwReserved1;
    public uint dwReserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UDCR_TAG
    Public bVersion As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=25)> Public KID() As Byte
    Public ullBaseCounter As ULong
    Public ullBaseCounterRange As ULong
    <MarshalAs(UnmanagedType.Bool)> Public fScrambled As Boolean
    Public bStreamMark As Byte
    Public dwReserved1 As UInteger
    Public dwReserved2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class UDCR_TAG(ctypes.Structure):
    _fields_ = [
        ("bVersion", ctypes.c_ubyte),
        ("KID", ctypes.c_ubyte * 25),
        ("ullBaseCounter", ctypes.c_ulonglong),
        ("ullBaseCounterRange", ctypes.c_ulonglong),
        ("fScrambled", wintypes.BOOL),
        ("bStreamMark", ctypes.c_ubyte),
        ("dwReserved1", wintypes.DWORD),
        ("dwReserved2", wintypes.DWORD),
    ]
#[repr(C)]
pub struct UDCR_TAG {
    pub bVersion: u8,
    pub KID: [u8; 25],
    pub ullBaseCounter: u64,
    pub ullBaseCounterRange: u64,
    pub fScrambled: i32,
    pub bStreamMark: u8,
    pub dwReserved1: u32,
    pub dwReserved2: u32,
}
import "golang.org/x/sys/windows"

type UDCR_TAG struct {
	bVersion byte
	KID [25]byte
	ullBaseCounter uint64
	ullBaseCounterRange uint64
	fScrambled int32
	bStreamMark byte
	dwReserved1 uint32
	dwReserved2 uint32
}
type
  UDCR_TAG = record
    bVersion: Byte;
    KID: array[0..24] of Byte;
    ullBaseCounter: UInt64;
    ullBaseCounterRange: UInt64;
    fScrambled: BOOL;
    bStreamMark: Byte;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
  end;
const UDCR_TAG = extern struct {
    bVersion: u8,
    KID: [25]u8,
    ullBaseCounter: u64,
    ullBaseCounterRange: u64,
    fScrambled: i32,
    bStreamMark: u8,
    dwReserved1: u32,
    dwReserved2: u32,
};
type
  UDCR_TAG {.bycopy.} = object
    bVersion: uint8
    KID: array[25, uint8]
    ullBaseCounter: uint64
    ullBaseCounterRange: uint64
    fScrambled: int32
    bStreamMark: uint8
    dwReserved1: uint32
    dwReserved2: uint32
struct UDCR_TAG
{
    ubyte bVersion;
    ubyte[25] KID;
    ulong ullBaseCounter;
    ulong ullBaseCounterRange;
    int fScrambled;
    ubyte bStreamMark;
    uint dwReserved1;
    uint dwReserved2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UDCR_TAG サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; bVersion : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; KID : BYTE (+1, 25byte)  varptr(st)+1 を基点に操作(25byte:入れ子/配列)
; ullBaseCounter : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ullBaseCounterRange : ULONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; fScrambled : BOOL (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; bStreamMark : BYTE (+52, 1byte)  poke st,52,値  /  値 = peek(st,52)
; dwReserved1 : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; dwReserved2 : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UDCR_TAG
    #field byte bVersion
    #field byte KID 25
    #field int64 ullBaseCounter
    #field int64 ullBaseCounterRange
    #field bool fScrambled
    #field byte bStreamMark
    #field int dwReserved1
    #field int dwReserved2
#endstruct

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