ホーム › System.Diagnostics.Etw › EventAccessControl
EventAccessControl
関数ETWプロバイダーへのアクセス権限を許可または拒否する。
シグネチャ
// ADVAPI32.dll
#include <windows.h>
DWORD EventAccessControl(
GUID* Guid,
DWORD Operation,
PSID Sid,
DWORD Rights,
BOOLEAN AllowOrDeny
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Guid | GUID* | in |
| Operation | DWORD | in |
| Sid | PSID | in |
| Rights | DWORD | in |
| AllowOrDeny | BOOLEAN | in |
戻り値の型: DWORD
各言語での呼び出し定義
// ADVAPI32.dll
#include <windows.h>
DWORD EventAccessControl(
GUID* Guid,
DWORD Operation,
PSID Sid,
DWORD Rights,
BOOLEAN AllowOrDeny
);[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern uint EventAccessControl(
ref Guid Guid, // GUID*
uint Operation, // DWORD
IntPtr Sid, // PSID
uint Rights, // DWORD
[MarshalAs(UnmanagedType.U1)] bool AllowOrDeny // BOOLEAN
);<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Function EventAccessControl(
ByRef Guid As Guid, ' GUID*
Operation As UInteger, ' DWORD
Sid As IntPtr, ' PSID
Rights As UInteger, ' DWORD
<MarshalAs(UnmanagedType.U1)> AllowOrDeny As Boolean ' BOOLEAN
) As UInteger
End Function' Guid : GUID*
' Operation : DWORD
' Sid : PSID
' Rights : DWORD
' AllowOrDeny : BOOLEAN
Declare PtrSafe Function EventAccessControl Lib "advapi32" ( _
ByVal Guid As LongPtr, _
ByVal Operation As Long, _
ByVal Sid As LongPtr, _
ByVal Rights As Long, _
ByVal AllowOrDeny As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EventAccessControl = ctypes.windll.advapi32.EventAccessControl
EventAccessControl.restype = wintypes.DWORD
EventAccessControl.argtypes = [
ctypes.c_void_p, # Guid : GUID*
wintypes.DWORD, # Operation : DWORD
wintypes.HANDLE, # Sid : PSID
wintypes.DWORD, # Rights : DWORD
ctypes.c_byte, # AllowOrDeny : BOOLEAN
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
EventAccessControl = Fiddle::Function.new(
lib['EventAccessControl'],
[
Fiddle::TYPE_VOIDP, # Guid : GUID*
-Fiddle::TYPE_INT, # Operation : DWORD
Fiddle::TYPE_VOIDP, # Sid : PSID
-Fiddle::TYPE_INT, # Rights : DWORD
Fiddle::TYPE_CHAR, # AllowOrDeny : BOOLEAN
],
-Fiddle::TYPE_INT)#[link(name = "advapi32")]
extern "system" {
fn EventAccessControl(
Guid: *mut GUID, // GUID*
Operation: u32, // DWORD
Sid: *mut core::ffi::c_void, // PSID
Rights: u32, // DWORD
AllowOrDeny: u8 // BOOLEAN
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern uint EventAccessControl(ref Guid Guid, uint Operation, IntPtr Sid, uint Rights, [MarshalAs(UnmanagedType.U1)] bool AllowOrDeny);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_EventAccessControl' -Namespace Win32 -PassThru
# $api::EventAccessControl(Guid, Operation, Sid, Rights, AllowOrDeny)#uselib "ADVAPI32.dll"
#func global EventAccessControl "EventAccessControl" sptr, sptr, sptr, sptr, sptr
; EventAccessControl varptr(Guid), Operation, Sid, Rights, AllowOrDeny ; 戻り値は stat
; Guid : GUID* -> "sptr"
; Operation : DWORD -> "sptr"
; Sid : PSID -> "sptr"
; Rights : DWORD -> "sptr"
; AllowOrDeny : BOOLEAN -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ADVAPI32.dll" #cfunc global EventAccessControl "EventAccessControl" var, int, sptr, int, int ; res = EventAccessControl(Guid, Operation, Sid, Rights, AllowOrDeny) ; Guid : GUID* -> "var" ; Operation : DWORD -> "int" ; Sid : PSID -> "sptr" ; Rights : DWORD -> "int" ; AllowOrDeny : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #cfunc global EventAccessControl "EventAccessControl" sptr, int, sptr, int, int ; res = EventAccessControl(varptr(Guid), Operation, Sid, Rights, AllowOrDeny) ; Guid : GUID* -> "sptr" ; Operation : DWORD -> "int" ; Sid : PSID -> "sptr" ; Rights : DWORD -> "int" ; AllowOrDeny : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD EventAccessControl(GUID* Guid, DWORD Operation, PSID Sid, DWORD Rights, BOOLEAN AllowOrDeny) #uselib "ADVAPI32.dll" #cfunc global EventAccessControl "EventAccessControl" var, int, intptr, int, int ; res = EventAccessControl(Guid, Operation, Sid, Rights, AllowOrDeny) ; Guid : GUID* -> "var" ; Operation : DWORD -> "int" ; Sid : PSID -> "intptr" ; Rights : DWORD -> "int" ; AllowOrDeny : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD EventAccessControl(GUID* Guid, DWORD Operation, PSID Sid, DWORD Rights, BOOLEAN AllowOrDeny) #uselib "ADVAPI32.dll" #cfunc global EventAccessControl "EventAccessControl" intptr, int, intptr, int, int ; res = EventAccessControl(varptr(Guid), Operation, Sid, Rights, AllowOrDeny) ; Guid : GUID* -> "intptr" ; Operation : DWORD -> "int" ; Sid : PSID -> "intptr" ; Rights : DWORD -> "int" ; AllowOrDeny : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procEventAccessControl = advapi32.NewProc("EventAccessControl")
)
// Guid (GUID*), Operation (DWORD), Sid (PSID), Rights (DWORD), AllowOrDeny (BOOLEAN)
r1, _, err := procEventAccessControl.Call(
uintptr(Guid),
uintptr(Operation),
uintptr(Sid),
uintptr(Rights),
uintptr(AllowOrDeny),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction EventAccessControl(
Guid: PGUID; // GUID*
Operation: DWORD; // DWORD
Sid: THandle; // PSID
Rights: DWORD; // DWORD
AllowOrDeny: ByteBool // BOOLEAN
): DWORD; stdcall;
external 'ADVAPI32.dll' name 'EventAccessControl';result := DllCall("ADVAPI32\EventAccessControl"
, "Ptr", Guid ; GUID*
, "UInt", Operation ; DWORD
, "Ptr", Sid ; PSID
, "UInt", Rights ; DWORD
, "Char", AllowOrDeny ; BOOLEAN
, "UInt") ; return: DWORD●EventAccessControl(Guid, Operation, Sid, Rights, AllowOrDeny) = DLL("ADVAPI32.dll", "dword EventAccessControl(void*, dword, void*, dword, byte)")
# 呼び出し: EventAccessControl(Guid, Operation, Sid, Rights, AllowOrDeny)
# Guid : GUID* -> "void*"
# Operation : DWORD -> "dword"
# Sid : PSID -> "void*"
# Rights : DWORD -> "dword"
# AllowOrDeny : BOOLEAN -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。