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

TRACE_ENABLE_INFO

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

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

フィールド

フィールドサイズx64x86説明
IsEnabledDWORD4+0+0プロバイダが有効かを示す値。1で有効。
LevelBYTE1+4+4有効化されたトレースレベル(冗長度)。
Reserved1BYTE1+5+5予約フィールド。0であること。
LoggerIdWORD2+6+6プロバイダを有効化したセッションのID。
EnablePropertyDWORD4+8+8EnableTraceEx2で指定された有効化プロパティのフラグ。
Reserved2DWORD4+12+12予約フィールド。0であること。
MatchAnyKeywordULONGLONG8+16+16いずれか一致で発火するキーワードビットマスク。0で全許可。
MatchAllKeywordULONGLONG8+24+24全一致を要求するキーワードビットマスク。

各言語での定義

#include <windows.h>

// TRACE_ENABLE_INFO  (x64 32 / x86 32 バイト)
typedef struct TRACE_ENABLE_INFO {
    DWORD IsEnabled;
    BYTE Level;
    BYTE Reserved1;
    WORD LoggerId;
    DWORD EnableProperty;
    DWORD Reserved2;
    ULONGLONG MatchAnyKeyword;
    ULONGLONG MatchAllKeyword;
} TRACE_ENABLE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRACE_ENABLE_INFO
{
    public uint IsEnabled;
    public byte Level;
    public byte Reserved1;
    public ushort LoggerId;
    public uint EnableProperty;
    public uint Reserved2;
    public ulong MatchAnyKeyword;
    public ulong MatchAllKeyword;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRACE_ENABLE_INFO
    Public IsEnabled As UInteger
    Public Level As Byte
    Public Reserved1 As Byte
    Public LoggerId As UShort
    Public EnableProperty As UInteger
    Public Reserved2 As UInteger
    Public MatchAnyKeyword As ULong
    Public MatchAllKeyword As ULong
End Structure
import ctypes
from ctypes import wintypes

class TRACE_ENABLE_INFO(ctypes.Structure):
    _fields_ = [
        ("IsEnabled", wintypes.DWORD),
        ("Level", ctypes.c_ubyte),
        ("Reserved1", ctypes.c_ubyte),
        ("LoggerId", ctypes.c_ushort),
        ("EnableProperty", wintypes.DWORD),
        ("Reserved2", wintypes.DWORD),
        ("MatchAnyKeyword", ctypes.c_ulonglong),
        ("MatchAllKeyword", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct TRACE_ENABLE_INFO {
    pub IsEnabled: u32,
    pub Level: u8,
    pub Reserved1: u8,
    pub LoggerId: u16,
    pub EnableProperty: u32,
    pub Reserved2: u32,
    pub MatchAnyKeyword: u64,
    pub MatchAllKeyword: u64,
}
import "golang.org/x/sys/windows"

type TRACE_ENABLE_INFO struct {
	IsEnabled uint32
	Level byte
	Reserved1 byte
	LoggerId uint16
	EnableProperty uint32
	Reserved2 uint32
	MatchAnyKeyword uint64
	MatchAllKeyword uint64
}
type
  TRACE_ENABLE_INFO = record
    IsEnabled: DWORD;
    Level: Byte;
    Reserved1: Byte;
    LoggerId: Word;
    EnableProperty: DWORD;
    Reserved2: DWORD;
    MatchAnyKeyword: UInt64;
    MatchAllKeyword: UInt64;
  end;
const TRACE_ENABLE_INFO = extern struct {
    IsEnabled: u32,
    Level: u8,
    Reserved1: u8,
    LoggerId: u16,
    EnableProperty: u32,
    Reserved2: u32,
    MatchAnyKeyword: u64,
    MatchAllKeyword: u64,
};
type
  TRACE_ENABLE_INFO {.bycopy.} = object
    IsEnabled: uint32
    Level: uint8
    Reserved1: uint8
    LoggerId: uint16
    EnableProperty: uint32
    Reserved2: uint32
    MatchAnyKeyword: uint64
    MatchAllKeyword: uint64
struct TRACE_ENABLE_INFO
{
    uint IsEnabled;
    ubyte Level;
    ubyte Reserved1;
    ushort LoggerId;
    uint EnableProperty;
    uint Reserved2;
    ulong MatchAnyKeyword;
    ulong MatchAllKeyword;
}

HSP用 定義

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

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

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