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

MprAdminInterfaceUpdateRoutes

関数
指定プロトコルでインターフェイスのルート情報を更新する。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD MprAdminInterfaceUpdateRoutes(
    INT_PTR hMprServer,
    HANDLE hInterface,
    DWORD dwProtocolId,
    HANDLE hEvent
);

パラメーター

名前方向
hMprServerINT_PTRin
hInterfaceHANDLEin
dwProtocolIdDWORDin
hEventHANDLEin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MprAdminInterfaceUpdateRoutes(
    INT_PTR hMprServer,
    HANDLE hInterface,
    DWORD dwProtocolId,
    HANDLE hEvent
);
[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminInterfaceUpdateRoutes(
    IntPtr hMprServer,   // INT_PTR
    IntPtr hInterface,   // HANDLE
    uint dwProtocolId,   // DWORD
    IntPtr hEvent   // HANDLE
);
<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminInterfaceUpdateRoutes(
    hMprServer As IntPtr,   ' INT_PTR
    hInterface As IntPtr,   ' HANDLE
    dwProtocolId As UInteger,   ' DWORD
    hEvent As IntPtr   ' HANDLE
) As UInteger
End Function
' hMprServer : INT_PTR
' hInterface : HANDLE
' dwProtocolId : DWORD
' hEvent : HANDLE
Declare PtrSafe Function MprAdminInterfaceUpdateRoutes Lib "mprapi" ( _
    ByVal hMprServer As LongPtr, _
    ByVal hInterface As LongPtr, _
    ByVal dwProtocolId As Long, _
    ByVal hEvent As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MprAdminInterfaceUpdateRoutes = ctypes.windll.mprapi.MprAdminInterfaceUpdateRoutes
MprAdminInterfaceUpdateRoutes.restype = wintypes.DWORD
MprAdminInterfaceUpdateRoutes.argtypes = [
    ctypes.c_ssize_t,  # hMprServer : INT_PTR
    wintypes.HANDLE,  # hInterface : HANDLE
    wintypes.DWORD,  # dwProtocolId : DWORD
    wintypes.HANDLE,  # hEvent : HANDLE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminInterfaceUpdateRoutes = Fiddle::Function.new(
  lib['MprAdminInterfaceUpdateRoutes'],
  [
    Fiddle::TYPE_INTPTR_T,  # hMprServer : INT_PTR
    Fiddle::TYPE_VOIDP,  # hInterface : HANDLE
    -Fiddle::TYPE_INT,  # dwProtocolId : DWORD
    Fiddle::TYPE_VOIDP,  # hEvent : HANDLE
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mprapi")]
extern "system" {
    fn MprAdminInterfaceUpdateRoutes(
        hMprServer: isize,  // INT_PTR
        hInterface: *mut core::ffi::c_void,  // HANDLE
        dwProtocolId: u32,  // DWORD
        hEvent: *mut core::ffi::c_void  // HANDLE
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminInterfaceUpdateRoutes(IntPtr hMprServer, IntPtr hInterface, uint dwProtocolId, IntPtr hEvent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminInterfaceUpdateRoutes' -Namespace Win32 -PassThru
# $api::MprAdminInterfaceUpdateRoutes(hMprServer, hInterface, dwProtocolId, hEvent)
#uselib "MPRAPI.dll"
#func global MprAdminInterfaceUpdateRoutes "MprAdminInterfaceUpdateRoutes" sptr, sptr, sptr, sptr
; MprAdminInterfaceUpdateRoutes hMprServer, hInterface, dwProtocolId, hEvent   ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; hInterface : HANDLE -> "sptr"
; dwProtocolId : DWORD -> "sptr"
; hEvent : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MPRAPI.dll"
#cfunc global MprAdminInterfaceUpdateRoutes "MprAdminInterfaceUpdateRoutes" sptr, sptr, int, sptr
; res = MprAdminInterfaceUpdateRoutes(hMprServer, hInterface, dwProtocolId, hEvent)
; hMprServer : INT_PTR -> "sptr"
; hInterface : HANDLE -> "sptr"
; dwProtocolId : DWORD -> "int"
; hEvent : HANDLE -> "sptr"
; DWORD MprAdminInterfaceUpdateRoutes(INT_PTR hMprServer, HANDLE hInterface, DWORD dwProtocolId, HANDLE hEvent)
#uselib "MPRAPI.dll"
#cfunc global MprAdminInterfaceUpdateRoutes "MprAdminInterfaceUpdateRoutes" intptr, intptr, int, intptr
; res = MprAdminInterfaceUpdateRoutes(hMprServer, hInterface, dwProtocolId, hEvent)
; hMprServer : INT_PTR -> "intptr"
; hInterface : HANDLE -> "intptr"
; dwProtocolId : DWORD -> "int"
; hEvent : HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprAdminInterfaceUpdateRoutes = mprapi.NewProc("MprAdminInterfaceUpdateRoutes")
)

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