ホーム › NetworkManagement.Rras › RtmHoldDestination
RtmHoldDestination
関数指定した宛先を一定時間ホールドダウン状態に保持する。
シグネチャ
// rtm.dll
#include <windows.h>
DWORD RtmHoldDestination(
INT_PTR RtmRegHandle,
INT_PTR DestHandle,
DWORD TargetViews,
DWORD HoldTime
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| RtmRegHandle | INT_PTR | in | RtmRegisterEntityで取得したRTM登録ハンドル。 |
| DestHandle | INT_PTR | in | ホールドダウンを設定する対象宛先のハンドル。 |
| TargetViews | DWORD | in | ホールドを適用するビューのマスク。 |
| HoldTime | DWORD | in | 削除済みルートを保持する時間(ミリ秒単位)。 |
戻り値の型: DWORD
各言語での呼び出し定義
// rtm.dll
#include <windows.h>
DWORD RtmHoldDestination(
INT_PTR RtmRegHandle,
INT_PTR DestHandle,
DWORD TargetViews,
DWORD HoldTime
);[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint RtmHoldDestination(
IntPtr RtmRegHandle, // INT_PTR
IntPtr DestHandle, // INT_PTR
uint TargetViews, // DWORD
uint HoldTime // DWORD
);<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function RtmHoldDestination(
RtmRegHandle As IntPtr, ' INT_PTR
DestHandle As IntPtr, ' INT_PTR
TargetViews As UInteger, ' DWORD
HoldTime As UInteger ' DWORD
) As UInteger
End Function' RtmRegHandle : INT_PTR
' DestHandle : INT_PTR
' TargetViews : DWORD
' HoldTime : DWORD
Declare PtrSafe Function RtmHoldDestination Lib "rtm" ( _
ByVal RtmRegHandle As LongPtr, _
ByVal DestHandle As LongPtr, _
ByVal TargetViews As Long, _
ByVal HoldTime As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtmHoldDestination = ctypes.windll.rtm.RtmHoldDestination
RtmHoldDestination.restype = wintypes.DWORD
RtmHoldDestination.argtypes = [
ctypes.c_ssize_t, # RtmRegHandle : INT_PTR
ctypes.c_ssize_t, # DestHandle : INT_PTR
wintypes.DWORD, # TargetViews : DWORD
wintypes.DWORD, # HoldTime : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('rtm.dll')
RtmHoldDestination = Fiddle::Function.new(
lib['RtmHoldDestination'],
[
Fiddle::TYPE_INTPTR_T, # RtmRegHandle : INT_PTR
Fiddle::TYPE_INTPTR_T, # DestHandle : INT_PTR
-Fiddle::TYPE_INT, # TargetViews : DWORD
-Fiddle::TYPE_INT, # HoldTime : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "rtm")]
extern "system" {
fn RtmHoldDestination(
RtmRegHandle: isize, // INT_PTR
DestHandle: isize, // INT_PTR
TargetViews: u32, // DWORD
HoldTime: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("rtm.dll")]
public static extern uint RtmHoldDestination(IntPtr RtmRegHandle, IntPtr DestHandle, uint TargetViews, uint HoldTime);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_RtmHoldDestination' -Namespace Win32 -PassThru
# $api::RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)#uselib "rtm.dll"
#func global RtmHoldDestination "RtmHoldDestination" sptr, sptr, sptr, sptr
; RtmHoldDestination RtmRegHandle, DestHandle, TargetViews, HoldTime ; 戻り値は stat
; RtmRegHandle : INT_PTR -> "sptr"
; DestHandle : INT_PTR -> "sptr"
; TargetViews : DWORD -> "sptr"
; HoldTime : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "rtm.dll"
#cfunc global RtmHoldDestination "RtmHoldDestination" sptr, sptr, int, int
; res = RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
; RtmRegHandle : INT_PTR -> "sptr"
; DestHandle : INT_PTR -> "sptr"
; TargetViews : DWORD -> "int"
; HoldTime : DWORD -> "int"; DWORD RtmHoldDestination(INT_PTR RtmRegHandle, INT_PTR DestHandle, DWORD TargetViews, DWORD HoldTime)
#uselib "rtm.dll"
#cfunc global RtmHoldDestination "RtmHoldDestination" intptr, intptr, int, int
; res = RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
; RtmRegHandle : INT_PTR -> "intptr"
; DestHandle : INT_PTR -> "intptr"
; TargetViews : DWORD -> "int"
; HoldTime : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rtm = windows.NewLazySystemDLL("rtm.dll")
procRtmHoldDestination = rtm.NewProc("RtmHoldDestination")
)
// RtmRegHandle (INT_PTR), DestHandle (INT_PTR), TargetViews (DWORD), HoldTime (DWORD)
r1, _, err := procRtmHoldDestination.Call(
uintptr(RtmRegHandle),
uintptr(DestHandle),
uintptr(TargetViews),
uintptr(HoldTime),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RtmHoldDestination(
RtmRegHandle: NativeInt; // INT_PTR
DestHandle: NativeInt; // INT_PTR
TargetViews: DWORD; // DWORD
HoldTime: DWORD // DWORD
): DWORD; stdcall;
external 'rtm.dll' name 'RtmHoldDestination';result := DllCall("rtm\RtmHoldDestination"
, "Ptr", RtmRegHandle ; INT_PTR
, "Ptr", DestHandle ; INT_PTR
, "UInt", TargetViews ; DWORD
, "UInt", HoldTime ; DWORD
, "UInt") ; return: DWORD●RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime) = DLL("rtm.dll", "dword RtmHoldDestination(int, int, dword, dword)")
# 呼び出し: RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
# RtmRegHandle : INT_PTR -> "int"
# DestHandle : INT_PTR -> "int"
# TargetViews : DWORD -> "dword"
# HoldTime : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rtm" fn RtmHoldDestination(
RtmRegHandle: isize, // INT_PTR
DestHandle: isize, // INT_PTR
TargetViews: u32, // DWORD
HoldTime: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;proc RtmHoldDestination(
RtmRegHandle: int, # INT_PTR
DestHandle: int, # INT_PTR
TargetViews: uint32, # DWORD
HoldTime: uint32 # DWORD
): uint32 {.importc: "RtmHoldDestination", stdcall, dynlib: "rtm.dll".}pragma(lib, "rtm");
extern(Windows)
uint RtmHoldDestination(
ptrdiff_t RtmRegHandle, // INT_PTR
ptrdiff_t DestHandle, // INT_PTR
uint TargetViews, // DWORD
uint HoldTime // DWORD
);ccall((:RtmHoldDestination, "rtm.dll"), stdcall, UInt32,
(Int, Int, UInt32, UInt32),
RtmRegHandle, DestHandle, TargetViews, HoldTime)
# RtmRegHandle : INT_PTR -> Int
# DestHandle : INT_PTR -> Int
# TargetViews : DWORD -> UInt32
# HoldTime : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t RtmHoldDestination(
intptr_t RtmRegHandle,
intptr_t DestHandle,
uint32_t TargetViews,
uint32_t HoldTime);
]]
local rtm = ffi.load("rtm")
-- rtm.RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
-- RtmRegHandle : INT_PTR
-- DestHandle : INT_PTR
-- TargetViews : DWORD
-- HoldTime : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('rtm.dll');
const RtmHoldDestination = lib.func('__stdcall', 'RtmHoldDestination', 'uint32_t', ['intptr_t', 'intptr_t', 'uint32_t', 'uint32_t']);
// RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
// RtmRegHandle : INT_PTR -> 'intptr_t'
// DestHandle : INT_PTR -> 'intptr_t'
// TargetViews : DWORD -> 'uint32_t'
// HoldTime : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("rtm.dll", {
RtmHoldDestination: { parameters: ["isize", "isize", "u32", "u32"], result: "u32" },
});
// lib.symbols.RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime)
// RtmRegHandle : INT_PTR -> "isize"
// DestHandle : INT_PTR -> "isize"
// TargetViews : DWORD -> "u32"
// HoldTime : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t RtmHoldDestination(
intptr_t RtmRegHandle,
intptr_t DestHandle,
uint32_t TargetViews,
uint32_t HoldTime);
C, "rtm.dll");
// $ffi->RtmHoldDestination(RtmRegHandle, DestHandle, TargetViews, HoldTime);
// RtmRegHandle : INT_PTR
// DestHandle : INT_PTR
// TargetViews : DWORD
// HoldTime : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Rtm extends StdCallLibrary {
Rtm INSTANCE = Native.load("rtm", Rtm.class);
int RtmHoldDestination(
long RtmRegHandle, // INT_PTR
long DestHandle, // INT_PTR
int TargetViews, // DWORD
int HoldTime // DWORD
);
}@[Link("rtm")]
lib Librtm
fun RtmHoldDestination = RtmHoldDestination(
RtmRegHandle : LibC::SSizeT, # INT_PTR
DestHandle : LibC::SSizeT, # INT_PTR
TargetViews : UInt32, # DWORD
HoldTime : UInt32 # DWORD
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RtmHoldDestinationNative = Uint32 Function(IntPtr, IntPtr, Uint32, Uint32);
typedef RtmHoldDestinationDart = int Function(int, int, int, int);
final RtmHoldDestination = DynamicLibrary.open('rtm.dll')
.lookupFunction<RtmHoldDestinationNative, RtmHoldDestinationDart>('RtmHoldDestination');
// RtmRegHandle : INT_PTR -> IntPtr
// DestHandle : INT_PTR -> IntPtr
// TargetViews : DWORD -> Uint32
// HoldTime : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RtmHoldDestination(
RtmRegHandle: NativeInt; // INT_PTR
DestHandle: NativeInt; // INT_PTR
TargetViews: DWORD; // DWORD
HoldTime: DWORD // DWORD
): DWORD; stdcall;
external 'rtm.dll' name 'RtmHoldDestination';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RtmHoldDestination"
c_RtmHoldDestination :: CIntPtr -> CIntPtr -> Word32 -> Word32 -> IO Word32
-- RtmRegHandle : INT_PTR -> CIntPtr
-- DestHandle : INT_PTR -> CIntPtr
-- TargetViews : DWORD -> Word32
-- HoldTime : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rtmholddestination =
foreign "RtmHoldDestination"
(intptr_t @-> intptr_t @-> uint32_t @-> uint32_t @-> returning uint32_t)
(* RtmRegHandle : INT_PTR -> intptr_t *)
(* DestHandle : INT_PTR -> intptr_t *)
(* TargetViews : DWORD -> uint32_t *)
(* HoldTime : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rtm (t "rtm.dll"))
(cffi:use-foreign-library rtm)
(cffi:defcfun ("RtmHoldDestination" rtm-hold-destination :convention :stdcall) :uint32
(rtm-reg-handle :int64) ; INT_PTR
(dest-handle :int64) ; INT_PTR
(target-views :uint32) ; DWORD
(hold-time :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RtmHoldDestination = Win32::API::More->new('rtm',
'DWORD RtmHoldDestination(LPARAM RtmRegHandle, LPARAM DestHandle, DWORD TargetViews, DWORD HoldTime)');
# my $ret = $RtmHoldDestination->Call($RtmRegHandle, $DestHandle, $TargetViews, $HoldTime);
# RtmRegHandle : INT_PTR -> LPARAM
# DestHandle : INT_PTR -> LPARAM
# TargetViews : DWORD -> DWORD
# HoldTime : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。