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

SetIpNetEntry2

関数
指定した近隣(IP-物理アドレス)エントリを設定する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

WIN32_ERROR SetIpNetEntry2(
    MIB_IPNET_ROW2* Row
);

パラメーター

名前方向
RowMIB_IPNET_ROW2*in

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

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

SetIpNetEntry2 = ctypes.windll.iphlpapi.SetIpNetEntry2
SetIpNetEntry2.restype = wintypes.DWORD
SetIpNetEntry2.argtypes = [
    ctypes.c_void_p,  # Row : MIB_IPNET_ROW2*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('IPHLPAPI.dll')
SetIpNetEntry2 = Fiddle::Function.new(
  lib['SetIpNetEntry2'],
  [
    Fiddle::TYPE_VOIDP,  # Row : MIB_IPNET_ROW2*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "iphlpapi")]
extern "system" {
    fn SetIpNetEntry2(
        Row: *mut MIB_IPNET_ROW2  // MIB_IPNET_ROW2*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint SetIpNetEntry2(IntPtr Row);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_SetIpNetEntry2' -Namespace Win32 -PassThru
# $api::SetIpNetEntry2(Row)
#uselib "IPHLPAPI.dll"
#func global SetIpNetEntry2 "SetIpNetEntry2" sptr
; SetIpNetEntry2 varptr(Row)   ; 戻り値は stat
; Row : MIB_IPNET_ROW2* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "IPHLPAPI.dll"
#cfunc global SetIpNetEntry2 "SetIpNetEntry2" var
; res = SetIpNetEntry2(Row)
; Row : MIB_IPNET_ROW2* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; WIN32_ERROR SetIpNetEntry2(MIB_IPNET_ROW2* Row)
#uselib "IPHLPAPI.dll"
#cfunc global SetIpNetEntry2 "SetIpNetEntry2" var
; res = SetIpNetEntry2(Row)
; Row : MIB_IPNET_ROW2* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procSetIpNetEntry2 = iphlpapi.NewProc("SetIpNetEntry2")
)

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