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

TdhGetEventMapInformation

関数
イベントのマップ情報(列挙やビットマップ)を取得する。
DLLTDH.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// TDH.dll
#include <windows.h>

DWORD TdhGetEventMapInformation(
    EVENT_RECORD* pEvent,
    LPWSTR pMapName,
    EVENT_MAP_INFO* pBuffer,   // optional
    DWORD* pBufferSize
);

パラメーター

名前方向説明
pEventEVENT_RECORD*inマップ情報を取得する対象のEVENT_RECORD。
pMapNameLPWSTRin情報を取得するマップ(値テーブル)の名前を指すUnicode文字列。
pBufferEVENT_MAP_INFO*outoptional取得したマップ情報を受け取るEVENT_MAP_INFO構造体。
pBufferSizeDWORD*inout入力でバッファサイズ、出力で必要サイズを受け取るポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

// TDH.dll
#include <windows.h>

DWORD TdhGetEventMapInformation(
    EVENT_RECORD* pEvent,
    LPWSTR pMapName,
    EVENT_MAP_INFO* pBuffer,   // optional
    DWORD* pBufferSize
);
[DllImport("TDH.dll", ExactSpelling = true)]
static extern uint TdhGetEventMapInformation(
    IntPtr pEvent,   // EVENT_RECORD*
    [MarshalAs(UnmanagedType.LPWStr)] string pMapName,   // LPWSTR
    IntPtr pBuffer,   // EVENT_MAP_INFO* optional, out
    ref uint pBufferSize   // DWORD* in/out
);
<DllImport("TDH.dll", ExactSpelling:=True)>
Public Shared Function TdhGetEventMapInformation(
    pEvent As IntPtr,   ' EVENT_RECORD*
    <MarshalAs(UnmanagedType.LPWStr)> pMapName As String,   ' LPWSTR
    pBuffer As IntPtr,   ' EVENT_MAP_INFO* optional, out
    ByRef pBufferSize As UInteger   ' DWORD* in/out
) As UInteger
End Function
' pEvent : EVENT_RECORD*
' pMapName : LPWSTR
' pBuffer : EVENT_MAP_INFO* optional, out
' pBufferSize : DWORD* in/out
Declare PtrSafe Function TdhGetEventMapInformation Lib "tdh" ( _
    ByVal pEvent As LongPtr, _
    ByVal pMapName As LongPtr, _
    ByVal pBuffer As LongPtr, _
    ByRef pBufferSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

TdhGetEventMapInformation = ctypes.windll.tdh.TdhGetEventMapInformation
TdhGetEventMapInformation.restype = wintypes.DWORD
TdhGetEventMapInformation.argtypes = [
    ctypes.c_void_p,  # pEvent : EVENT_RECORD*
    wintypes.LPCWSTR,  # pMapName : LPWSTR
    ctypes.c_void_p,  # pBuffer : EVENT_MAP_INFO* optional, out
    ctypes.POINTER(wintypes.DWORD),  # pBufferSize : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TDH.dll')
TdhGetEventMapInformation = Fiddle::Function.new(
  lib['TdhGetEventMapInformation'],
  [
    Fiddle::TYPE_VOIDP,  # pEvent : EVENT_RECORD*
    Fiddle::TYPE_VOIDP,  # pMapName : LPWSTR
    Fiddle::TYPE_VOIDP,  # pBuffer : EVENT_MAP_INFO* optional, out
    Fiddle::TYPE_VOIDP,  # pBufferSize : DWORD* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "tdh")]
extern "system" {
    fn TdhGetEventMapInformation(
        pEvent: *mut EVENT_RECORD,  // EVENT_RECORD*
        pMapName: *mut u16,  // LPWSTR
        pBuffer: *mut EVENT_MAP_INFO,  // EVENT_MAP_INFO* optional, out
        pBufferSize: *mut u32  // DWORD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TDH.dll")]
public static extern uint TdhGetEventMapInformation(IntPtr pEvent, [MarshalAs(UnmanagedType.LPWStr)] string pMapName, IntPtr pBuffer, ref uint pBufferSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TDH_TdhGetEventMapInformation' -Namespace Win32 -PassThru
# $api::TdhGetEventMapInformation(pEvent, pMapName, pBuffer, pBufferSize)
#uselib "TDH.dll"
#func global TdhGetEventMapInformation "TdhGetEventMapInformation" sptr, sptr, sptr, sptr
; TdhGetEventMapInformation varptr(pEvent), pMapName, varptr(pBuffer), varptr(pBufferSize)   ; 戻り値は stat
; pEvent : EVENT_RECORD* -> "sptr"
; pMapName : LPWSTR -> "sptr"
; pBuffer : EVENT_MAP_INFO* optional, out -> "sptr"
; pBufferSize : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TDH.dll"
#cfunc global TdhGetEventMapInformation "TdhGetEventMapInformation" var, wstr, var, var
; res = TdhGetEventMapInformation(pEvent, pMapName, pBuffer, pBufferSize)
; pEvent : EVENT_RECORD* -> "var"
; pMapName : LPWSTR -> "wstr"
; pBuffer : EVENT_MAP_INFO* optional, out -> "var"
; pBufferSize : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD TdhGetEventMapInformation(EVENT_RECORD* pEvent, LPWSTR pMapName, EVENT_MAP_INFO* pBuffer, DWORD* pBufferSize)
#uselib "TDH.dll"
#cfunc global TdhGetEventMapInformation "TdhGetEventMapInformation" var, wstr, var, var
; res = TdhGetEventMapInformation(pEvent, pMapName, pBuffer, pBufferSize)
; pEvent : EVENT_RECORD* -> "var"
; pMapName : LPWSTR -> "wstr"
; pBuffer : EVENT_MAP_INFO* optional, out -> "var"
; pBufferSize : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tdh = windows.NewLazySystemDLL("TDH.dll")
	procTdhGetEventMapInformation = tdh.NewProc("TdhGetEventMapInformation")
)

// pEvent (EVENT_RECORD*), pMapName (LPWSTR), pBuffer (EVENT_MAP_INFO* optional, out), pBufferSize (DWORD* in/out)
r1, _, err := procTdhGetEventMapInformation.Call(
	uintptr(pEvent),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pMapName))),
	uintptr(pBuffer),
	uintptr(pBufferSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function TdhGetEventMapInformation(
  pEvent: Pointer;   // EVENT_RECORD*
  pMapName: PWideChar;   // LPWSTR
  pBuffer: Pointer;   // EVENT_MAP_INFO* optional, out
  pBufferSize: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'TDH.dll' name 'TdhGetEventMapInformation';
result := DllCall("TDH\TdhGetEventMapInformation"
    , "Ptr", pEvent   ; EVENT_RECORD*
    , "WStr", pMapName   ; LPWSTR
    , "Ptr", pBuffer   ; EVENT_MAP_INFO* optional, out
    , "Ptr", pBufferSize   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●TdhGetEventMapInformation(pEvent, pMapName, pBuffer, pBufferSize) = DLL("TDH.dll", "dword TdhGetEventMapInformation(void*, char*, void*, void*)")
# 呼び出し: TdhGetEventMapInformation(pEvent, pMapName, pBuffer, pBufferSize)
# pEvent : EVENT_RECORD* -> "void*"
# pMapName : LPWSTR -> "char*"
# pBuffer : EVENT_MAP_INFO* optional, out -> "void*"
# pBufferSize : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。