ホーム › NetworkManagement.WindowsFilteringPlatform › FwpmLayerSetSecurityInfoByKey0
FwpmLayerSetSecurityInfoByKey0
関数指定キーのWFPレイヤーのセキュリティ情報を設定する。
シグネチャ
// fwpuclnt.dll
#include <windows.h>
DWORD FwpmLayerSetSecurityInfoByKey0(
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
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| engineHandle | FWPM_ENGINE_HANDLE | in |
| key | GUID* | inoptional |
| securityInfo | DWORD | in |
| sidOwner | SID* | inoptional |
| sidGroup | SID* | inoptional |
| dacl | ACL* | inoptional |
| sacl | ACL* | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// fwpuclnt.dll
#include <windows.h>
DWORD FwpmLayerSetSecurityInfoByKey0(
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 FwpmLayerSetSecurityInfoByKey0(
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 FwpmLayerSetSecurityInfoByKey0(
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 FwpmLayerSetSecurityInfoByKey0 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
FwpmLayerSetSecurityInfoByKey0 = ctypes.windll.fwpuclnt.FwpmLayerSetSecurityInfoByKey0
FwpmLayerSetSecurityInfoByKey0.restype = wintypes.DWORD
FwpmLayerSetSecurityInfoByKey0.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')
FwpmLayerSetSecurityInfoByKey0 = Fiddle::Function.new(
lib['FwpmLayerSetSecurityInfoByKey0'],
[
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 FwpmLayerSetSecurityInfoByKey0(
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 FwpmLayerSetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, IntPtr key, uint securityInfo, IntPtr sidOwner, IntPtr sidGroup, IntPtr dacl, IntPtr sacl);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fwpuclnt_FwpmLayerSetSecurityInfoByKey0' -Namespace Win32 -PassThru
# $api::FwpmLayerSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl)#uselib "fwpuclnt.dll"
#func global FwpmLayerSetSecurityInfoByKey0 "FwpmLayerSetSecurityInfoByKey0" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; FwpmLayerSetSecurityInfoByKey0 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 FwpmLayerSetSecurityInfoByKey0 "FwpmLayerSetSecurityInfoByKey0" int, var, int, var, var, var, var ; res = FwpmLayerSetSecurityInfoByKey0(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 方式にも切替可。#uselib "fwpuclnt.dll" #cfunc global FwpmLayerSetSecurityInfoByKey0 "FwpmLayerSetSecurityInfoByKey0" int, sptr, int, sptr, sptr, sptr, sptr ; res = FwpmLayerSetSecurityInfoByKey0(engineHandle, varptr(key), securityInfo, varptr(sidOwner), varptr(sidGroup), varptr(dacl), varptr(sacl)) ; engineHandle : FWPM_ENGINE_HANDLE -> "int" ; key : GUID* optional -> "sptr" ; securityInfo : DWORD -> "int" ; sidOwner : SID* optional -> "sptr" ; sidGroup : SID* optional -> "sptr" ; dacl : ACL* optional -> "sptr" ; sacl : ACL* optional -> "sptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD FwpmLayerSetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, GUID* key, DWORD securityInfo, SID* sidOwner, SID* sidGroup, ACL* dacl, ACL* sacl) #uselib "fwpuclnt.dll" #cfunc global FwpmLayerSetSecurityInfoByKey0 "FwpmLayerSetSecurityInfoByKey0" int, var, int, var, var, var, var ; res = FwpmLayerSetSecurityInfoByKey0(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 FwpmLayerSetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, GUID* key, DWORD securityInfo, SID* sidOwner, SID* sidGroup, ACL* dacl, ACL* sacl) #uselib "fwpuclnt.dll" #cfunc global FwpmLayerSetSecurityInfoByKey0 "FwpmLayerSetSecurityInfoByKey0" int, intptr, int, intptr, intptr, intptr, intptr ; res = FwpmLayerSetSecurityInfoByKey0(engineHandle, varptr(key), securityInfo, varptr(sidOwner), varptr(sidGroup), varptr(dacl), varptr(sacl)) ; engineHandle : FWPM_ENGINE_HANDLE -> "int" ; key : GUID* optional -> "intptr" ; securityInfo : DWORD -> "int" ; sidOwner : SID* optional -> "intptr" ; sidGroup : SID* optional -> "intptr" ; dacl : ACL* optional -> "intptr" ; sacl : ACL* optional -> "intptr" ; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。 ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
fwpuclnt = windows.NewLazySystemDLL("fwpuclnt.dll")
procFwpmLayerSetSecurityInfoByKey0 = fwpuclnt.NewProc("FwpmLayerSetSecurityInfoByKey0")
)
// engineHandle (FWPM_ENGINE_HANDLE), key (GUID* optional), securityInfo (DWORD), sidOwner (SID* optional), sidGroup (SID* optional), dacl (ACL* optional), sacl (ACL* optional)
r1, _, err := procFwpmLayerSetSecurityInfoByKey0.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 // DWORDfunction FwpmLayerSetSecurityInfoByKey0(
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 'FwpmLayerSetSecurityInfoByKey0';result := DllCall("fwpuclnt\FwpmLayerSetSecurityInfoByKey0"
, "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●FwpmLayerSetSecurityInfoByKey0(engineHandle, key, securityInfo, sidOwner, sidGroup, dacl, sacl) = DLL("fwpuclnt.dll", "dword FwpmLayerSetSecurityInfoByKey0(void*, void*, dword, void*, void*, void*, void*)")
# 呼び出し: FwpmLayerSetSecurityInfoByKey0(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)。