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

RtmGetMostSpecificDestination

関数
指定アドレスに最も詳細に一致する宛先を取得する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmGetMostSpecificDestination(
    INT_PTR RtmRegHandle,
    RTM_NET_ADDRESS* DestAddress,
    DWORD ProtocolId,
    DWORD TargetViews,
    RTM_DEST_INFO* DestInfo
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
DestAddressRTM_NET_ADDRESS*inout
ProtocolIdDWORDin
TargetViewsDWORDin
DestInfoRTM_DEST_INFO*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

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

RtmGetMostSpecificDestination = ctypes.windll.rtm.RtmGetMostSpecificDestination
RtmGetMostSpecificDestination.restype = wintypes.DWORD
RtmGetMostSpecificDestination.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_void_p,  # DestAddress : RTM_NET_ADDRESS* in/out
    wintypes.DWORD,  # ProtocolId : DWORD
    wintypes.DWORD,  # TargetViews : DWORD
    ctypes.c_void_p,  # DestInfo : RTM_DEST_INFO* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmGetMostSpecificDestination = rtm.NewProc("RtmGetMostSpecificDestination")
)

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