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

TdhGetManifestEventInformation

関数
マニフェストプロバイダーの指定イベントの情報を取得する。
DLLTDH.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

DWORD TdhGetManifestEventInformation(
    GUID* ProviderGuid,
    EVENT_DESCRIPTOR* EventDescriptor,
    TRACE_EVENT_INFO* Buffer,   // optional
    DWORD* BufferSize
);

パラメーター

名前方向説明
ProviderGuidGUID*in対象プロバイダのGUIDへのポインタ。
EventDescriptorEVENT_DESCRIPTOR*in情報を取得する特定イベントを示すEVENT_DESCRIPTORへのポインタ。
BufferTRACE_EVENT_INFO*outoptionalイベントのメタデータを受け取るTRACE_EVENT_INFO構造体へのポインタ。
BufferSizeDWORD*inoutBufferのサイズ(バイト)を渡し、必要サイズを返すDWORDへのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD TdhGetManifestEventInformation(
    GUID* ProviderGuid,
    EVENT_DESCRIPTOR* EventDescriptor,
    TRACE_EVENT_INFO* Buffer,   // optional
    DWORD* BufferSize
);
[DllImport("TDH.dll", ExactSpelling = true)]
static extern uint TdhGetManifestEventInformation(
    ref Guid ProviderGuid,   // GUID*
    IntPtr EventDescriptor,   // EVENT_DESCRIPTOR*
    IntPtr Buffer,   // TRACE_EVENT_INFO* optional, out
    ref uint BufferSize   // DWORD* in/out
);
<DllImport("TDH.dll", ExactSpelling:=True)>
Public Shared Function TdhGetManifestEventInformation(
    ByRef ProviderGuid As Guid,   ' GUID*
    EventDescriptor As IntPtr,   ' EVENT_DESCRIPTOR*
    Buffer As IntPtr,   ' TRACE_EVENT_INFO* optional, out
    ByRef BufferSize As UInteger   ' DWORD* in/out
) As UInteger
End Function
' ProviderGuid : GUID*
' EventDescriptor : EVENT_DESCRIPTOR*
' Buffer : TRACE_EVENT_INFO* optional, out
' BufferSize : DWORD* in/out
Declare PtrSafe Function TdhGetManifestEventInformation Lib "tdh" ( _
    ByVal ProviderGuid As LongPtr, _
    ByVal EventDescriptor As LongPtr, _
    ByVal Buffer As LongPtr, _
    ByRef BufferSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

TdhGetManifestEventInformation = ctypes.windll.tdh.TdhGetManifestEventInformation
TdhGetManifestEventInformation.restype = wintypes.DWORD
TdhGetManifestEventInformation.argtypes = [
    ctypes.c_void_p,  # ProviderGuid : GUID*
    ctypes.c_void_p,  # EventDescriptor : EVENT_DESCRIPTOR*
    ctypes.c_void_p,  # Buffer : TRACE_EVENT_INFO* optional, out
    ctypes.POINTER(wintypes.DWORD),  # BufferSize : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tdh = windows.NewLazySystemDLL("TDH.dll")
	procTdhGetManifestEventInformation = tdh.NewProc("TdhGetManifestEventInformation")
)

// ProviderGuid (GUID*), EventDescriptor (EVENT_DESCRIPTOR*), Buffer (TRACE_EVENT_INFO* optional, out), BufferSize (DWORD* in/out)
r1, _, err := procTdhGetManifestEventInformation.Call(
	uintptr(ProviderGuid),
	uintptr(EventDescriptor),
	uintptr(Buffer),
	uintptr(BufferSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function TdhGetManifestEventInformation(
  ProviderGuid: PGUID;   // GUID*
  EventDescriptor: Pointer;   // EVENT_DESCRIPTOR*
  Buffer: Pointer;   // TRACE_EVENT_INFO* optional, out
  BufferSize: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'TDH.dll' name 'TdhGetManifestEventInformation';
result := DllCall("TDH\TdhGetManifestEventInformation"
    , "Ptr", ProviderGuid   ; GUID*
    , "Ptr", EventDescriptor   ; EVENT_DESCRIPTOR*
    , "Ptr", Buffer   ; TRACE_EVENT_INFO* optional, out
    , "Ptr", BufferSize   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●TdhGetManifestEventInformation(ProviderGuid, EventDescriptor, Buffer, BufferSize) = DLL("TDH.dll", "dword TdhGetManifestEventInformation(void*, void*, void*, void*)")
# 呼び出し: TdhGetManifestEventInformation(ProviderGuid, EventDescriptor, Buffer, BufferSize)
# ProviderGuid : GUID* -> "void*"
# EventDescriptor : EVENT_DESCRIPTOR* -> "void*"
# Buffer : TRACE_EVENT_INFO* optional, out -> "void*"
# BufferSize : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。