ホーム › System.Diagnostics.Etw › PROVIDER_EVENT_INFO
PROVIDER_EVENT_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NumberOfEvents | DWORD | 4 | +0 | +0 | EventDescriptorsArrayに含まれるイベント数。 |
| Reserved | DWORD | 4 | +4 | +4 | 予約フィールド。0であること。 |
| EventDescriptorsArray | EVENT_DESCRIPTOR | 16 | +8 | +8 | EVENT_DESCRIPTOR配列の先頭。可変長。 |
各言語での定義
#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;
// PROVIDER_EVENT_INFO (x64 24 / x86 24 バイト)
typedef struct PROVIDER_EVENT_INFO {
DWORD NumberOfEvents;
DWORD Reserved;
EVENT_DESCRIPTOR EventDescriptorsArray[1];
} PROVIDER_EVENT_INFO;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PROVIDER_EVENT_INFO
{
public uint NumberOfEvents;
public uint Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public EVENT_DESCRIPTOR[] EventDescriptorsArray;
}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 Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PROVIDER_EVENT_INFO
Public NumberOfEvents As UInteger
Public Reserved As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public EventDescriptorsArray() As EVENT_DESCRIPTOR
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),
]
class PROVIDER_EVENT_INFO(ctypes.Structure):
_fields_ = [
("NumberOfEvents", wintypes.DWORD),
("Reserved", wintypes.DWORD),
("EventDescriptorsArray", EVENT_DESCRIPTOR * 1),
]#[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,
}
#[repr(C)]
pub struct PROVIDER_EVENT_INFO {
pub NumberOfEvents: u32,
pub Reserved: u32,
pub EventDescriptorsArray: [EVENT_DESCRIPTOR; 1],
}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 PROVIDER_EVENT_INFO struct {
NumberOfEvents uint32
Reserved uint32
EventDescriptorsArray [1]EVENT_DESCRIPTOR
}type
EVENT_DESCRIPTOR = record
Id: Word;
Version: Byte;
Channel: Byte;
Level: Byte;
Opcode: Byte;
Task: Word;
Keyword: UInt64;
end;
PROVIDER_EVENT_INFO = record
NumberOfEvents: DWORD;
Reserved: DWORD;
EventDescriptorsArray: array[0..0] of EVENT_DESCRIPTOR;
end;const EVENT_DESCRIPTOR = extern struct {
Id: u16,
Version: u8,
Channel: u8,
Level: u8,
Opcode: u8,
Task: u16,
Keyword: u64,
};
const PROVIDER_EVENT_INFO = extern struct {
NumberOfEvents: u32,
Reserved: u32,
EventDescriptorsArray: [1]EVENT_DESCRIPTOR,
};type
EVENT_DESCRIPTOR {.bycopy.} = object
Id: uint16
Version: uint8
Channel: uint8
Level: uint8
Opcode: uint8
Task: uint16
Keyword: uint64
PROVIDER_EVENT_INFO {.bycopy.} = object
NumberOfEvents: uint32
Reserved: uint32
EventDescriptorsArray: array[1, EVENT_DESCRIPTOR]struct EVENT_DESCRIPTOR
{
ushort Id;
ubyte Version;
ubyte Channel;
ubyte Level;
ubyte Opcode;
ushort Task;
ulong Keyword;
}
struct PROVIDER_EVENT_INFO
{
uint NumberOfEvents;
uint Reserved;
EVENT_DESCRIPTOR[1] EventDescriptorsArray;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PROVIDER_EVENT_INFO サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; NumberOfEvents : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Reserved : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; EventDescriptorsArray : EVENT_DESCRIPTOR (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global PROVIDER_EVENT_INFO
#field int NumberOfEvents
#field int Reserved
#field EVENT_DESCRIPTOR EventDescriptorsArray 1
#endstruct
stdim st, PROVIDER_EVENT_INFO ; NSTRUCT 変数を確保
st->NumberOfEvents = 100
mes "NumberOfEvents=" + st->NumberOfEvents