ホーム › System.Diagnostics.Etw › EVENT_DESCRIPTOR
EVENT_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Id | WORD | 2 | +0 | +0 | イベントを識別する数値ID。 |
| Version | BYTE | 1 | +2 | +2 | イベント定義のバージョン。 |
| Channel | BYTE | 1 | +3 | +3 | イベントを発行するチャネル番号。 |
| Level | BYTE | 1 | +4 | +4 | イベントの重大度レベル(冗長度)。 |
| Opcode | BYTE | 1 | +5 | +5 | イベントの操作種別(オペコード)。 |
| Task | WORD | 2 | +6 | +6 | イベントが属するタスク番号。 |
| Keyword | ULONGLONG | 8 | +8 | +8 | イベントを分類するキーワードビットマスク。 |
各言語での定義
#include <windows.h>
// EVENT_DESCRIPTOR (x64 16 / x86 16 バイト)
typedef struct EVENT_DESCRIPTOR {
WORD Id;
BYTE Version;
BYTE Channel;
BYTE Level;
BYTE Opcode;
WORD Task;
ULONGLONG Keyword;
} EVENT_DESCRIPTOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EVENT_DESCRIPTOR
{
public ushort Id;
public byte Version;
public byte Channel;
public byte Level;
public byte Opcode;
public ushort Task;
public ulong Keyword;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EVENT_DESCRIPTOR
Public Id As UShort
Public Version As Byte
Public Channel As Byte
Public Level As Byte
Public Opcode As Byte
Public Task As UShort
Public Keyword As ULong
End Structureimport ctypes
from ctypes import wintypes
class EVENT_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Id", ctypes.c_ushort),
("Version", ctypes.c_ubyte),
("Channel", ctypes.c_ubyte),
("Level", ctypes.c_ubyte),
("Opcode", ctypes.c_ubyte),
("Task", ctypes.c_ushort),
("Keyword", ctypes.c_ulonglong),
]#[repr(C)]
pub struct EVENT_DESCRIPTOR {
pub Id: u16,
pub Version: u8,
pub Channel: u8,
pub Level: u8,
pub Opcode: u8,
pub Task: u16,
pub Keyword: u64,
}import "golang.org/x/sys/windows"
type EVENT_DESCRIPTOR struct {
Id uint16
Version byte
Channel byte
Level byte
Opcode byte
Task uint16
Keyword uint64
}type
EVENT_DESCRIPTOR = record
Id: Word;
Version: Byte;
Channel: Byte;
Level: Byte;
Opcode: Byte;
Task: Word;
Keyword: UInt64;
end;const EVENT_DESCRIPTOR = extern struct {
Id: u16,
Version: u8,
Channel: u8,
Level: u8,
Opcode: u8,
Task: u16,
Keyword: u64,
};type
EVENT_DESCRIPTOR {.bycopy.} = object
Id: uint16
Version: uint8
Channel: uint8
Level: uint8
Opcode: uint8
Task: uint16
Keyword: uint64struct EVENT_DESCRIPTOR
{
ushort Id;
ubyte Version;
ubyte Channel;
ubyte Level;
ubyte Opcode;
ushort Task;
ulong Keyword;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EVENT_DESCRIPTOR サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Id : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Version : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Channel : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Level : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Opcode : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; Task : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; Keyword : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global EVENT_DESCRIPTOR
#field short Id
#field byte Version
#field byte Channel
#field byte Level
#field byte Opcode
#field short Task
#field int64 Keyword
#endstruct
stdim st, EVENT_DESCRIPTOR ; NSTRUCT 変数を確保
st->Id = 100
mes "Id=" + st->Id