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