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

OPM_CONFIGURE_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
omacOPM_OMAC16+0+0設定要求の完全性を検証するOMAC署名(OPM_OMAC)。
guidSettingGUID16+16+16適用する設定の種別を識別するGUID。
ulSequenceNumberDWORD4+32+32設定要求のシーケンス番号。
cbParametersSizeDWORD4+36+36abParameters内の有効パラメータのバイトサイズ。
abParametersBYTE4056+40+40設定に付随する追加パラメータを格納するバイト配列。

各言語での定義

#include <windows.h>

// OPM_OMAC  (x64 16 / x86 16 バイト)
typedef struct OPM_OMAC {
    BYTE abOMAC[16];
} OPM_OMAC;

// OPM_CONFIGURE_PARAMETERS  (x64 4096 / x86 4096 バイト)
#pragma pack(push, 1)
typedef struct OPM_CONFIGURE_PARAMETERS {
    OPM_OMAC omac;
    GUID guidSetting;
    DWORD ulSequenceNumber;
    DWORD cbParametersSize;
    BYTE abParameters[4056];
} OPM_CONFIGURE_PARAMETERS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OPM_OMAC
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] abOMAC;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct OPM_CONFIGURE_PARAMETERS
{
    public OPM_OMAC omac;
    public Guid guidSetting;
    public uint ulSequenceNumber;
    public uint cbParametersSize;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4056)] public byte[] abParameters;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OPM_OMAC
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public abOMAC() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure OPM_CONFIGURE_PARAMETERS
    Public omac As OPM_OMAC
    Public guidSetting As Guid
    Public ulSequenceNumber As UInteger
    Public cbParametersSize As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4056)> Public abParameters() As Byte
End Structure
import ctypes
from ctypes import wintypes

class OPM_OMAC(ctypes.Structure):
    _fields_ = [
        ("abOMAC", ctypes.c_ubyte * 16),
    ]

class OPM_CONFIGURE_PARAMETERS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("omac", OPM_OMAC),
        ("guidSetting", GUID),
        ("ulSequenceNumber", wintypes.DWORD),
        ("cbParametersSize", wintypes.DWORD),
        ("abParameters", ctypes.c_ubyte * 4056),
    ]
#[repr(C)]
pub struct OPM_OMAC {
    pub abOMAC: [u8; 16],
}

#[repr(C, packed(1))]
pub struct OPM_CONFIGURE_PARAMETERS {
    pub omac: OPM_OMAC,
    pub guidSetting: GUID,
    pub ulSequenceNumber: u32,
    pub cbParametersSize: u32,
    pub abParameters: [u8; 4056],
}
import "golang.org/x/sys/windows"

type OPM_OMAC struct {
	abOMAC [16]byte
}

type OPM_CONFIGURE_PARAMETERS struct {
	omac OPM_OMAC
	guidSetting windows.GUID
	ulSequenceNumber uint32
	cbParametersSize uint32
	abParameters [4056]byte
}
type
  OPM_OMAC = record
    abOMAC: array[0..15] of Byte;
  end;

  OPM_CONFIGURE_PARAMETERS = packed record
    omac: OPM_OMAC;
    guidSetting: TGUID;
    ulSequenceNumber: DWORD;
    cbParametersSize: DWORD;
    abParameters: array[0..4055] of Byte;
  end;
const OPM_OMAC = extern struct {
    abOMAC: [16]u8,
};

const OPM_CONFIGURE_PARAMETERS = extern struct {
    omac: OPM_OMAC,
    guidSetting: GUID,
    ulSequenceNumber: u32,
    cbParametersSize: u32,
    abParameters: [4056]u8,
};
type
  OPM_OMAC {.bycopy.} = object
    abOMAC: array[16, uint8]

  OPM_CONFIGURE_PARAMETERS {.packed.} = object
    omac: OPM_OMAC
    guidSetting: GUID
    ulSequenceNumber: uint32
    cbParametersSize: uint32
    abParameters: array[4056, uint8]
struct OPM_OMAC
{
    ubyte[16] abOMAC;
}

align(1)
struct OPM_CONFIGURE_PARAMETERS
{
    OPM_OMAC omac;
    GUID guidSetting;
    uint ulSequenceNumber;
    uint cbParametersSize;
    ubyte[4056] abParameters;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPM_CONFIGURE_PARAMETERS サイズ: 4096 バイト(x64)
dim st, 1024    ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; omac : OPM_OMAC (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; guidSetting : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; ulSequenceNumber : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; cbParametersSize : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; abParameters : BYTE (+40, 4056byte)  varptr(st)+40 を基点に操作(4056byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global OPM_OMAC
    #field byte abOMAC 16
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global OPM_CONFIGURE_PARAMETERS, pack=1
    #field OPM_OMAC omac
    #field GUID guidSetting
    #field int ulSequenceNumber
    #field int cbParametersSize
    #field byte abParameters 4056
#endstruct

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