Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Etw › EVENT_FILTER_HEADER

EVENT_FILTER_HEADER

構造体
サイズx64: 24 バイト / x86: 24 バイト

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

フィールド

フィールドサイズx64x86説明
IdWORD2+0+0フィルタを識別する数値ID。
VersionBYTE1+2+2フィルタ定義のバージョン。
ReservedBYTE5+3+3予約フィールド。0であること。
InstanceIdULONGLONG8+8+8フィルタインスタンスの識別子。
SizeDWORD4+16+16本ヘッダを含むフィルタ全体のバイト数。
NextOffsetDWORD4+20+20次のフィルタヘッダへのバイトオフセット。0で末尾。

各言語での定義

#include <windows.h>

// EVENT_FILTER_HEADER  (x64 24 / x86 24 バイト)
typedef struct EVENT_FILTER_HEADER {
    WORD Id;
    BYTE Version;
    BYTE Reserved[5];
    ULONGLONG InstanceId;
    DWORD Size;
    DWORD NextOffset;
} EVENT_FILTER_HEADER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EVENT_FILTER_HEADER
{
    public ushort Id;
    public byte Version;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] Reserved;
    public ulong InstanceId;
    public uint Size;
    public uint NextOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EVENT_FILTER_HEADER
    Public Id As UShort
    Public Version As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public Reserved() As Byte
    Public InstanceId As ULong
    Public Size As UInteger
    Public NextOffset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class EVENT_FILTER_HEADER(ctypes.Structure):
    _fields_ = [
        ("Id", ctypes.c_ushort),
        ("Version", ctypes.c_ubyte),
        ("Reserved", ctypes.c_ubyte * 5),
        ("InstanceId", ctypes.c_ulonglong),
        ("Size", wintypes.DWORD),
        ("NextOffset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct EVENT_FILTER_HEADER {
    pub Id: u16,
    pub Version: u8,
    pub Reserved: [u8; 5],
    pub InstanceId: u64,
    pub Size: u32,
    pub NextOffset: u32,
}
import "golang.org/x/sys/windows"

type EVENT_FILTER_HEADER struct {
	Id uint16
	Version byte
	Reserved [5]byte
	InstanceId uint64
	Size uint32
	NextOffset uint32
}
type
  EVENT_FILTER_HEADER = record
    Id: Word;
    Version: Byte;
    Reserved: array[0..4] of Byte;
    InstanceId: UInt64;
    Size: DWORD;
    NextOffset: DWORD;
  end;
const EVENT_FILTER_HEADER = extern struct {
    Id: u16,
    Version: u8,
    Reserved: [5]u8,
    InstanceId: u64,
    Size: u32,
    NextOffset: u32,
};
type
  EVENT_FILTER_HEADER {.bycopy.} = object
    Id: uint16
    Version: uint8
    Reserved: array[5, uint8]
    InstanceId: uint64
    Size: uint32
    NextOffset: uint32
struct EVENT_FILTER_HEADER
{
    ushort Id;
    ubyte Version;
    ubyte[5] Reserved;
    ulong InstanceId;
    uint Size;
    uint NextOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EVENT_FILTER_HEADER サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Id : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Version : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Reserved : BYTE (+3, 5byte)  varptr(st)+3 を基点に操作(5byte:入れ子/配列)
; InstanceId : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Size : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; NextOffset : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global EVENT_FILTER_HEADER
    #field short Id
    #field byte Version
    #field byte Reserved 5
    #field int64 InstanceId
    #field int Size
    #field int NextOffset
#endstruct

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