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

MprAdminUpdateConnection

関数
RASサーバー上のアクティブ接続の設定を更新する。
DLLMPRAPI.dll呼出規約winapi

シグネチャ

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

DWORD MprAdminUpdateConnection(
    INT_PTR hRasServer,
    HANDLE hRasConnection,
    RAS_UPDATE_CONNECTION* pRasUpdateConnection
);

パラメーター

名前方向
hRasServerINT_PTRin
hRasConnectionHANDLEin
pRasUpdateConnectionRAS_UPDATE_CONNECTION*in

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MprAdminUpdateConnection = ctypes.windll.mprapi.MprAdminUpdateConnection
MprAdminUpdateConnection.restype = wintypes.DWORD
MprAdminUpdateConnection.argtypes = [
    ctypes.c_ssize_t,  # hRasServer : INT_PTR
    wintypes.HANDLE,  # hRasConnection : HANDLE
    ctypes.c_void_p,  # pRasUpdateConnection : RAS_UPDATE_CONNECTION*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprAdminUpdateConnection = mprapi.NewProc("MprAdminUpdateConnection")
)

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