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

RtmIsBestRoute

関数
指定ルートが各ビューで最良ルートかどうかを判定する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmIsBestRoute(
    INT_PTR RtmRegHandle,
    INT_PTR RouteHandle,
    DWORD* BestInViews
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
RouteHandleINT_PTRin
BestInViewsDWORD*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

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

RtmIsBestRoute = ctypes.windll.rtm.RtmIsBestRoute
RtmIsBestRoute.restype = wintypes.DWORD
RtmIsBestRoute.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_ssize_t,  # RouteHandle : INT_PTR
    ctypes.POINTER(wintypes.DWORD),  # BestInViews : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmIsBestRoute = rtm.NewProc("RtmIsBestRoute")
)

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