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

RtmGetNextHopInfo

関数
指定したネクストホップの情報を取得する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmGetNextHopInfo(
    INT_PTR RtmRegHandle,
    INT_PTR NextHopHandle,
    RTM_NEXTHOP_INFO* NextHopInfo
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
NextHopHandleINT_PTRin
NextHopInfoRTM_NEXTHOP_INFO*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

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

RtmGetNextHopInfo = ctypes.windll.rtm.RtmGetNextHopInfo
RtmGetNextHopInfo.restype = wintypes.DWORD
RtmGetNextHopInfo.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_ssize_t,  # NextHopHandle : INT_PTR
    ctypes.c_void_p,  # NextHopInfo : RTM_NEXTHOP_INFO* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmGetNextHopInfo = rtm.NewProc("RtmGetNextHopInfo")
)

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