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