ホーム › NetworkManagement.Rras › MprAdminConnectionGetInfoEx
MprAdminConnectionGetInfoEx
関数RASサーバー上の指定接続の拡張情報を取得する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminConnectionGetInfoEx(
INT_PTR hRasServer,
HANDLE hRasConnection,
RAS_CONNECTION_EX* pRasConnection
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hRasServer | INT_PTR | in | MprAdminServerConnectで取得したRASサーバー接続ハンドル(INT_PTR)。 |
| hRasConnection | HANDLE | in | 情報を取得する対象のRAS接続ハンドル。 |
| pRasConnection | RAS_CONNECTION_EX* | out | 接続情報を受け取るRAS_CONNECTION_EX構造体へのポインタ。ヘッダを事前設定する。 |
戻り値の型: 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 方式にも切替可。#uselib "MPRAPI.dll" #cfunc global MprAdminConnectionGetInfoEx "MprAdminConnectionGetInfoEx" sptr, sptr, sptr ; res = MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, varptr(pRasConnection)) ; hRasServer : INT_PTR -> "sptr" ; hRasConnection : HANDLE -> "sptr" ; pRasConnection : RAS_CONNECTION_EX* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; DWORD MprAdminConnectionGetInfoEx(INT_PTR hRasServer, HANDLE hRasConnection, RAS_CONNECTION_EX* pRasConnection) #uselib "MPRAPI.dll" #cfunc global MprAdminConnectionGetInfoEx "MprAdminConnectionGetInfoEx" intptr, intptr, intptr ; res = MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, varptr(pRasConnection)) ; hRasServer : INT_PTR -> "intptr" ; hRasConnection : HANDLE -> "intptr" ; pRasConnection : RAS_CONNECTION_EX* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // DWORDfunction 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)。const std = @import("std");
extern "mprapi" fn MprAdminConnectionGetInfoEx(
hRasServer: isize, // INT_PTR
hRasConnection: ?*anyopaque, // HANDLE
pRasConnection: [*c]RAS_CONNECTION_EX // RAS_CONNECTION_EX* out
) callconv(std.os.windows.WINAPI) u32;proc MprAdminConnectionGetInfoEx(
hRasServer: int, # INT_PTR
hRasConnection: pointer, # HANDLE
pRasConnection: ptr RAS_CONNECTION_EX # RAS_CONNECTION_EX* out
): uint32 {.importc: "MprAdminConnectionGetInfoEx", stdcall, dynlib: "MPRAPI.dll".}pragma(lib, "mprapi");
extern(Windows)
uint MprAdminConnectionGetInfoEx(
ptrdiff_t hRasServer, // INT_PTR
void* hRasConnection, // HANDLE
RAS_CONNECTION_EX* pRasConnection // RAS_CONNECTION_EX* out
);ccall((:MprAdminConnectionGetInfoEx, "MPRAPI.dll"), stdcall, UInt32,
(Int, Ptr{Cvoid}, Ptr{RAS_CONNECTION_EX}),
hRasServer, hRasConnection, pRasConnection)
# hRasServer : INT_PTR -> Int
# hRasConnection : HANDLE -> Ptr{Cvoid}
# pRasConnection : RAS_CONNECTION_EX* out -> Ptr{RAS_CONNECTION_EX}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t MprAdminConnectionGetInfoEx(
intptr_t hRasServer,
void* hRasConnection,
void* pRasConnection);
]]
local mprapi = ffi.load("mprapi")
-- mprapi.MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, pRasConnection)
-- hRasServer : INT_PTR
-- hRasConnection : HANDLE
-- pRasConnection : RAS_CONNECTION_EX* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MPRAPI.dll');
const MprAdminConnectionGetInfoEx = lib.func('__stdcall', 'MprAdminConnectionGetInfoEx', 'uint32_t', ['intptr_t', 'void *', 'void *']);
// MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, pRasConnection)
// hRasServer : INT_PTR -> 'intptr_t'
// hRasConnection : HANDLE -> 'void *'
// pRasConnection : RAS_CONNECTION_EX* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MPRAPI.dll", {
MprAdminConnectionGetInfoEx: { parameters: ["isize", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, pRasConnection)
// hRasServer : INT_PTR -> "isize"
// hRasConnection : HANDLE -> "pointer"
// pRasConnection : RAS_CONNECTION_EX* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t MprAdminConnectionGetInfoEx(
intptr_t hRasServer,
void* hRasConnection,
void* pRasConnection);
C, "MPRAPI.dll");
// $ffi->MprAdminConnectionGetInfoEx(hRasServer, hRasConnection, pRasConnection);
// hRasServer : INT_PTR
// hRasConnection : HANDLE
// pRasConnection : RAS_CONNECTION_EX* out
// 構造体/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 Mprapi extends StdCallLibrary {
Mprapi INSTANCE = Native.load("mprapi", Mprapi.class);
int MprAdminConnectionGetInfoEx(
long hRasServer, // INT_PTR
Pointer hRasConnection, // HANDLE
Pointer pRasConnection // RAS_CONNECTION_EX* out
);
}@[Link("mprapi")]
lib LibMPRAPI
fun MprAdminConnectionGetInfoEx = MprAdminConnectionGetInfoEx(
hRasServer : LibC::SSizeT, # INT_PTR
hRasConnection : Void*, # HANDLE
pRasConnection : RAS_CONNECTION_EX* # RAS_CONNECTION_EX* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MprAdminConnectionGetInfoExNative = Uint32 Function(IntPtr, Pointer<Void>, Pointer<Void>);
typedef MprAdminConnectionGetInfoExDart = int Function(int, Pointer<Void>, Pointer<Void>);
final MprAdminConnectionGetInfoEx = DynamicLibrary.open('MPRAPI.dll')
.lookupFunction<MprAdminConnectionGetInfoExNative, MprAdminConnectionGetInfoExDart>('MprAdminConnectionGetInfoEx');
// hRasServer : INT_PTR -> IntPtr
// hRasConnection : HANDLE -> Pointer<Void>
// pRasConnection : RAS_CONNECTION_EX* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MprAdminConnectionGetInfoEx(
hRasServer: NativeInt; // INT_PTR
hRasConnection: THandle; // HANDLE
pRasConnection: Pointer // RAS_CONNECTION_EX* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminConnectionGetInfoEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MprAdminConnectionGetInfoEx"
c_MprAdminConnectionGetInfoEx :: CIntPtr -> Ptr () -> Ptr () -> IO Word32
-- hRasServer : INT_PTR -> CIntPtr
-- hRasConnection : HANDLE -> Ptr ()
-- pRasConnection : RAS_CONNECTION_EX* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mpradminconnectiongetinfoex =
foreign "MprAdminConnectionGetInfoEx"
(intptr_t @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* hRasServer : INT_PTR -> intptr_t *)
(* hRasConnection : HANDLE -> (ptr void) *)
(* pRasConnection : RAS_CONNECTION_EX* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mprapi (t "MPRAPI.dll"))
(cffi:use-foreign-library mprapi)
(cffi:defcfun ("MprAdminConnectionGetInfoEx" mpr-admin-connection-get-info-ex :convention :stdcall) :uint32
(h-ras-server :int64) ; INT_PTR
(h-ras-connection :pointer) ; HANDLE
(p-ras-connection :pointer)) ; RAS_CONNECTION_EX* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MprAdminConnectionGetInfoEx = Win32::API::More->new('MPRAPI',
'DWORD MprAdminConnectionGetInfoEx(LPARAM hRasServer, HANDLE hRasConnection, LPVOID pRasConnection)');
# my $ret = $MprAdminConnectionGetInfoEx->Call($hRasServer, $hRasConnection, $pRasConnection);
# hRasServer : INT_PTR -> LPARAM
# hRasConnection : HANDLE -> HANDLE
# pRasConnection : RAS_CONNECTION_EX* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f MprAdminConnectionGetInfo — RASサーバー上の指定接続の情報を取得する。
使用する型