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

FlushIpNetTable2

関数
指定アドレスファミリ・インターフェイスの近隣テーブルを消去する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

WIN32_ERROR FlushIpNetTable2(
    ADDRESS_FAMILY Family,
    DWORD InterfaceIndex
);

パラメーター

名前方向
FamilyADDRESS_FAMILYin
InterfaceIndexDWORDin

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

WIN32_ERROR FlushIpNetTable2(
    ADDRESS_FAMILY Family,
    DWORD InterfaceIndex
);
[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint FlushIpNetTable2(
    ushort Family,   // ADDRESS_FAMILY
    uint InterfaceIndex   // DWORD
);
<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function FlushIpNetTable2(
    Family As UShort,   ' ADDRESS_FAMILY
    InterfaceIndex As UInteger   ' DWORD
) As UInteger
End Function
' Family : ADDRESS_FAMILY
' InterfaceIndex : DWORD
Declare PtrSafe Function FlushIpNetTable2 Lib "iphlpapi" ( _
    ByVal Family As Integer, _
    ByVal InterfaceIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FlushIpNetTable2 = ctypes.windll.iphlpapi.FlushIpNetTable2
FlushIpNetTable2.restype = wintypes.DWORD
FlushIpNetTable2.argtypes = [
    ctypes.c_ushort,  # Family : ADDRESS_FAMILY
    wintypes.DWORD,  # InterfaceIndex : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('IPHLPAPI.dll')
FlushIpNetTable2 = Fiddle::Function.new(
  lib['FlushIpNetTable2'],
  [
    -Fiddle::TYPE_SHORT,  # Family : ADDRESS_FAMILY
    -Fiddle::TYPE_INT,  # InterfaceIndex : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "iphlpapi")]
extern "system" {
    fn FlushIpNetTable2(
        Family: u16,  // ADDRESS_FAMILY
        InterfaceIndex: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint FlushIpNetTable2(ushort Family, uint InterfaceIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_FlushIpNetTable2' -Namespace Win32 -PassThru
# $api::FlushIpNetTable2(Family, InterfaceIndex)
#uselib "IPHLPAPI.dll"
#func global FlushIpNetTable2 "FlushIpNetTable2" sptr, sptr
; FlushIpNetTable2 Family, InterfaceIndex   ; 戻り値は stat
; Family : ADDRESS_FAMILY -> "sptr"
; InterfaceIndex : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "IPHLPAPI.dll"
#cfunc global FlushIpNetTable2 "FlushIpNetTable2" int, int
; res = FlushIpNetTable2(Family, InterfaceIndex)
; Family : ADDRESS_FAMILY -> "int"
; InterfaceIndex : DWORD -> "int"
; WIN32_ERROR FlushIpNetTable2(ADDRESS_FAMILY Family, DWORD InterfaceIndex)
#uselib "IPHLPAPI.dll"
#cfunc global FlushIpNetTable2 "FlushIpNetTable2" int, int
; res = FlushIpNetTable2(Family, InterfaceIndex)
; Family : ADDRESS_FAMILY -> "int"
; InterfaceIndex : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procFlushIpNetTable2 = iphlpapi.NewProc("FlushIpNetTable2")
)

// Family (ADDRESS_FAMILY), InterfaceIndex (DWORD)
r1, _, err := procFlushIpNetTable2.Call(
	uintptr(Family),
	uintptr(InterfaceIndex),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WIN32_ERROR
function FlushIpNetTable2(
  Family: Word;   // ADDRESS_FAMILY
  InterfaceIndex: DWORD   // DWORD
): DWORD; stdcall;
  external 'IPHLPAPI.dll' name 'FlushIpNetTable2';
result := DllCall("IPHLPAPI\FlushIpNetTable2"
    , "UShort", Family   ; ADDRESS_FAMILY
    , "UInt", InterfaceIndex   ; DWORD
    , "UInt")   ; return: WIN32_ERROR
●FlushIpNetTable2(Family, InterfaceIndex) = DLL("IPHLPAPI.dll", "dword FlushIpNetTable2(int, dword)")
# 呼び出し: FlushIpNetTable2(Family, InterfaceIndex)
# Family : ADDRESS_FAMILY -> "int"
# InterfaceIndex : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。