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