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

SetIfEntry

関数
指定ネットワークインターフェイスの管理状態などを設定する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD SetIfEntry(
    MIB_IFROW* pIfRow
);

パラメーター

名前方向
pIfRowMIB_IFROW*in

戻り値の型: DWORD

各言語での呼び出し定義

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

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

SetIfEntry = ctypes.windll.iphlpapi.SetIfEntry
SetIfEntry.restype = wintypes.DWORD
SetIfEntry.argtypes = [
    ctypes.c_void_p,  # pIfRow : MIB_IFROW*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procSetIfEntry = iphlpapi.NewProc("SetIfEntry")
)

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