ホーム › Media.KernelStreaming › KSGOP_USERDATA
KSGOP_USERDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| sc | DWORD | 4 | +0 | +0 | GOPユーザデータのスタートコードを示す。 |
| reserved1 | DWORD | 4 | +4 | +4 | 予約フィールド。将来の拡張用で通常は0を設定する。 |
| cFields | BYTE | 1 | +8 | +8 | 含まれるフィールド数を示す。 |
| l21Data | CHAR | 3 | +9 | +9 | Line 21(クローズドキャプション)データの先頭CHAR(配列)。 |
各言語での定義
#include <windows.h>
// KSGOP_USERDATA (x64 12 / x86 12 バイト)
typedef struct KSGOP_USERDATA {
DWORD sc;
DWORD reserved1;
BYTE cFields;
CHAR l21Data[3];
} KSGOP_USERDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSGOP_USERDATA
{
public uint sc;
public uint reserved1;
public byte cFields;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public sbyte[] l21Data;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSGOP_USERDATA
Public sc As UInteger
Public reserved1 As UInteger
Public cFields As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public l21Data() As SByte
End Structureimport ctypes
from ctypes import wintypes
class KSGOP_USERDATA(ctypes.Structure):
_fields_ = [
("sc", wintypes.DWORD),
("reserved1", wintypes.DWORD),
("cFields", ctypes.c_ubyte),
("l21Data", ctypes.c_byte * 3),
]#[repr(C)]
pub struct KSGOP_USERDATA {
pub sc: u32,
pub reserved1: u32,
pub cFields: u8,
pub l21Data: [i8; 3],
}import "golang.org/x/sys/windows"
type KSGOP_USERDATA struct {
sc uint32
reserved1 uint32
cFields byte
l21Data [3]int8
}type
KSGOP_USERDATA = record
sc: DWORD;
reserved1: DWORD;
cFields: Byte;
l21Data: array[0..2] of Shortint;
end;const KSGOP_USERDATA = extern struct {
sc: u32,
reserved1: u32,
cFields: u8,
l21Data: [3]i8,
};type
KSGOP_USERDATA {.bycopy.} = object
sc: uint32
reserved1: uint32
cFields: uint8
l21Data: array[3, int8]struct KSGOP_USERDATA
{
uint sc;
uint reserved1;
ubyte cFields;
byte[3] l21Data;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSGOP_USERDATA サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; sc : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; reserved1 : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cFields : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; l21Data : CHAR (+9, 3byte) varptr(st)+9 を基点に操作(3byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KSGOP_USERDATA
#field int sc
#field int reserved1
#field byte cFields
#field byte l21Data 3
#endstruct
stdim st, KSGOP_USERDATA ; NSTRUCT 変数を確保
st->sc = 100
mes "sc=" + st->sc