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