ホーム › NetworkManagement.Rras › MgmTakeInterfaceOwnership
MgmTakeInterfaceOwnership
関数指定インターフェイスのマルチキャスト所有権を取得する。
シグネチャ
// rtm.dll
#include <windows.h>
DWORD MgmTakeInterfaceOwnership(
HANDLE hProtocol,
DWORD dwIfIndex,
DWORD dwIfNextHopAddr
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProtocol | HANDLE | in |
| dwIfIndex | DWORD | in |
| dwIfNextHopAddr | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// rtm.dll
#include <windows.h>
DWORD MgmTakeInterfaceOwnership(
HANDLE hProtocol,
DWORD dwIfIndex,
DWORD dwIfNextHopAddr
);[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint MgmTakeInterfaceOwnership(
IntPtr hProtocol, // HANDLE
uint dwIfIndex, // DWORD
uint dwIfNextHopAddr // DWORD
);<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function MgmTakeInterfaceOwnership(
hProtocol As IntPtr, ' HANDLE
dwIfIndex As UInteger, ' DWORD
dwIfNextHopAddr As UInteger ' DWORD
) As UInteger
End Function' hProtocol : HANDLE
' dwIfIndex : DWORD
' dwIfNextHopAddr : DWORD
Declare PtrSafe Function MgmTakeInterfaceOwnership Lib "rtm" ( _
ByVal hProtocol As LongPtr, _
ByVal dwIfIndex As Long, _
ByVal dwIfNextHopAddr As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MgmTakeInterfaceOwnership = ctypes.windll.rtm.MgmTakeInterfaceOwnership
MgmTakeInterfaceOwnership.restype = wintypes.DWORD
MgmTakeInterfaceOwnership.argtypes = [
wintypes.HANDLE, # hProtocol : HANDLE
wintypes.DWORD, # dwIfIndex : DWORD
wintypes.DWORD, # dwIfNextHopAddr : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('rtm.dll')
MgmTakeInterfaceOwnership = Fiddle::Function.new(
lib['MgmTakeInterfaceOwnership'],
[
Fiddle::TYPE_VOIDP, # hProtocol : HANDLE
-Fiddle::TYPE_INT, # dwIfIndex : DWORD
-Fiddle::TYPE_INT, # dwIfNextHopAddr : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "rtm")]
extern "system" {
fn MgmTakeInterfaceOwnership(
hProtocol: *mut core::ffi::c_void, // HANDLE
dwIfIndex: u32, // DWORD
dwIfNextHopAddr: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("rtm.dll")]
public static extern uint MgmTakeInterfaceOwnership(IntPtr hProtocol, uint dwIfIndex, uint dwIfNextHopAddr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_MgmTakeInterfaceOwnership' -Namespace Win32 -PassThru
# $api::MgmTakeInterfaceOwnership(hProtocol, dwIfIndex, dwIfNextHopAddr)#uselib "rtm.dll"
#func global MgmTakeInterfaceOwnership "MgmTakeInterfaceOwnership" sptr, sptr, sptr
; MgmTakeInterfaceOwnership hProtocol, dwIfIndex, dwIfNextHopAddr ; 戻り値は stat
; hProtocol : HANDLE -> "sptr"
; dwIfIndex : DWORD -> "sptr"
; dwIfNextHopAddr : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "rtm.dll"
#cfunc global MgmTakeInterfaceOwnership "MgmTakeInterfaceOwnership" sptr, int, int
; res = MgmTakeInterfaceOwnership(hProtocol, dwIfIndex, dwIfNextHopAddr)
; hProtocol : HANDLE -> "sptr"
; dwIfIndex : DWORD -> "int"
; dwIfNextHopAddr : DWORD -> "int"; DWORD MgmTakeInterfaceOwnership(HANDLE hProtocol, DWORD dwIfIndex, DWORD dwIfNextHopAddr)
#uselib "rtm.dll"
#cfunc global MgmTakeInterfaceOwnership "MgmTakeInterfaceOwnership" intptr, int, int
; res = MgmTakeInterfaceOwnership(hProtocol, dwIfIndex, dwIfNextHopAddr)
; hProtocol : HANDLE -> "intptr"
; dwIfIndex : DWORD -> "int"
; dwIfNextHopAddr : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rtm = windows.NewLazySystemDLL("rtm.dll")
procMgmTakeInterfaceOwnership = rtm.NewProc("MgmTakeInterfaceOwnership")
)
// hProtocol (HANDLE), dwIfIndex (DWORD), dwIfNextHopAddr (DWORD)
r1, _, err := procMgmTakeInterfaceOwnership.Call(
uintptr(hProtocol),
uintptr(dwIfIndex),
uintptr(dwIfNextHopAddr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MgmTakeInterfaceOwnership(
hProtocol: THandle; // HANDLE
dwIfIndex: DWORD; // DWORD
dwIfNextHopAddr: DWORD // DWORD
): DWORD; stdcall;
external 'rtm.dll' name 'MgmTakeInterfaceOwnership';result := DllCall("rtm\MgmTakeInterfaceOwnership"
, "Ptr", hProtocol ; HANDLE
, "UInt", dwIfIndex ; DWORD
, "UInt", dwIfNextHopAddr ; DWORD
, "UInt") ; return: DWORD●MgmTakeInterfaceOwnership(hProtocol, dwIfIndex, dwIfNextHopAddr) = DLL("rtm.dll", "dword MgmTakeInterfaceOwnership(void*, dword, dword)")
# 呼び出し: MgmTakeInterfaceOwnership(hProtocol, dwIfIndex, dwIfNextHopAddr)
# hProtocol : HANDLE -> "void*"
# dwIfIndex : DWORD -> "dword"
# dwIfNextHopAddr : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。