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

ETW_PMC_SESSION_INFO

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

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

フィールド

フィールドサイズx64x86説明
NextEntryOffsetDWORD4+0+0次のエントリへのバイトオフセット。0で末尾。
LoggerIdWORD2+4+4対象トレースセッションのID。
ReservedWORD2+6+6予約フィールド。0であること。
ProfileSourceCountDWORD4+8+8セッションに関連付くプロファイルソース数。
HookIdCountDWORD4+12+12セッションに関連付くフックID数。

各言語での定義

#include <windows.h>

// ETW_PMC_SESSION_INFO  (x64 16 / x86 16 バイト)
typedef struct ETW_PMC_SESSION_INFO {
    DWORD NextEntryOffset;
    WORD LoggerId;
    WORD Reserved;
    DWORD ProfileSourceCount;
    DWORD HookIdCount;
} ETW_PMC_SESSION_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ETW_PMC_SESSION_INFO
{
    public uint NextEntryOffset;
    public ushort LoggerId;
    public ushort Reserved;
    public uint ProfileSourceCount;
    public uint HookIdCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ETW_PMC_SESSION_INFO
    Public NextEntryOffset As UInteger
    Public LoggerId As UShort
    Public Reserved As UShort
    Public ProfileSourceCount As UInteger
    Public HookIdCount As UInteger
End Structure
import ctypes
from ctypes import wintypes

class ETW_PMC_SESSION_INFO(ctypes.Structure):
    _fields_ = [
        ("NextEntryOffset", wintypes.DWORD),
        ("LoggerId", ctypes.c_ushort),
        ("Reserved", ctypes.c_ushort),
        ("ProfileSourceCount", wintypes.DWORD),
        ("HookIdCount", wintypes.DWORD),
    ]
#[repr(C)]
pub struct ETW_PMC_SESSION_INFO {
    pub NextEntryOffset: u32,
    pub LoggerId: u16,
    pub Reserved: u16,
    pub ProfileSourceCount: u32,
    pub HookIdCount: u32,
}
import "golang.org/x/sys/windows"

type ETW_PMC_SESSION_INFO struct {
	NextEntryOffset uint32
	LoggerId uint16
	Reserved uint16
	ProfileSourceCount uint32
	HookIdCount uint32
}
type
  ETW_PMC_SESSION_INFO = record
    NextEntryOffset: DWORD;
    LoggerId: Word;
    Reserved: Word;
    ProfileSourceCount: DWORD;
    HookIdCount: DWORD;
  end;
const ETW_PMC_SESSION_INFO = extern struct {
    NextEntryOffset: u32,
    LoggerId: u16,
    Reserved: u16,
    ProfileSourceCount: u32,
    HookIdCount: u32,
};
type
  ETW_PMC_SESSION_INFO {.bycopy.} = object
    NextEntryOffset: uint32
    LoggerId: uint16
    Reserved: uint16
    ProfileSourceCount: uint32
    HookIdCount: uint32
struct ETW_PMC_SESSION_INFO
{
    uint NextEntryOffset;
    ushort LoggerId;
    ushort Reserved;
    uint ProfileSourceCount;
    uint HookIdCount;
}

HSP用 定義

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

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

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