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