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

TdhCleanupPayloadEventFilterDescriptor

関数
ペイロードイベントフィルター記述子の資源を解放する。
DLLTDH.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

DWORD TdhCleanupPayloadEventFilterDescriptor(
    EVENT_FILTER_DESCRIPTOR* EventFilterDescriptor
);

パラメーター

名前方向説明
EventFilterDescriptorEVENT_FILTER_DESCRIPTOR*inout

解放対象として割り当てられたメモリを含む、集約されたフィルターを保持する EVENT_FILTER_DESCRIPTOR 構造体へのポインターです。渡される EVENT_FILTER_DESCRIPTOR 構造体は、TdhAggregatePayloadFilters 関数を呼び出して作成されたものです。

呼び出しが成功すると、集約されたフィルターに割り当てられていたメモリが解放され、返される EVENT_FILTER_DESCRIPTOR 構造体のフィールドが再初期化されます。

戻り値の型: DWORD

公式ドキュメント

TdhAggregatePayloadFilters 関数を使用して作成された、ペイロードフィルターの集約構造体を解放します。

戻り値

成功した場合は ERROR_SUCCESS を返します。それ以外の場合、この関数は次の戻り値コードのいずれか、またはその他のコードを返します。

戻り値コード 説明
ERROR_INVALID_PARAMETER
1 つ以上のパラメーターが無効です。

解説(Remarks)

Windows 8.1、Windows Server 2012 R2 以降では、イベントペイロードフィルターを EnableTraceEx2 関数で使用し、ロガーセッション内のイベントの特定の内容に基づいてフィルター処理を行うことができます。

TdhCleanupPayloadEventFilterDescriptor 関数は、TdhAggregatePayloadFilters 関数によって返された、割り当て済みメモリを解放するために使用します。

TdhCleanupPayloadEventFilterDescriptor 関数を使用して集約ペイロードフィルターが使用するメモリを解放する例については、EnableTraceEx2 関数の例を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

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

TdhCleanupPayloadEventFilterDescriptor = ctypes.windll.tdh.TdhCleanupPayloadEventFilterDescriptor
TdhCleanupPayloadEventFilterDescriptor.restype = wintypes.DWORD
TdhCleanupPayloadEventFilterDescriptor.argtypes = [
    ctypes.c_void_p,  # EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tdh = windows.NewLazySystemDLL("TDH.dll")
	procTdhCleanupPayloadEventFilterDescriptor = tdh.NewProc("TdhCleanupPayloadEventFilterDescriptor")
)

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

extern "tdh" fn TdhCleanupPayloadEventFilterDescriptor(
    EventFilterDescriptor: [*c]EVENT_FILTER_DESCRIPTOR // EVENT_FILTER_DESCRIPTOR* in/out
) callconv(std.os.windows.WINAPI) u32;
proc TdhCleanupPayloadEventFilterDescriptor(
    EventFilterDescriptor: ptr EVENT_FILTER_DESCRIPTOR  # EVENT_FILTER_DESCRIPTOR* in/out
): uint32 {.importc: "TdhCleanupPayloadEventFilterDescriptor", stdcall, dynlib: "TDH.dll".}
pragma(lib, "tdh");
extern(Windows)
uint TdhCleanupPayloadEventFilterDescriptor(
    EVENT_FILTER_DESCRIPTOR* EventFilterDescriptor   // EVENT_FILTER_DESCRIPTOR* in/out
);
ccall((:TdhCleanupPayloadEventFilterDescriptor, "TDH.dll"), stdcall, UInt32,
      (Ptr{EVENT_FILTER_DESCRIPTOR},),
      EventFilterDescriptor)
# EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> Ptr{EVENT_FILTER_DESCRIPTOR}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t TdhCleanupPayloadEventFilterDescriptor(
    void* EventFilterDescriptor);
]]
local tdh = ffi.load("tdh")
-- tdh.TdhCleanupPayloadEventFilterDescriptor(EventFilterDescriptor)
-- EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('TDH.dll');
const TdhCleanupPayloadEventFilterDescriptor = lib.func('__stdcall', 'TdhCleanupPayloadEventFilterDescriptor', 'uint32_t', ['void *']);
// TdhCleanupPayloadEventFilterDescriptor(EventFilterDescriptor)
// EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("TDH.dll", {
  TdhCleanupPayloadEventFilterDescriptor: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.TdhCleanupPayloadEventFilterDescriptor(EventFilterDescriptor)
// EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t TdhCleanupPayloadEventFilterDescriptor(
    void* EventFilterDescriptor);
C, "TDH.dll");
// $ffi->TdhCleanupPayloadEventFilterDescriptor(EventFilterDescriptor);
// EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Tdh extends StdCallLibrary {
    Tdh INSTANCE = Native.load("tdh", Tdh.class);
    int TdhCleanupPayloadEventFilterDescriptor(
        Pointer EventFilterDescriptor   // EVENT_FILTER_DESCRIPTOR* in/out
    );
}
@[Link("tdh")]
lib LibTDH
  fun TdhCleanupPayloadEventFilterDescriptor = TdhCleanupPayloadEventFilterDescriptor(
    EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR*   # EVENT_FILTER_DESCRIPTOR* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef TdhCleanupPayloadEventFilterDescriptorNative = Uint32 Function(Pointer<Void>);
typedef TdhCleanupPayloadEventFilterDescriptorDart = int Function(Pointer<Void>);
final TdhCleanupPayloadEventFilterDescriptor = DynamicLibrary.open('TDH.dll')
    .lookupFunction<TdhCleanupPayloadEventFilterDescriptorNative, TdhCleanupPayloadEventFilterDescriptorDart>('TdhCleanupPayloadEventFilterDescriptor');
// EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function TdhCleanupPayloadEventFilterDescriptor(
  EventFilterDescriptor: Pointer   // EVENT_FILTER_DESCRIPTOR* in/out
): DWORD; stdcall;
  external 'TDH.dll' name 'TdhCleanupPayloadEventFilterDescriptor';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "TdhCleanupPayloadEventFilterDescriptor"
  c_TdhCleanupPayloadEventFilterDescriptor :: Ptr () -> IO Word32
-- EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let tdhcleanuppayloadeventfilterdescriptor =
  foreign "TdhCleanupPayloadEventFilterDescriptor"
    ((ptr void) @-> returning uint32_t)
(* EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library tdh (t "TDH.dll"))
(cffi:use-foreign-library tdh)

(cffi:defcfun ("TdhCleanupPayloadEventFilterDescriptor" tdh-cleanup-payload-event-filter-descriptor :convention :stdcall) :uint32
  (event-filter-descriptor :pointer))   ; EVENT_FILTER_DESCRIPTOR* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $TdhCleanupPayloadEventFilterDescriptor = Win32::API::More->new('TDH',
    'DWORD TdhCleanupPayloadEventFilterDescriptor(LPVOID EventFilterDescriptor)');
# my $ret = $TdhCleanupPayloadEventFilterDescriptor->Call($EventFilterDescriptor);
# EventFilterDescriptor : EVENT_FILTER_DESCRIPTOR* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型