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

RtmGetRoutePointer

関数
指定したルート情報への直接ポインタを取得する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmGetRoutePointer(
    INT_PTR RtmRegHandle,
    INT_PTR RouteHandle,
    RTM_ROUTE_INFO** RoutePointer
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
RouteHandleINT_PTRin
RoutePointerRTM_ROUTE_INFO**inout

戻り値の型: DWORD

各言語での呼び出し定義

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

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

RtmGetRoutePointer = ctypes.windll.rtm.RtmGetRoutePointer
RtmGetRoutePointer.restype = wintypes.DWORD
RtmGetRoutePointer.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_ssize_t,  # RouteHandle : INT_PTR
    ctypes.c_void_p,  # RoutePointer : RTM_ROUTE_INFO** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmGetRoutePointer = rtm.NewProc("RtmGetRoutePointer")
)

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