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