ホーム › NetworkManagement.WindowsFilteringPlatform › FwpmSystemPortsSubscribe0
FwpmSystemPortsSubscribe0
関数WFPのシステムポート変更通知を購読する。
シグネチャ
// fwpuclnt.dll
#include <windows.h>
DWORD FwpmSystemPortsSubscribe0(
FWPM_ENGINE_HANDLE engineHandle, // optional
void* reserved, // optional
FWPM_SYSTEM_PORTS_CALLBACK0 callback,
void* context, // optional
HANDLE* sysPortsHandle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| engineHandle | FWPM_ENGINE_HANDLE | inoptional |
| reserved | void* | optional |
| callback | FWPM_SYSTEM_PORTS_CALLBACK0 | in |
| context | void* | inoptional |
| sysPortsHandle | HANDLE* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// fwpuclnt.dll
#include <windows.h>
DWORD FwpmSystemPortsSubscribe0(
FWPM_ENGINE_HANDLE engineHandle, // optional
void* reserved, // optional
FWPM_SYSTEM_PORTS_CALLBACK0 callback,
void* context, // optional
HANDLE* sysPortsHandle
);[DllImport("fwpuclnt.dll", ExactSpelling = true)]
static extern uint FwpmSystemPortsSubscribe0(
FWPM_ENGINE_HANDLE engineHandle, // FWPM_ENGINE_HANDLE optional
IntPtr reserved, // void* optional
IntPtr callback, // FWPM_SYSTEM_PORTS_CALLBACK0
IntPtr context, // void* optional
IntPtr sysPortsHandle // HANDLE* out
);<DllImport("fwpuclnt.dll", ExactSpelling:=True)>
Public Shared Function FwpmSystemPortsSubscribe0(
engineHandle As FWPM_ENGINE_HANDLE, ' FWPM_ENGINE_HANDLE optional
reserved As IntPtr, ' void* optional
callback As IntPtr, ' FWPM_SYSTEM_PORTS_CALLBACK0
context As IntPtr, ' void* optional
sysPortsHandle As IntPtr ' HANDLE* out
) As UInteger
End Function' engineHandle : FWPM_ENGINE_HANDLE optional
' reserved : void* optional
' callback : FWPM_SYSTEM_PORTS_CALLBACK0
' context : void* optional
' sysPortsHandle : HANDLE* out
Declare PtrSafe Function FwpmSystemPortsSubscribe0 Lib "fwpuclnt" ( _
ByVal engineHandle As LongPtr, _
ByVal reserved As LongPtr, _
ByVal callback As LongPtr, _
ByVal context As LongPtr, _
ByVal sysPortsHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FwpmSystemPortsSubscribe0 = ctypes.windll.fwpuclnt.FwpmSystemPortsSubscribe0
FwpmSystemPortsSubscribe0.restype = wintypes.DWORD
FwpmSystemPortsSubscribe0.argtypes = [
FWPM_ENGINE_HANDLE, # engineHandle : FWPM_ENGINE_HANDLE optional
ctypes.POINTER(None), # reserved : void* optional
ctypes.c_void_p, # callback : FWPM_SYSTEM_PORTS_CALLBACK0
ctypes.POINTER(None), # context : void* optional
ctypes.c_void_p, # sysPortsHandle : HANDLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('fwpuclnt.dll')
FwpmSystemPortsSubscribe0 = Fiddle::Function.new(
lib['FwpmSystemPortsSubscribe0'],
[
Fiddle::TYPE_VOIDP, # engineHandle : FWPM_ENGINE_HANDLE optional
Fiddle::TYPE_VOIDP, # reserved : void* optional
Fiddle::TYPE_VOIDP, # callback : FWPM_SYSTEM_PORTS_CALLBACK0
Fiddle::TYPE_VOIDP, # context : void* optional
Fiddle::TYPE_VOIDP, # sysPortsHandle : HANDLE* out
],
-Fiddle::TYPE_INT)#[link(name = "fwpuclnt")]
extern "system" {
fn FwpmSystemPortsSubscribe0(
engineHandle: FWPM_ENGINE_HANDLE, // FWPM_ENGINE_HANDLE optional
reserved: *mut (), // void* optional
callback: *const core::ffi::c_void, // FWPM_SYSTEM_PORTS_CALLBACK0
context: *mut (), // void* optional
sysPortsHandle: *mut *mut core::ffi::c_void // HANDLE* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("fwpuclnt.dll")]
public static extern uint FwpmSystemPortsSubscribe0(FWPM_ENGINE_HANDLE engineHandle, IntPtr reserved, IntPtr callback, IntPtr context, IntPtr sysPortsHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fwpuclnt_FwpmSystemPortsSubscribe0' -Namespace Win32 -PassThru
# $api::FwpmSystemPortsSubscribe0(engineHandle, reserved, callback, context, sysPortsHandle)#uselib "fwpuclnt.dll"
#func global FwpmSystemPortsSubscribe0 "FwpmSystemPortsSubscribe0" sptr, sptr, sptr, sptr, sptr
; FwpmSystemPortsSubscribe0 engineHandle, reserved, callback, context, sysPortsHandle ; 戻り値は stat
; engineHandle : FWPM_ENGINE_HANDLE optional -> "sptr"
; reserved : void* optional -> "sptr"
; callback : FWPM_SYSTEM_PORTS_CALLBACK0 -> "sptr"
; context : void* optional -> "sptr"
; sysPortsHandle : HANDLE* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "fwpuclnt.dll"
#cfunc global FwpmSystemPortsSubscribe0 "FwpmSystemPortsSubscribe0" int, sptr, sptr, sptr, sptr
; res = FwpmSystemPortsSubscribe0(engineHandle, reserved, callback, context, sysPortsHandle)
; engineHandle : FWPM_ENGINE_HANDLE optional -> "int"
; reserved : void* optional -> "sptr"
; callback : FWPM_SYSTEM_PORTS_CALLBACK0 -> "sptr"
; context : void* optional -> "sptr"
; sysPortsHandle : HANDLE* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; DWORD FwpmSystemPortsSubscribe0(FWPM_ENGINE_HANDLE engineHandle, void* reserved, FWPM_SYSTEM_PORTS_CALLBACK0 callback, void* context, HANDLE* sysPortsHandle)
#uselib "fwpuclnt.dll"
#cfunc global FwpmSystemPortsSubscribe0 "FwpmSystemPortsSubscribe0" int, intptr, intptr, intptr, intptr
; res = FwpmSystemPortsSubscribe0(engineHandle, reserved, callback, context, sysPortsHandle)
; engineHandle : FWPM_ENGINE_HANDLE optional -> "int"
; reserved : void* optional -> "intptr"
; callback : FWPM_SYSTEM_PORTS_CALLBACK0 -> "intptr"
; context : void* optional -> "intptr"
; sysPortsHandle : HANDLE* out -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
fwpuclnt = windows.NewLazySystemDLL("fwpuclnt.dll")
procFwpmSystemPortsSubscribe0 = fwpuclnt.NewProc("FwpmSystemPortsSubscribe0")
)
// engineHandle (FWPM_ENGINE_HANDLE optional), reserved (void* optional), callback (FWPM_SYSTEM_PORTS_CALLBACK0), context (void* optional), sysPortsHandle (HANDLE* out)
r1, _, err := procFwpmSystemPortsSubscribe0.Call(
uintptr(engineHandle),
uintptr(reserved),
uintptr(callback),
uintptr(context),
uintptr(sysPortsHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction FwpmSystemPortsSubscribe0(
engineHandle: FWPM_ENGINE_HANDLE; // FWPM_ENGINE_HANDLE optional
reserved: Pointer; // void* optional
callback: Pointer; // FWPM_SYSTEM_PORTS_CALLBACK0
context: Pointer; // void* optional
sysPortsHandle: Pointer // HANDLE* out
): DWORD; stdcall;
external 'fwpuclnt.dll' name 'FwpmSystemPortsSubscribe0';result := DllCall("fwpuclnt\FwpmSystemPortsSubscribe0"
, "Ptr", engineHandle ; FWPM_ENGINE_HANDLE optional
, "Ptr", reserved ; void* optional
, "Ptr", callback ; FWPM_SYSTEM_PORTS_CALLBACK0
, "Ptr", context ; void* optional
, "Ptr", sysPortsHandle ; HANDLE* out
, "UInt") ; return: DWORD●FwpmSystemPortsSubscribe0(engineHandle, reserved, callback, context, sysPortsHandle) = DLL("fwpuclnt.dll", "dword FwpmSystemPortsSubscribe0(void*, void*, void*, void*, void*)")
# 呼び出し: FwpmSystemPortsSubscribe0(engineHandle, reserved, callback, context, sysPortsHandle)
# engineHandle : FWPM_ENGINE_HANDLE optional -> "void*"
# reserved : void* optional -> "void*"
# callback : FWPM_SYSTEM_PORTS_CALLBACK0 -> "void*"
# context : void* optional -> "void*"
# sysPortsHandle : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。