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

D3DCONTENTPROTECTIONCAPS

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

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

フィールド

フィールドサイズx64x86説明
CapsDWORD4+0+0コンテンツ保護機能の能力を示すフラグ群。サポート項目をビットで表す。
KeyExchangeTypeGUID16+4+4鍵交換方式を識別するGUID。保護コンテンツの鍵共有手順を示す。
BufferAlignmentStartDWORD4+20+20保護バッファ先頭のアライメント要件(バイト単位)。
BlockAlignmentSizeDWORD4+24+24暗号化ブロックのアライメントサイズ(バイト単位)。
ProtectedMemorySizeULONGLONG8+28+28利用可能な保護メモリの総量(バイト単位)。

各言語での定義

#include <windows.h>

// D3DCONTENTPROTECTIONCAPS  (x64 36 / x86 36 バイト)
#pragma pack(push, 4)
typedef struct D3DCONTENTPROTECTIONCAPS {
    DWORD Caps;
    GUID KeyExchangeType;
    DWORD BufferAlignmentStart;
    DWORD BlockAlignmentSize;
    ULONGLONG ProtectedMemorySize;
} D3DCONTENTPROTECTIONCAPS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct D3DCONTENTPROTECTIONCAPS
{
    public uint Caps;
    public Guid KeyExchangeType;
    public uint BufferAlignmentStart;
    public uint BlockAlignmentSize;
    public ulong ProtectedMemorySize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure D3DCONTENTPROTECTIONCAPS
    Public Caps As UInteger
    Public KeyExchangeType As Guid
    Public BufferAlignmentStart As UInteger
    Public BlockAlignmentSize As UInteger
    Public ProtectedMemorySize As ULong
End Structure
import ctypes
from ctypes import wintypes

class D3DCONTENTPROTECTIONCAPS(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("Caps", wintypes.DWORD),
        ("KeyExchangeType", GUID),
        ("BufferAlignmentStart", wintypes.DWORD),
        ("BlockAlignmentSize", wintypes.DWORD),
        ("ProtectedMemorySize", ctypes.c_ulonglong),
    ]
#[repr(C, packed(4))]
pub struct D3DCONTENTPROTECTIONCAPS {
    pub Caps: u32,
    pub KeyExchangeType: GUID,
    pub BufferAlignmentStart: u32,
    pub BlockAlignmentSize: u32,
    pub ProtectedMemorySize: u64,
}
import "golang.org/x/sys/windows"

type D3DCONTENTPROTECTIONCAPS struct {
	Caps uint32
	KeyExchangeType windows.GUID
	BufferAlignmentStart uint32
	BlockAlignmentSize uint32
	ProtectedMemorySize uint64
}
type
  D3DCONTENTPROTECTIONCAPS = packed record
    Caps: DWORD;
    KeyExchangeType: TGUID;
    BufferAlignmentStart: DWORD;
    BlockAlignmentSize: DWORD;
    ProtectedMemorySize: UInt64;
  end;
const D3DCONTENTPROTECTIONCAPS = extern struct {
    Caps: u32,
    KeyExchangeType: GUID,
    BufferAlignmentStart: u32,
    BlockAlignmentSize: u32,
    ProtectedMemorySize: u64,
};
type
  D3DCONTENTPROTECTIONCAPS {.packed.} = object
    Caps: uint32
    KeyExchangeType: GUID
    BufferAlignmentStart: uint32
    BlockAlignmentSize: uint32
    ProtectedMemorySize: uint64
align(4)
struct D3DCONTENTPROTECTIONCAPS
{
    uint Caps;
    GUID KeyExchangeType;
    uint BufferAlignmentStart;
    uint BlockAlignmentSize;
    ulong ProtectedMemorySize;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DCONTENTPROTECTIONCAPS サイズ: 36 バイト(x64)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Caps : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; KeyExchangeType : GUID (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; BufferAlignmentStart : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; BlockAlignmentSize : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ProtectedMemorySize : ULONGLONG (+28, 8byte)  qpoke st,28,値 / qpeek(st,28)  ※IronHSPのみ。3.7/3.8は lpoke st,28,下位 : lpoke st,32,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global D3DCONTENTPROTECTIONCAPS, pack=4
    #field int Caps
    #field GUID KeyExchangeType
    #field int BufferAlignmentStart
    #field int BlockAlignmentSize
    #field int64 ProtectedMemorySize
#endstruct

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