Win32 API 日本語リファレンス
ホームNetworkManagement.WindowsFilteringPlatform › FwpmProviderSetSecurityInfoByKey0

FwpmProviderSetSecurityInfoByKey0

関数
指定キーのWFPプロバイダーのセキュリティ情報を設定する。
DLLfwpuclnt.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD FwpmProviderSetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    const GUID* key,   // optional
    DWORD securityInfo,
    const SID* sidOwner,   // optional
    const SID* sidGroup,   // optional
    const ACL* dacl,   // optional
    const ACL* sacl   // optional
);

パラメーター

名前方向
engineHandleFWPM_ENGINE_HANDLEin
keyGUID*inoptional
securityInfoDWORDin
sidOwnerSID*inoptional
sidGroupSID*inoptional
daclACL*inoptional
saclACL*inoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD FwpmProviderSetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    const GUID* key,   // optional
    DWORD securityInfo,
    const SID* sidOwner,   // optional
    const SID* sidGroup,   // optional
    const ACL* dacl,   // optional
    const ACL* sacl   // optional
);
[DllImport("fwpuclnt.dll", ExactSpelling = true)]
static extern uint FwpmProviderSetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,   // FWPM_ENGINE_HANDLE
    IntPtr key,   // GUID* optional
    uint securityInfo,   // DWORD
    IntPtr sidOwner,   // SID* optional
    IntPtr sidGroup,   // SID* optional
    IntPtr dacl,   // ACL* optional
    IntPtr sacl   // ACL* optional
);
<DllImport("fwpuclnt.dll", ExactSpelling:=True)>
Public Shared Function FwpmProviderSetSecurityInfoByKey0(
    engineHandle As FWPM_ENGINE_HANDLE,   ' FWPM_ENGINE_HANDLE
    key As IntPtr,   ' GUID* optional
    securityInfo As UInteger,   ' DWORD
    sidOwner As IntPtr,   ' SID* optional
    sidGroup As IntPtr,   ' SID* optional
    dacl As IntPtr,   ' ACL* optional
    sacl As IntPtr   ' ACL* optional
) As UInteger
End Function
' engineHandle : FWPM_ENGINE_HANDLE
' key : GUID* optional
' securityInfo : DWORD
' sidOwner : SID* optional
' sidGroup : SID* optional
' dacl : ACL* optional
' sacl : ACL* optional
Declare PtrSafe Function FwpmProviderSetSecurityInfoByKey0 Lib "fwpuclnt" ( _
    ByVal engineHandle As LongPtr, _
    ByVal key As LongPtr, _
    ByVal securityInfo As Long, _
    ByVal sidOwner As LongPtr, _
    ByVal sidGroup As LongPtr, _
    ByVal dacl As LongPtr, _
    ByVal sacl As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FwpmProviderSetSecurityInfoByKey0 = ctypes.windll.fwpuclnt.FwpmProviderSetSecurityInfoByKey0
FwpmProviderSetSecurityInfoByKey0.restype = wintypes.DWORD
FwpmProviderSetSecurityInfoByKey0.argtypes = [
    FWPM_ENGINE_HANDLE,  # engineHandle : FWPM_ENGINE_HANDLE
    ctypes.c_void_p,  # key : GUID* optional
    wintypes.DWORD,  # securityInfo : DWORD
    ctypes.c_void_p,  # sidOwner : SID* optional
    ctypes.c_void_p,  # sidGroup : SID* optional
    ctypes.c_void_p,  # dacl : ACL* optional
    ctypes.c_void_p,  # sacl : ACL* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('fwpuclnt.dll')
FwpmProviderSetSecurityInfoByKey0 = Fiddle::Function.new(
  lib['FwpmProviderSetSecurityInfoByKey0'],
  [
    Fiddle::TYPE_VOIDP,  # engineHandle : FWPM_ENGINE_HANDLE
    Fiddle::TYPE_VOIDP,  # key : GUID* optional
    -Fiddle::TYPE_INT,  # securityInfo : DWORD
    Fiddle::TYPE_VOIDP,  # sidOwner : SID* optional
    Fiddle::TYPE_VOIDP,  # sidGroup : SID* optional
    Fiddle::TYPE_VOIDP,  # dacl : ACL* optional
    Fiddle::TYPE_VOIDP,  # sacl : ACL* optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "fwpuclnt")]
extern "system" {
    fn FwpmProviderSetSecurityInfoByKey0(
        engineHandle: FWPM_ENGINE_HANDLE,  // FWPM_ENGINE_HANDLE
        key: *const GUID,  // GUID* optional
        securityInfo: u32,  // DWORD
        sidOwner: *const SID,  // SID* optional
        sidGroup: *const SID,  // SID* optional
        dacl: *const ACL,  // ACL* optional
        sacl: *const ACL  // ACL* optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("fwpuclnt.dll")]
public static extern uint FwpmProviderSetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, IntPtr key, uint securityInfo, IntPtr sidOwner, IntPtr sidGroup, IntPtr dacl, IntPtr sacl);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fwpuclnt_FwpmProviderSetSecurityInfoByKey0' -Namespace Win32 -PassThru
# $api::FwpmProviderSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl)
#uselib "fwpuclnt.dll"
#func global FwpmProviderSetSecurityInfoByKey0 "FwpmProviderSetSecurityInfoByKey0" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; FwpmProviderSetSecurityInfoByKey0 engineHandle, varptr(key), securityInfo, varptr(sidOwner), varptr(sidGroup), varptr(dacl), varptr(sacl)   ; 戻り値は stat
; engineHandle : FWPM_ENGINE_HANDLE -> "sptr"
; key : GUID* optional -> "sptr"
; securityInfo : DWORD -> "sptr"
; sidOwner : SID* optional -> "sptr"
; sidGroup : SID* optional -> "sptr"
; dacl : ACL* optional -> "sptr"
; sacl : ACL* optional -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "fwpuclnt.dll"
#cfunc global FwpmProviderSetSecurityInfoByKey0 "FwpmProviderSetSecurityInfoByKey0" int, var, int, var, var, var, var
; res = FwpmProviderSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl)
; engineHandle : FWPM_ENGINE_HANDLE -> "int"
; key : GUID* optional -> "var"
; securityInfo : DWORD -> "int"
; sidOwner : SID* optional -> "var"
; sidGroup : SID* optional -> "var"
; dacl : ACL* optional -> "var"
; sacl : ACL* optional -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD FwpmProviderSetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, GUID* key, DWORD securityInfo, SID* sidOwner, SID* sidGroup, ACL* dacl, ACL* sacl)
#uselib "fwpuclnt.dll"
#cfunc global FwpmProviderSetSecurityInfoByKey0 "FwpmProviderSetSecurityInfoByKey0" int, var, int, var, var, var, var
; res = FwpmProviderSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl)
; engineHandle : FWPM_ENGINE_HANDLE -> "int"
; key : GUID* optional -> "var"
; securityInfo : DWORD -> "int"
; sidOwner : SID* optional -> "var"
; sidGroup : SID* optional -> "var"
; dacl : ACL* optional -> "var"
; sacl : ACL* optional -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	fwpuclnt = windows.NewLazySystemDLL("fwpuclnt.dll")
	procFwpmProviderSetSecurityInfoByKey0 = fwpuclnt.NewProc("FwpmProviderSetSecurityInfoByKey0")
)

// engineHandle (FWPM_ENGINE_HANDLE), key (GUID* optional), securityInfo (DWORD), sidOwner (SID* optional), sidGroup (SID* optional), dacl (ACL* optional), sacl (ACL* optional)
r1, _, err := procFwpmProviderSetSecurityInfoByKey0.Call(
	uintptr(engineHandle),
	uintptr(key),
	uintptr(securityInfo),
	uintptr(sidOwner),
	uintptr(sidGroup),
	uintptr(dacl),
	uintptr(sacl),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function FwpmProviderSetSecurityInfoByKey0(
  engineHandle: FWPM_ENGINE_HANDLE;   // FWPM_ENGINE_HANDLE
  key: PGUID;   // GUID* optional
  securityInfo: DWORD;   // DWORD
  sidOwner: Pointer;   // SID* optional
  sidGroup: Pointer;   // SID* optional
  dacl: Pointer;   // ACL* optional
  sacl: Pointer   // ACL* optional
): DWORD; stdcall;
  external 'fwpuclnt.dll' name 'FwpmProviderSetSecurityInfoByKey0';
result := DllCall("fwpuclnt\FwpmProviderSetSecurityInfoByKey0"
    , "Ptr", engineHandle   ; FWPM_ENGINE_HANDLE
    , "Ptr", key   ; GUID* optional
    , "UInt", securityInfo   ; DWORD
    , "Ptr", sidOwner   ; SID* optional
    , "Ptr", sidGroup   ; SID* optional
    , "Ptr", dacl   ; ACL* optional
    , "Ptr", sacl   ; ACL* optional
    , "UInt")   ; return: DWORD
●FwpmProviderSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl) = DLL("fwpuclnt.dll", "dword FwpmProviderSetSecurityInfoByKey0(void*, void*, dword, void*, void*, void*, void*)")
# 呼び出し: FwpmProviderSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl)
# engineHandle : FWPM_ENGINE_HANDLE -> "void*"
# key : GUID* optional -> "void*"
# securityInfo : DWORD -> "dword"
# sidOwner : SID* optional -> "void*"
# sidGroup : SID* optional -> "void*"
# dacl : ACL* optional -> "void*"
# sacl : ACL* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。