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

OPM_STANDARD_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
rnRandomNumberOPM_RANDOM_NUMBER16+0+0要求時に渡した乱数と照合するための乱数(OPM_RANDOM_NUMBER)。
ulStatusFlagsDWORD4+16+16出力の状態を示すビットフラグ。
ulInformationDWORD4+20+20要求した標準情報の値。
ulReservedDWORD4+24+24予約領域。0を設定する。
ulReserved2DWORD4+28+28予約領域。0を設定する。

各言語での定義

#include <windows.h>

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

// OPM_STANDARD_INFORMATION  (x64 32 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct OPM_STANDARD_INFORMATION {
    OPM_RANDOM_NUMBER rnRandomNumber;
    DWORD ulStatusFlags;
    DWORD ulInformation;
    DWORD ulReserved;
    DWORD ulReserved2;
} OPM_STANDARD_INFORMATION;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct OPM_STANDARD_INFORMATION
{
    public OPM_RANDOM_NUMBER rnRandomNumber;
    public uint ulStatusFlags;
    public uint ulInformation;
    public uint ulReserved;
    public uint ulReserved2;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure OPM_STANDARD_INFORMATION
    Public rnRandomNumber As OPM_RANDOM_NUMBER
    Public ulStatusFlags As UInteger
    Public ulInformation As UInteger
    Public ulReserved As UInteger
    Public ulReserved2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

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

class OPM_STANDARD_INFORMATION(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("rnRandomNumber", OPM_RANDOM_NUMBER),
        ("ulStatusFlags", wintypes.DWORD),
        ("ulInformation", wintypes.DWORD),
        ("ulReserved", wintypes.DWORD),
        ("ulReserved2", wintypes.DWORD),
    ]
#[repr(C)]
pub struct OPM_RANDOM_NUMBER {
    pub abRandomNumber: [u8; 16],
}

#[repr(C, packed(1))]
pub struct OPM_STANDARD_INFORMATION {
    pub rnRandomNumber: OPM_RANDOM_NUMBER,
    pub ulStatusFlags: u32,
    pub ulInformation: u32,
    pub ulReserved: u32,
    pub ulReserved2: u32,
}
import "golang.org/x/sys/windows"

type OPM_RANDOM_NUMBER struct {
	abRandomNumber [16]byte
}

type OPM_STANDARD_INFORMATION struct {
	rnRandomNumber OPM_RANDOM_NUMBER
	ulStatusFlags uint32
	ulInformation uint32
	ulReserved uint32
	ulReserved2 uint32
}
type
  OPM_RANDOM_NUMBER = record
    abRandomNumber: array[0..15] of Byte;
  end;

  OPM_STANDARD_INFORMATION = packed record
    rnRandomNumber: OPM_RANDOM_NUMBER;
    ulStatusFlags: DWORD;
    ulInformation: DWORD;
    ulReserved: DWORD;
    ulReserved2: DWORD;
  end;
const OPM_RANDOM_NUMBER = extern struct {
    abRandomNumber: [16]u8,
};

const OPM_STANDARD_INFORMATION = extern struct {
    rnRandomNumber: OPM_RANDOM_NUMBER,
    ulStatusFlags: u32,
    ulInformation: u32,
    ulReserved: u32,
    ulReserved2: u32,
};
type
  OPM_RANDOM_NUMBER {.bycopy.} = object
    abRandomNumber: array[16, uint8]

  OPM_STANDARD_INFORMATION {.packed.} = object
    rnRandomNumber: OPM_RANDOM_NUMBER
    ulStatusFlags: uint32
    ulInformation: uint32
    ulReserved: uint32
    ulReserved2: uint32
struct OPM_RANDOM_NUMBER
{
    ubyte[16] abRandomNumber;
}

align(1)
struct OPM_STANDARD_INFORMATION
{
    OPM_RANDOM_NUMBER rnRandomNumber;
    uint ulStatusFlags;
    uint ulInformation;
    uint ulReserved;
    uint ulReserved2;
}

HSP用 定義

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

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

#defstruct global OPM_STANDARD_INFORMATION, pack=1
    #field OPM_RANDOM_NUMBER rnRandomNumber
    #field int ulStatusFlags
    #field int ulInformation
    #field int ulReserved
    #field int ulReserved2
#endstruct

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