ホーム › NetworkManagement.IpHelper › SetUnicastIpAddressEntry
SetUnicastIpAddressEntry
関数指定したユニキャストIPアドレスエントリを設定する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
WIN32_ERROR SetUnicastIpAddressEntry(
const MIB_UNICASTIPADDRESS_ROW* Row
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Row | MIB_UNICASTIPADDRESS_ROW* | in |
戻り値の型: WIN32_ERROR
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
WIN32_ERROR SetUnicastIpAddressEntry(
const MIB_UNICASTIPADDRESS_ROW* Row
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint SetUnicastIpAddressEntry(
IntPtr Row // MIB_UNICASTIPADDRESS_ROW*
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function SetUnicastIpAddressEntry(
Row As IntPtr ' MIB_UNICASTIPADDRESS_ROW*
) As UInteger
End Function' Row : MIB_UNICASTIPADDRESS_ROW*
Declare PtrSafe Function SetUnicastIpAddressEntry 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
SetUnicastIpAddressEntry = ctypes.windll.iphlpapi.SetUnicastIpAddressEntry
SetUnicastIpAddressEntry.restype = wintypes.DWORD
SetUnicastIpAddressEntry.argtypes = [
ctypes.c_void_p, # Row : MIB_UNICASTIPADDRESS_ROW*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
SetUnicastIpAddressEntry = Fiddle::Function.new(
lib['SetUnicastIpAddressEntry'],
[
Fiddle::TYPE_VOIDP, # Row : MIB_UNICASTIPADDRESS_ROW*
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn SetUnicastIpAddressEntry(
Row: *const MIB_UNICASTIPADDRESS_ROW // MIB_UNICASTIPADDRESS_ROW*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint SetUnicastIpAddressEntry(IntPtr Row);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_SetUnicastIpAddressEntry' -Namespace Win32 -PassThru
# $api::SetUnicastIpAddressEntry(Row)#uselib "IPHLPAPI.dll"
#func global SetUnicastIpAddressEntry "SetUnicastIpAddressEntry" sptr
; SetUnicastIpAddressEntry varptr(Row) ; 戻り値は stat
; Row : MIB_UNICASTIPADDRESS_ROW* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "IPHLPAPI.dll" #cfunc global SetUnicastIpAddressEntry "SetUnicastIpAddressEntry" var ; res = SetUnicastIpAddressEntry(Row) ; Row : MIB_UNICASTIPADDRESS_ROW* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "IPHLPAPI.dll" #cfunc global SetUnicastIpAddressEntry "SetUnicastIpAddressEntry" sptr ; res = SetUnicastIpAddressEntry(varptr(Row)) ; Row : MIB_UNICASTIPADDRESS_ROW* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WIN32_ERROR SetUnicastIpAddressEntry(MIB_UNICASTIPADDRESS_ROW* Row) #uselib "IPHLPAPI.dll" #cfunc global SetUnicastIpAddressEntry "SetUnicastIpAddressEntry" var ; res = SetUnicastIpAddressEntry(Row) ; Row : MIB_UNICASTIPADDRESS_ROW* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WIN32_ERROR SetUnicastIpAddressEntry(MIB_UNICASTIPADDRESS_ROW* Row) #uselib "IPHLPAPI.dll" #cfunc global SetUnicastIpAddressEntry "SetUnicastIpAddressEntry" intptr ; res = SetUnicastIpAddressEntry(varptr(Row)) ; Row : MIB_UNICASTIPADDRESS_ROW* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procSetUnicastIpAddressEntry = iphlpapi.NewProc("SetUnicastIpAddressEntry")
)
// Row (MIB_UNICASTIPADDRESS_ROW*)
r1, _, err := procSetUnicastIpAddressEntry.Call(
uintptr(Row),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WIN32_ERRORfunction SetUnicastIpAddressEntry(
Row: Pointer // MIB_UNICASTIPADDRESS_ROW*
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'SetUnicastIpAddressEntry';result := DllCall("IPHLPAPI\SetUnicastIpAddressEntry"
, "Ptr", Row ; MIB_UNICASTIPADDRESS_ROW*
, "UInt") ; return: WIN32_ERROR●SetUnicastIpAddressEntry(Row) = DLL("IPHLPAPI.dll", "dword SetUnicastIpAddressEntry(void*)")
# 呼び出し: SetUnicastIpAddressEntry(Row)
# Row : MIB_UNICASTIPADDRESS_ROW* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。