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

MprAdminConnectionGetInfoEx

関数
RASサーバー上の指定接続の拡張情報を取得する。
DLLMPRAPI.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

DWORD MprAdminConnectionGetInfoEx(
    INT_PTR hRasServer,
    HANDLE hRasConnection,
    RAS_CONNECTION_EX* pRasConnection
);

パラメーター

名前方向
hRasServerINT_PTRin
hRasConnectionHANDLEin
pRasConnectionRAS_CONNECTION_EX*out

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MprAdminConnectionGetInfoEx = ctypes.windll.mprapi.MprAdminConnectionGetInfoEx
MprAdminConnectionGetInfoEx.restype = wintypes.DWORD
MprAdminConnectionGetInfoEx.argtypes = [
    ctypes.c_ssize_t,  # hRasServer : INT_PTR
    wintypes.HANDLE,  # hRasConnection : HANDLE
    ctypes.c_void_p,  # pRasConnection : RAS_CONNECTION_EX* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprAdminConnectionGetInfoEx = mprapi.NewProc("MprAdminConnectionGetInfoEx")
)

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