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

RtmGetLessSpecificDestination

関数
指定宛先より粗いプレフィックスの宛先を取得する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmGetLessSpecificDestination(
    INT_PTR RtmRegHandle,
    INT_PTR DestHandle,
    DWORD ProtocolId,
    DWORD TargetViews,
    RTM_DEST_INFO* DestInfo
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
DestHandleINT_PTRin
ProtocolIdDWORDin
TargetViewsDWORDin
DestInfoRTM_DEST_INFO*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RtmGetLessSpecificDestination(
    INT_PTR RtmRegHandle,
    INT_PTR DestHandle,
    DWORD ProtocolId,
    DWORD TargetViews,
    RTM_DEST_INFO* DestInfo
);
[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint RtmGetLessSpecificDestination(
    IntPtr RtmRegHandle,   // INT_PTR
    IntPtr DestHandle,   // INT_PTR
    uint ProtocolId,   // DWORD
    uint TargetViews,   // DWORD
    IntPtr DestInfo   // RTM_DEST_INFO* in/out
);
<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function RtmGetLessSpecificDestination(
    RtmRegHandle As IntPtr,   ' INT_PTR
    DestHandle As IntPtr,   ' INT_PTR
    ProtocolId As UInteger,   ' DWORD
    TargetViews As UInteger,   ' DWORD
    DestInfo As IntPtr   ' RTM_DEST_INFO* in/out
) As UInteger
End Function
' RtmRegHandle : INT_PTR
' DestHandle : INT_PTR
' ProtocolId : DWORD
' TargetViews : DWORD
' DestInfo : RTM_DEST_INFO* in/out
Declare PtrSafe Function RtmGetLessSpecificDestination Lib "rtm" ( _
    ByVal RtmRegHandle As LongPtr, _
    ByVal DestHandle 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

RtmGetLessSpecificDestination = ctypes.windll.rtm.RtmGetLessSpecificDestination
RtmGetLessSpecificDestination.restype = wintypes.DWORD
RtmGetLessSpecificDestination.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_ssize_t,  # DestHandle : INT_PTR
    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')
RtmGetLessSpecificDestination = Fiddle::Function.new(
  lib['RtmGetLessSpecificDestination'],
  [
    Fiddle::TYPE_INTPTR_T,  # RtmRegHandle : INT_PTR
    Fiddle::TYPE_INTPTR_T,  # DestHandle : INT_PTR
    -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 RtmGetLessSpecificDestination(
        RtmRegHandle: isize,  // INT_PTR
        DestHandle: isize,  // INT_PTR
        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 RtmGetLessSpecificDestination(IntPtr RtmRegHandle, IntPtr DestHandle, uint ProtocolId, uint TargetViews, IntPtr DestInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_RtmGetLessSpecificDestination' -Namespace Win32 -PassThru
# $api::RtmGetLessSpecificDestination(RtmRegHandle, DestHandle, ProtocolId, TargetViews, DestInfo)
#uselib "rtm.dll"
#func global RtmGetLessSpecificDestination "RtmGetLessSpecificDestination" sptr, sptr, sptr, sptr, sptr
; RtmGetLessSpecificDestination RtmRegHandle, DestHandle, ProtocolId, TargetViews, varptr(DestInfo)   ; 戻り値は stat
; RtmRegHandle : INT_PTR -> "sptr"
; DestHandle : INT_PTR -> "sptr"
; ProtocolId : DWORD -> "sptr"
; TargetViews : DWORD -> "sptr"
; DestInfo : RTM_DEST_INFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "rtm.dll"
#cfunc global RtmGetLessSpecificDestination "RtmGetLessSpecificDestination" sptr, sptr, int, int, var
; res = RtmGetLessSpecificDestination(RtmRegHandle, DestHandle, ProtocolId, TargetViews, DestInfo)
; RtmRegHandle : INT_PTR -> "sptr"
; DestHandle : INT_PTR -> "sptr"
; ProtocolId : DWORD -> "int"
; TargetViews : DWORD -> "int"
; DestInfo : RTM_DEST_INFO* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD RtmGetLessSpecificDestination(INT_PTR RtmRegHandle, INT_PTR DestHandle, DWORD ProtocolId, DWORD TargetViews, RTM_DEST_INFO* DestInfo)
#uselib "rtm.dll"
#cfunc global RtmGetLessSpecificDestination "RtmGetLessSpecificDestination" intptr, intptr, int, int, var
; res = RtmGetLessSpecificDestination(RtmRegHandle, DestHandle, ProtocolId, TargetViews, DestInfo)
; RtmRegHandle : INT_PTR -> "intptr"
; DestHandle : INT_PTR -> "intptr"
; 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")
	procRtmGetLessSpecificDestination = rtm.NewProc("RtmGetLessSpecificDestination")
)

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