ホーム › NetworkManagement.Rras › MprAdminServerGetInfoEx
MprAdminServerGetInfoEx
関数RAS/ルーティングサーバーの拡張構成情報を取得する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminServerGetInfoEx(
INT_PTR hMprServer,
MPR_SERVER_EX1* pServerInfo
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hMprServer | INT_PTR | in | MprAdminServerConnectで取得したMPRサーバーハンドル(INT_PTR)。 |
| pServerInfo | MPR_SERVER_EX1* | out | サーバー構成情報を受け取るMPR_SERVER_EX1構造体へのポインタ。ヘッダを事前設定する。 |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminServerGetInfoEx(
INT_PTR hMprServer,
MPR_SERVER_EX1* pServerInfo
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminServerGetInfoEx(
IntPtr hMprServer, // INT_PTR
IntPtr pServerInfo // MPR_SERVER_EX1* out
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminServerGetInfoEx(
hMprServer As IntPtr, ' INT_PTR
pServerInfo As IntPtr ' MPR_SERVER_EX1* out
) As UInteger
End Function' hMprServer : INT_PTR
' pServerInfo : MPR_SERVER_EX1* out
Declare PtrSafe Function MprAdminServerGetInfoEx Lib "mprapi" ( _
ByVal hMprServer As LongPtr, _
ByVal pServerInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprAdminServerGetInfoEx = ctypes.windll.mprapi.MprAdminServerGetInfoEx
MprAdminServerGetInfoEx.restype = wintypes.DWORD
MprAdminServerGetInfoEx.argtypes = [
ctypes.c_ssize_t, # hMprServer : INT_PTR
ctypes.c_void_p, # pServerInfo : MPR_SERVER_EX1* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminServerGetInfoEx = Fiddle::Function.new(
lib['MprAdminServerGetInfoEx'],
[
Fiddle::TYPE_INTPTR_T, # hMprServer : INT_PTR
Fiddle::TYPE_VOIDP, # pServerInfo : MPR_SERVER_EX1* out
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprAdminServerGetInfoEx(
hMprServer: isize, // INT_PTR
pServerInfo: *mut MPR_SERVER_EX1 // MPR_SERVER_EX1* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminServerGetInfoEx(IntPtr hMprServer, IntPtr pServerInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminServerGetInfoEx' -Namespace Win32 -PassThru
# $api::MprAdminServerGetInfoEx(hMprServer, pServerInfo)#uselib "MPRAPI.dll"
#func global MprAdminServerGetInfoEx "MprAdminServerGetInfoEx" sptr, sptr
; MprAdminServerGetInfoEx hMprServer, varptr(pServerInfo) ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; pServerInfo : MPR_SERVER_EX1* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MPRAPI.dll" #cfunc global MprAdminServerGetInfoEx "MprAdminServerGetInfoEx" sptr, var ; res = MprAdminServerGetInfoEx(hMprServer, pServerInfo) ; hMprServer : INT_PTR -> "sptr" ; pServerInfo : MPR_SERVER_EX1* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MPRAPI.dll" #cfunc global MprAdminServerGetInfoEx "MprAdminServerGetInfoEx" sptr, sptr ; res = MprAdminServerGetInfoEx(hMprServer, varptr(pServerInfo)) ; hMprServer : INT_PTR -> "sptr" ; pServerInfo : MPR_SERVER_EX1* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MprAdminServerGetInfoEx(INT_PTR hMprServer, MPR_SERVER_EX1* pServerInfo) #uselib "MPRAPI.dll" #cfunc global MprAdminServerGetInfoEx "MprAdminServerGetInfoEx" intptr, var ; res = MprAdminServerGetInfoEx(hMprServer, pServerInfo) ; hMprServer : INT_PTR -> "intptr" ; pServerInfo : MPR_SERVER_EX1* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MprAdminServerGetInfoEx(INT_PTR hMprServer, MPR_SERVER_EX1* pServerInfo) #uselib "MPRAPI.dll" #cfunc global MprAdminServerGetInfoEx "MprAdminServerGetInfoEx" intptr, intptr ; res = MprAdminServerGetInfoEx(hMprServer, varptr(pServerInfo)) ; hMprServer : INT_PTR -> "intptr" ; pServerInfo : MPR_SERVER_EX1* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprAdminServerGetInfoEx = mprapi.NewProc("MprAdminServerGetInfoEx")
)
// hMprServer (INT_PTR), pServerInfo (MPR_SERVER_EX1* out)
r1, _, err := procMprAdminServerGetInfoEx.Call(
uintptr(hMprServer),
uintptr(pServerInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprAdminServerGetInfoEx(
hMprServer: NativeInt; // INT_PTR
pServerInfo: Pointer // MPR_SERVER_EX1* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminServerGetInfoEx';result := DllCall("MPRAPI\MprAdminServerGetInfoEx"
, "Ptr", hMprServer ; INT_PTR
, "Ptr", pServerInfo ; MPR_SERVER_EX1* out
, "UInt") ; return: DWORD●MprAdminServerGetInfoEx(hMprServer, pServerInfo) = DLL("MPRAPI.dll", "dword MprAdminServerGetInfoEx(int, void*)")
# 呼び出し: MprAdminServerGetInfoEx(hMprServer, pServerInfo)
# hMprServer : INT_PTR -> "int"
# pServerInfo : MPR_SERVER_EX1* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mprapi" fn MprAdminServerGetInfoEx(
hMprServer: isize, // INT_PTR
pServerInfo: [*c]MPR_SERVER_EX1 // MPR_SERVER_EX1* out
) callconv(std.os.windows.WINAPI) u32;proc MprAdminServerGetInfoEx(
hMprServer: int, # INT_PTR
pServerInfo: ptr MPR_SERVER_EX1 # MPR_SERVER_EX1* out
): uint32 {.importc: "MprAdminServerGetInfoEx", stdcall, dynlib: "MPRAPI.dll".}pragma(lib, "mprapi");
extern(Windows)
uint MprAdminServerGetInfoEx(
ptrdiff_t hMprServer, // INT_PTR
MPR_SERVER_EX1* pServerInfo // MPR_SERVER_EX1* out
);ccall((:MprAdminServerGetInfoEx, "MPRAPI.dll"), stdcall, UInt32,
(Int, Ptr{MPR_SERVER_EX1}),
hMprServer, pServerInfo)
# hMprServer : INT_PTR -> Int
# pServerInfo : MPR_SERVER_EX1* out -> Ptr{MPR_SERVER_EX1}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t MprAdminServerGetInfoEx(
intptr_t hMprServer,
void* pServerInfo);
]]
local mprapi = ffi.load("mprapi")
-- mprapi.MprAdminServerGetInfoEx(hMprServer, pServerInfo)
-- hMprServer : INT_PTR
-- pServerInfo : MPR_SERVER_EX1* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MPRAPI.dll');
const MprAdminServerGetInfoEx = lib.func('__stdcall', 'MprAdminServerGetInfoEx', 'uint32_t', ['intptr_t', 'void *']);
// MprAdminServerGetInfoEx(hMprServer, pServerInfo)
// hMprServer : INT_PTR -> 'intptr_t'
// pServerInfo : MPR_SERVER_EX1* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MPRAPI.dll", {
MprAdminServerGetInfoEx: { parameters: ["isize", "pointer"], result: "u32" },
});
// lib.symbols.MprAdminServerGetInfoEx(hMprServer, pServerInfo)
// hMprServer : INT_PTR -> "isize"
// pServerInfo : MPR_SERVER_EX1* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t MprAdminServerGetInfoEx(
intptr_t hMprServer,
void* pServerInfo);
C, "MPRAPI.dll");
// $ffi->MprAdminServerGetInfoEx(hMprServer, pServerInfo);
// hMprServer : INT_PTR
// pServerInfo : MPR_SERVER_EX1* 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 MprAdminServerGetInfoEx(
long hMprServer, // INT_PTR
Pointer pServerInfo // MPR_SERVER_EX1* out
);
}@[Link("mprapi")]
lib LibMPRAPI
fun MprAdminServerGetInfoEx = MprAdminServerGetInfoEx(
hMprServer : LibC::SSizeT, # INT_PTR
pServerInfo : MPR_SERVER_EX1* # MPR_SERVER_EX1* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MprAdminServerGetInfoExNative = Uint32 Function(IntPtr, Pointer<Void>);
typedef MprAdminServerGetInfoExDart = int Function(int, Pointer<Void>);
final MprAdminServerGetInfoEx = DynamicLibrary.open('MPRAPI.dll')
.lookupFunction<MprAdminServerGetInfoExNative, MprAdminServerGetInfoExDart>('MprAdminServerGetInfoEx');
// hMprServer : INT_PTR -> IntPtr
// pServerInfo : MPR_SERVER_EX1* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MprAdminServerGetInfoEx(
hMprServer: NativeInt; // INT_PTR
pServerInfo: Pointer // MPR_SERVER_EX1* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminServerGetInfoEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MprAdminServerGetInfoEx"
c_MprAdminServerGetInfoEx :: CIntPtr -> Ptr () -> IO Word32
-- hMprServer : INT_PTR -> CIntPtr
-- pServerInfo : MPR_SERVER_EX1* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mpradminservergetinfoex =
foreign "MprAdminServerGetInfoEx"
(intptr_t @-> (ptr void) @-> returning uint32_t)
(* hMprServer : INT_PTR -> intptr_t *)
(* pServerInfo : MPR_SERVER_EX1* 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 ("MprAdminServerGetInfoEx" mpr-admin-server-get-info-ex :convention :stdcall) :uint32
(h-mpr-server :int64) ; INT_PTR
(p-server-info :pointer)) ; MPR_SERVER_EX1* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MprAdminServerGetInfoEx = Win32::API::More->new('MPRAPI',
'DWORD MprAdminServerGetInfoEx(LPARAM hMprServer, LPVOID pServerInfo)');
# my $ret = $MprAdminServerGetInfoEx->Call($hMprServer, $pServerInfo);
# hMprServer : INT_PTR -> LPARAM
# pServerInfo : MPR_SERVER_EX1* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f MprAdminServerGetInfo — ルーターサーバーの構成情報を取得する。
使用する型