ホーム › Devices.Dvd › DVD_COPY_PROTECT_KEY
DVD_COPY_PROTECT_KEY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| KeyLength | DWORD | 4 | +0 | +0 | KeyDataを含む構造体全体の長さをバイト単位で示すDWORD。 |
| SessionId | DWORD | 4 | +4 | +4 | 認証セッションを識別するDWORD。 |
| KeyType | DVD_KEY_TYPE | 4 | +8 | +8 | 取得または設定するキーの種別を示すDVD_KEY_TYPE列挙値。 |
| KeyFlags | DWORD | 4 | +12 | +12 | キー操作に関するフラグを示すDWORD。 |
| Parameters | _Parameters_e__Union | 8 | +16 | +16 | キー種別に応じたパラメータを保持する無名共用体。 |
| KeyData | BYTE | 1 | +24 | +24 | 実際のキーデータを保持する可変長バイト配列。 |
共用体: _Parameters_e__Union x64 8B / x86 8B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| FileHandle | HANDLE | 8/4 | +0 | +0 |
| TitleOffset | LONGLONG | 8 | +0 | +0 |
各言語での定義
#include <windows.h>
// DVD_COPY_PROTECT_KEY (x64 25 / x86 25 バイト)
#pragma pack(push, 1)
typedef struct DVD_COPY_PROTECT_KEY {
DWORD KeyLength;
DWORD SessionId;
DVD_KEY_TYPE KeyType;
DWORD KeyFlags;
_Parameters_e__Union Parameters;
BYTE KeyData[1];
} DVD_COPY_PROTECT_KEY;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DVD_COPY_PROTECT_KEY
{
public uint KeyLength;
public uint SessionId;
public int KeyType;
public uint KeyFlags;
public _Parameters_e__Union Parameters;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] KeyData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DVD_COPY_PROTECT_KEY
Public KeyLength As UInteger
Public SessionId As UInteger
Public KeyType As Integer
Public KeyFlags As UInteger
Public Parameters As _Parameters_e__Union
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public KeyData() As Byte
End Structureimport ctypes
from ctypes import wintypes
class DVD_COPY_PROTECT_KEY(ctypes.Structure):
_pack_ = 1
_fields_ = [
("KeyLength", wintypes.DWORD),
("SessionId", wintypes.DWORD),
("KeyType", ctypes.c_int),
("KeyFlags", wintypes.DWORD),
("Parameters", _Parameters_e__Union),
("KeyData", ctypes.c_ubyte * 1),
]#[repr(C, packed(1))]
pub struct DVD_COPY_PROTECT_KEY {
pub KeyLength: u32,
pub SessionId: u32,
pub KeyType: i32,
pub KeyFlags: u32,
pub Parameters: _Parameters_e__Union,
pub KeyData: [u8; 1],
}import "golang.org/x/sys/windows"
type DVD_COPY_PROTECT_KEY struct {
KeyLength uint32
SessionId uint32
KeyType int32
KeyFlags uint32
Parameters _Parameters_e__Union
KeyData [1]byte
}type
DVD_COPY_PROTECT_KEY = packed record
KeyLength: DWORD;
SessionId: DWORD;
KeyType: Integer;
KeyFlags: DWORD;
Parameters: _Parameters_e__Union;
KeyData: array[0..0] of Byte;
end;const DVD_COPY_PROTECT_KEY = extern struct {
KeyLength: u32,
SessionId: u32,
KeyType: i32,
KeyFlags: u32,
Parameters: _Parameters_e__Union,
KeyData: [1]u8,
};type
DVD_COPY_PROTECT_KEY {.packed.} = object
KeyLength: uint32
SessionId: uint32
KeyType: int32
KeyFlags: uint32
Parameters: _Parameters_e__Union
KeyData: array[1, uint8]align(1)
struct DVD_COPY_PROTECT_KEY
{
uint KeyLength;
uint SessionId;
int KeyType;
uint KeyFlags;
_Parameters_e__Union Parameters;
ubyte[1] KeyData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_COPY_PROTECT_KEY サイズ: 25 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 25 / 4 切り上げ)
; KeyLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SessionId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; KeyType : DVD_KEY_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; KeyFlags : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Parameters : _Parameters_e__Union (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; KeyData : BYTE (+24, 1byte) varptr(st)+24 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DVD_COPY_PROTECT_KEY, pack=1
#field int KeyLength
#field int SessionId
#field int KeyType
#field int KeyFlags
#field byte Parameters 8
#field byte KeyData 1
#endstruct
stdim st, DVD_COPY_PROTECT_KEY ; NSTRUCT 変数を確保
st->KeyLength = 100
mes "KeyLength=" + st->KeyLength
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。