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

WMDRMProtectionInfo

構造体
サイズx64: 67 バイト / x86: 67 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
wszKIDWORD50+0+0WMDRMのキーID(KID)を示すワイド文字配列。
qwCounterULONGLONG8+50+50暗号化に用いるカウンタ値(64ビット)。
qwIndexULONGLONG8+58+58サンプル内のインデックス値(64ビット)。
bOffsetBYTE1+66+66暗号化開始位置のオフセット。単位はバイト。

各言語での定義

#include <windows.h>

// WMDRMProtectionInfo  (x64 67 / x86 67 バイト)
#pragma pack(push, 1)
typedef struct WMDRMProtectionInfo {
    WORD wszKID[25];
    ULONGLONG qwCounter;
    ULONGLONG qwIndex;
    BYTE bOffset;
} WMDRMProtectionInfo;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WMDRMProtectionInfo
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public ushort[] wszKID;
    public ulong qwCounter;
    public ulong qwIndex;
    public byte bOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WMDRMProtectionInfo
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=25)> Public wszKID() As UShort
    Public qwCounter As ULong
    Public qwIndex As ULong
    Public bOffset As Byte
End Structure
import ctypes
from ctypes import wintypes

class WMDRMProtectionInfo(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("wszKID", ctypes.c_ushort * 25),
        ("qwCounter", ctypes.c_ulonglong),
        ("qwIndex", ctypes.c_ulonglong),
        ("bOffset", ctypes.c_ubyte),
    ]
#[repr(C, packed(1))]
pub struct WMDRMProtectionInfo {
    pub wszKID: [u16; 25],
    pub qwCounter: u64,
    pub qwIndex: u64,
    pub bOffset: u8,
}
import "golang.org/x/sys/windows"

type WMDRMProtectionInfo struct {
	wszKID [25]uint16
	qwCounter uint64
	qwIndex uint64
	bOffset byte
}
type
  WMDRMProtectionInfo = packed record
    wszKID: array[0..24] of Word;
    qwCounter: UInt64;
    qwIndex: UInt64;
    bOffset: Byte;
  end;
const WMDRMProtectionInfo = extern struct {
    wszKID: [25]u16,
    qwCounter: u64,
    qwIndex: u64,
    bOffset: u8,
};
type
  WMDRMProtectionInfo {.packed.} = object
    wszKID: array[25, uint16]
    qwCounter: uint64
    qwIndex: uint64
    bOffset: uint8
align(1)
struct WMDRMProtectionInfo
{
    ushort[25] wszKID;
    ulong qwCounter;
    ulong qwIndex;
    ubyte bOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WMDRMProtectionInfo サイズ: 67 バイト(x64)
dim st, 17    ; 4byte整数×17(構造体サイズ 67 / 4 切り上げ)
; wszKID : WORD (+0, 50byte)  varptr(st)+0 を基点に操作(50byte:入れ子/配列)
; qwCounter : ULONGLONG (+50, 8byte)  qpoke st,50,値 / qpeek(st,50)  ※IronHSPのみ。3.7/3.8は lpoke st,50,下位 : lpoke st,54,上位
; qwIndex : ULONGLONG (+58, 8byte)  qpoke st,58,値 / qpeek(st,58)  ※IronHSPのみ。3.7/3.8は lpoke st,58,下位 : lpoke st,62,上位
; bOffset : BYTE (+66, 1byte)  poke st,66,値  /  値 = peek(st,66)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WMDRMProtectionInfo, pack=1
    #field short wszKID 25
    #field int64 qwCounter
    #field int64 qwIndex
    #field byte bOffset
#endstruct

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