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

RtmRegisterEntity

関数
ルーティングテーブルマネージャーにエンティティを登録する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmRegisterEntity(
    RTM_ENTITY_INFO* RtmEntityInfo,
    RTM_ENTITY_EXPORT_METHODS* ExportMethods,
    RTM_EVENT_CALLBACK EventCallback,
    BOOL ReserveOpaquePointer,
    RTM_REGN_PROFILE* RtmRegProfile,
    INT_PTR* RtmRegHandle
);

パラメーター

名前方向
RtmEntityInfoRTM_ENTITY_INFO*inout
ExportMethodsRTM_ENTITY_EXPORT_METHODS*inout
EventCallbackRTM_EVENT_CALLBACKin
ReserveOpaquePointerBOOLin
RtmRegProfileRTM_REGN_PROFILE*inout
RtmRegHandleINT_PTR*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RtmRegisterEntity(
    RTM_ENTITY_INFO* RtmEntityInfo,
    RTM_ENTITY_EXPORT_METHODS* ExportMethods,
    RTM_EVENT_CALLBACK EventCallback,
    BOOL ReserveOpaquePointer,
    RTM_REGN_PROFILE* RtmRegProfile,
    INT_PTR* RtmRegHandle
);
[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint RtmRegisterEntity(
    IntPtr RtmEntityInfo,   // RTM_ENTITY_INFO* in/out
    IntPtr ExportMethods,   // RTM_ENTITY_EXPORT_METHODS* in/out
    IntPtr EventCallback,   // RTM_EVENT_CALLBACK
    bool ReserveOpaquePointer,   // BOOL
    IntPtr RtmRegProfile,   // RTM_REGN_PROFILE* in/out
    ref IntPtr RtmRegHandle   // INT_PTR* in/out
);
<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function RtmRegisterEntity(
    RtmEntityInfo As IntPtr,   ' RTM_ENTITY_INFO* in/out
    ExportMethods As IntPtr,   ' RTM_ENTITY_EXPORT_METHODS* in/out
    EventCallback As IntPtr,   ' RTM_EVENT_CALLBACK
    ReserveOpaquePointer As Boolean,   ' BOOL
    RtmRegProfile As IntPtr,   ' RTM_REGN_PROFILE* in/out
    ByRef RtmRegHandle As IntPtr   ' INT_PTR* in/out
) As UInteger
End Function
' RtmEntityInfo : RTM_ENTITY_INFO* in/out
' ExportMethods : RTM_ENTITY_EXPORT_METHODS* in/out
' EventCallback : RTM_EVENT_CALLBACK
' ReserveOpaquePointer : BOOL
' RtmRegProfile : RTM_REGN_PROFILE* in/out
' RtmRegHandle : INT_PTR* in/out
Declare PtrSafe Function RtmRegisterEntity Lib "rtm" ( _
    ByVal RtmEntityInfo As LongPtr, _
    ByVal ExportMethods As LongPtr, _
    ByVal EventCallback As LongPtr, _
    ByVal ReserveOpaquePointer As Long, _
    ByVal RtmRegProfile As LongPtr, _
    ByRef RtmRegHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtmRegisterEntity = ctypes.windll.rtm.RtmRegisterEntity
RtmRegisterEntity.restype = wintypes.DWORD
RtmRegisterEntity.argtypes = [
    ctypes.c_void_p,  # RtmEntityInfo : RTM_ENTITY_INFO* in/out
    ctypes.c_void_p,  # ExportMethods : RTM_ENTITY_EXPORT_METHODS* in/out
    ctypes.c_void_p,  # EventCallback : RTM_EVENT_CALLBACK
    wintypes.BOOL,  # ReserveOpaquePointer : BOOL
    ctypes.c_void_p,  # RtmRegProfile : RTM_REGN_PROFILE* in/out
    ctypes.POINTER(ctypes.c_ssize_t),  # RtmRegHandle : INT_PTR* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmRegisterEntity = rtm.NewProc("RtmRegisterEntity")
)

// RtmEntityInfo (RTM_ENTITY_INFO* in/out), ExportMethods (RTM_ENTITY_EXPORT_METHODS* in/out), EventCallback (RTM_EVENT_CALLBACK), ReserveOpaquePointer (BOOL), RtmRegProfile (RTM_REGN_PROFILE* in/out), RtmRegHandle (INT_PTR* in/out)
r1, _, err := procRtmRegisterEntity.Call(
	uintptr(RtmEntityInfo),
	uintptr(ExportMethods),
	uintptr(EventCallback),
	uintptr(ReserveOpaquePointer),
	uintptr(RtmRegProfile),
	uintptr(RtmRegHandle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RtmRegisterEntity(
  RtmEntityInfo: Pointer;   // RTM_ENTITY_INFO* in/out
  ExportMethods: Pointer;   // RTM_ENTITY_EXPORT_METHODS* in/out
  EventCallback: Pointer;   // RTM_EVENT_CALLBACK
  ReserveOpaquePointer: BOOL;   // BOOL
  RtmRegProfile: Pointer;   // RTM_REGN_PROFILE* in/out
  RtmRegHandle: Pointer   // INT_PTR* in/out
): DWORD; stdcall;
  external 'rtm.dll' name 'RtmRegisterEntity';
result := DllCall("rtm\RtmRegisterEntity"
    , "Ptr", RtmEntityInfo   ; RTM_ENTITY_INFO* in/out
    , "Ptr", ExportMethods   ; RTM_ENTITY_EXPORT_METHODS* in/out
    , "Ptr", EventCallback   ; RTM_EVENT_CALLBACK
    , "Int", ReserveOpaquePointer   ; BOOL
    , "Ptr", RtmRegProfile   ; RTM_REGN_PROFILE* in/out
    , "Ptr", RtmRegHandle   ; INT_PTR* in/out
    , "UInt")   ; return: DWORD
●RtmRegisterEntity(RtmEntityInfo, ExportMethods, EventCallback, ReserveOpaquePointer, RtmRegProfile, RtmRegHandle) = DLL("rtm.dll", "dword RtmRegisterEntity(void*, void*, void*, bool, void*, void*)")
# 呼び出し: RtmRegisterEntity(RtmEntityInfo, ExportMethods, EventCallback, ReserveOpaquePointer, RtmRegProfile, RtmRegHandle)
# RtmEntityInfo : RTM_ENTITY_INFO* in/out -> "void*"
# ExportMethods : RTM_ENTITY_EXPORT_METHODS* in/out -> "void*"
# EventCallback : RTM_EVENT_CALLBACK -> "void*"
# ReserveOpaquePointer : BOOL -> "bool"
# RtmRegProfile : RTM_REGN_PROFILE* in/out -> "void*"
# RtmRegHandle : INT_PTR* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。