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