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

EventSetInformation

関数
ETWイベントプロバイダーに対して情報を設定する。
DLLADVAPI32.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD EventSetInformation(
    REGHANDLE RegHandle,
    EVENT_INFO_CLASS InformationClass,
    void* EventInformation,
    DWORD InformationLength
);

パラメーター

名前方向
RegHandleREGHANDLEin
InformationClassEVENT_INFO_CLASSin
EventInformationvoid*in
InformationLengthDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD EventSetInformation(
    REGHANDLE RegHandle,
    EVENT_INFO_CLASS InformationClass,
    void* EventInformation,
    DWORD InformationLength
);
[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern uint EventSetInformation(
    long RegHandle,   // REGHANDLE
    int InformationClass,   // EVENT_INFO_CLASS
    IntPtr EventInformation,   // void*
    uint InformationLength   // DWORD
);
<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Function EventSetInformation(
    RegHandle As Long,   ' REGHANDLE
    InformationClass As Integer,   ' EVENT_INFO_CLASS
    EventInformation As IntPtr,   ' void*
    InformationLength As UInteger   ' DWORD
) As UInteger
End Function
' RegHandle : REGHANDLE
' InformationClass : EVENT_INFO_CLASS
' EventInformation : void*
' InformationLength : DWORD
Declare PtrSafe Function EventSetInformation Lib "advapi32" ( _
    ByVal RegHandle As LongLong, _
    ByVal InformationClass As Long, _
    ByVal EventInformation As LongPtr, _
    ByVal InformationLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EventSetInformation = ctypes.windll.advapi32.EventSetInformation
EventSetInformation.restype = wintypes.DWORD
EventSetInformation.argtypes = [
    ctypes.c_longlong,  # RegHandle : REGHANDLE
    ctypes.c_int,  # InformationClass : EVENT_INFO_CLASS
    ctypes.POINTER(None),  # EventInformation : void*
    wintypes.DWORD,  # InformationLength : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
EventSetInformation = Fiddle::Function.new(
  lib['EventSetInformation'],
  [
    Fiddle::TYPE_LONG_LONG,  # RegHandle : REGHANDLE
    Fiddle::TYPE_INT,  # InformationClass : EVENT_INFO_CLASS
    Fiddle::TYPE_VOIDP,  # EventInformation : void*
    -Fiddle::TYPE_INT,  # InformationLength : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "advapi32")]
extern "system" {
    fn EventSetInformation(
        RegHandle: i64,  // REGHANDLE
        InformationClass: i32,  // EVENT_INFO_CLASS
        EventInformation: *mut (),  // void*
        InformationLength: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern uint EventSetInformation(long RegHandle, int InformationClass, IntPtr EventInformation, uint InformationLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_EventSetInformation' -Namespace Win32 -PassThru
# $api::EventSetInformation(RegHandle, InformationClass, EventInformation, InformationLength)
#uselib "ADVAPI32.dll"
#func global EventSetInformation "EventSetInformation" sptr, sptr, sptr, sptr
; EventSetInformation RegHandle, InformationClass, EventInformation, InformationLength   ; 戻り値は stat
; RegHandle : REGHANDLE -> "sptr"
; InformationClass : EVENT_INFO_CLASS -> "sptr"
; EventInformation : void* -> "sptr"
; InformationLength : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVAPI32.dll"
#cfunc global EventSetInformation "EventSetInformation" int64, int, sptr, int
; res = EventSetInformation(RegHandle, InformationClass, EventInformation, InformationLength)
; RegHandle : REGHANDLE -> "int64"
; InformationClass : EVENT_INFO_CLASS -> "int"
; EventInformation : void* -> "sptr"
; InformationLength : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; DWORD EventSetInformation(REGHANDLE RegHandle, EVENT_INFO_CLASS InformationClass, void* EventInformation, DWORD InformationLength)
#uselib "ADVAPI32.dll"
#cfunc global EventSetInformation "EventSetInformation" int64, int, intptr, int
; res = EventSetInformation(RegHandle, InformationClass, EventInformation, InformationLength)
; RegHandle : REGHANDLE -> "int64"
; InformationClass : EVENT_INFO_CLASS -> "int"
; EventInformation : void* -> "intptr"
; InformationLength : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procEventSetInformation = advapi32.NewProc("EventSetInformation")
)

// RegHandle (REGHANDLE), InformationClass (EVENT_INFO_CLASS), EventInformation (void*), InformationLength (DWORD)
r1, _, err := procEventSetInformation.Call(
	uintptr(RegHandle),
	uintptr(InformationClass),
	uintptr(EventInformation),
	uintptr(InformationLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function EventSetInformation(
  RegHandle: Int64;   // REGHANDLE
  InformationClass: Integer;   // EVENT_INFO_CLASS
  EventInformation: Pointer;   // void*
  InformationLength: DWORD   // DWORD
): DWORD; stdcall;
  external 'ADVAPI32.dll' name 'EventSetInformation';
result := DllCall("ADVAPI32\EventSetInformation"
    , "Int64", RegHandle   ; REGHANDLE
    , "Int", InformationClass   ; EVENT_INFO_CLASS
    , "Ptr", EventInformation   ; void*
    , "UInt", InformationLength   ; DWORD
    , "UInt")   ; return: DWORD
●EventSetInformation(RegHandle, InformationClass, EventInformation, InformationLength) = DLL("ADVAPI32.dll", "dword EventSetInformation(int64, int, void*, dword)")
# 呼び出し: EventSetInformation(RegHandle, InformationClass, EventInformation, InformationLength)
# RegHandle : REGHANDLE -> "int64"
# InformationClass : EVENT_INFO_CLASS -> "int"
# EventInformation : void* -> "void*"
# InformationLength : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。