ホーム › NetworkManagement.IpHelper › PfAddGlobalFilterToInterface
PfAddGlobalFilterToInterface
関数インターフェイスにグローバルパケットフィルタを追加する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
DWORD PfAddGlobalFilterToInterface(
void* pInterface,
GLOBAL_FILTER gfFilter
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pInterface | void* | inout |
| gfFilter | GLOBAL_FILTER | in |
戻り値の型: DWORD
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
DWORD PfAddGlobalFilterToInterface(
void* pInterface,
GLOBAL_FILTER gfFilter
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint PfAddGlobalFilterToInterface(
IntPtr pInterface, // void* in/out
int gfFilter // GLOBAL_FILTER
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function PfAddGlobalFilterToInterface(
pInterface As IntPtr, ' void* in/out
gfFilter As Integer ' GLOBAL_FILTER
) As UInteger
End Function' pInterface : void* in/out
' gfFilter : GLOBAL_FILTER
Declare PtrSafe Function PfAddGlobalFilterToInterface Lib "iphlpapi" ( _
ByVal pInterface As LongPtr, _
ByVal gfFilter As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PfAddGlobalFilterToInterface = ctypes.windll.iphlpapi.PfAddGlobalFilterToInterface
PfAddGlobalFilterToInterface.restype = wintypes.DWORD
PfAddGlobalFilterToInterface.argtypes = [
ctypes.POINTER(None), # pInterface : void* in/out
ctypes.c_int, # gfFilter : GLOBAL_FILTER
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
PfAddGlobalFilterToInterface = Fiddle::Function.new(
lib['PfAddGlobalFilterToInterface'],
[
Fiddle::TYPE_VOIDP, # pInterface : void* in/out
Fiddle::TYPE_INT, # gfFilter : GLOBAL_FILTER
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn PfAddGlobalFilterToInterface(
pInterface: *mut (), // void* in/out
gfFilter: i32 // GLOBAL_FILTER
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint PfAddGlobalFilterToInterface(IntPtr pInterface, int gfFilter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_PfAddGlobalFilterToInterface' -Namespace Win32 -PassThru
# $api::PfAddGlobalFilterToInterface(pInterface, gfFilter)#uselib "IPHLPAPI.dll"
#func global PfAddGlobalFilterToInterface "PfAddGlobalFilterToInterface" sptr, sptr
; PfAddGlobalFilterToInterface pInterface, gfFilter ; 戻り値は stat
; pInterface : void* in/out -> "sptr"
; gfFilter : GLOBAL_FILTER -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IPHLPAPI.dll"
#cfunc global PfAddGlobalFilterToInterface "PfAddGlobalFilterToInterface" sptr, int
; res = PfAddGlobalFilterToInterface(pInterface, gfFilter)
; pInterface : void* in/out -> "sptr"
; gfFilter : GLOBAL_FILTER -> "int"; DWORD PfAddGlobalFilterToInterface(void* pInterface, GLOBAL_FILTER gfFilter)
#uselib "IPHLPAPI.dll"
#cfunc global PfAddGlobalFilterToInterface "PfAddGlobalFilterToInterface" intptr, int
; res = PfAddGlobalFilterToInterface(pInterface, gfFilter)
; pInterface : void* in/out -> "intptr"
; gfFilter : GLOBAL_FILTER -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procPfAddGlobalFilterToInterface = iphlpapi.NewProc("PfAddGlobalFilterToInterface")
)
// pInterface (void* in/out), gfFilter (GLOBAL_FILTER)
r1, _, err := procPfAddGlobalFilterToInterface.Call(
uintptr(pInterface),
uintptr(gfFilter),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PfAddGlobalFilterToInterface(
pInterface: Pointer; // void* in/out
gfFilter: Integer // GLOBAL_FILTER
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'PfAddGlobalFilterToInterface';result := DllCall("IPHLPAPI\PfAddGlobalFilterToInterface"
, "Ptr", pInterface ; void* in/out
, "Int", gfFilter ; GLOBAL_FILTER
, "UInt") ; return: DWORD●PfAddGlobalFilterToInterface(pInterface, gfFilter) = DLL("IPHLPAPI.dll", "dword PfAddGlobalFilterToInterface(void*, int)")
# 呼び出し: PfAddGlobalFilterToInterface(pInterface, gfFilter)
# pInterface : void* in/out -> "void*"
# gfFilter : GLOBAL_FILTER -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。