Win32 API 日本語リファレンス
ホームNetworkManagement.Rras › MprConfigServerSetInfo

MprConfigServerSetInfo

関数
ルーター構成サーバーの構成情報を設定する。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2003

シグネチャ

// MPRAPI.dll
#include <windows.h>

DWORD MprConfigServerSetInfo(
    INT_PTR hMprServer,
    DWORD dwLevel,
    BYTE* lpbBuffer
);

パラメーター

名前方向説明
hMprServerINT_PTRin対象サーバーの構成ハンドル。
dwLevelDWORDinlpbBufferが指す構成情報のレベルを示す値。
lpbBufferBYTE*in設定するサーバー構成情報を格納したバッファへのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

// MPRAPI.dll
#include <windows.h>

DWORD MprConfigServerSetInfo(
    INT_PTR hMprServer,
    DWORD dwLevel,
    BYTE* lpbBuffer
);
[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprConfigServerSetInfo(
    IntPtr hMprServer,   // INT_PTR
    uint dwLevel,   // DWORD
    IntPtr lpbBuffer   // BYTE*
);
<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprConfigServerSetInfo(
    hMprServer As IntPtr,   ' INT_PTR
    dwLevel As UInteger,   ' DWORD
    lpbBuffer As IntPtr   ' BYTE*
) As UInteger
End Function
' hMprServer : INT_PTR
' dwLevel : DWORD
' lpbBuffer : BYTE*
Declare PtrSafe Function MprConfigServerSetInfo Lib "mprapi" ( _
    ByVal hMprServer As LongPtr, _
    ByVal dwLevel As Long, _
    ByVal lpbBuffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MprConfigServerSetInfo = ctypes.windll.mprapi.MprConfigServerSetInfo
MprConfigServerSetInfo.restype = wintypes.DWORD
MprConfigServerSetInfo.argtypes = [
    ctypes.c_ssize_t,  # hMprServer : INT_PTR
    wintypes.DWORD,  # dwLevel : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # lpbBuffer : BYTE*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPRAPI.dll')
MprConfigServerSetInfo = Fiddle::Function.new(
  lib['MprConfigServerSetInfo'],
  [
    Fiddle::TYPE_INTPTR_T,  # hMprServer : INT_PTR
    -Fiddle::TYPE_INT,  # dwLevel : DWORD
    Fiddle::TYPE_VOIDP,  # lpbBuffer : BYTE*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mprapi")]
extern "system" {
    fn MprConfigServerSetInfo(
        hMprServer: isize,  // INT_PTR
        dwLevel: u32,  // DWORD
        lpbBuffer: *mut u8  // BYTE*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprConfigServerSetInfo(IntPtr hMprServer, uint dwLevel, IntPtr lpbBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprConfigServerSetInfo' -Namespace Win32 -PassThru
# $api::MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
#uselib "MPRAPI.dll"
#func global MprConfigServerSetInfo "MprConfigServerSetInfo" sptr, sptr, sptr
; MprConfigServerSetInfo hMprServer, dwLevel, varptr(lpbBuffer)   ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; dwLevel : DWORD -> "sptr"
; lpbBuffer : BYTE* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerSetInfo "MprConfigServerSetInfo" sptr, int, var
; res = MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
; hMprServer : INT_PTR -> "sptr"
; dwLevel : DWORD -> "int"
; lpbBuffer : BYTE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MprConfigServerSetInfo(INT_PTR hMprServer, DWORD dwLevel, BYTE* lpbBuffer)
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerSetInfo "MprConfigServerSetInfo" intptr, int, var
; res = MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
; hMprServer : INT_PTR -> "intptr"
; dwLevel : DWORD -> "int"
; lpbBuffer : BYTE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprConfigServerSetInfo = mprapi.NewProc("MprConfigServerSetInfo")
)

// hMprServer (INT_PTR), dwLevel (DWORD), lpbBuffer (BYTE*)
r1, _, err := procMprConfigServerSetInfo.Call(
	uintptr(hMprServer),
	uintptr(dwLevel),
	uintptr(lpbBuffer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MprConfigServerSetInfo(
  hMprServer: NativeInt;   // INT_PTR
  dwLevel: DWORD;   // DWORD
  lpbBuffer: Pointer   // BYTE*
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprConfigServerSetInfo';
result := DllCall("MPRAPI\MprConfigServerSetInfo"
    , "Ptr", hMprServer   ; INT_PTR
    , "UInt", dwLevel   ; DWORD
    , "Ptr", lpbBuffer   ; BYTE*
    , "UInt")   ; return: DWORD
●MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer) = DLL("MPRAPI.dll", "dword MprConfigServerSetInfo(int, dword, void*)")
# 呼び出し: MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
# hMprServer : INT_PTR -> "int"
# dwLevel : DWORD -> "dword"
# lpbBuffer : BYTE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mprapi" fn MprConfigServerSetInfo(
    hMprServer: isize, // INT_PTR
    dwLevel: u32, // DWORD
    lpbBuffer: [*c]u8 // BYTE*
) callconv(std.os.windows.WINAPI) u32;
proc MprConfigServerSetInfo(
    hMprServer: int,  # INT_PTR
    dwLevel: uint32,  # DWORD
    lpbBuffer: ptr uint8  # BYTE*
): uint32 {.importc: "MprConfigServerSetInfo", stdcall, dynlib: "MPRAPI.dll".}
pragma(lib, "mprapi");
extern(Windows)
uint MprConfigServerSetInfo(
    ptrdiff_t hMprServer,   // INT_PTR
    uint dwLevel,   // DWORD
    ubyte* lpbBuffer   // BYTE*
);
ccall((:MprConfigServerSetInfo, "MPRAPI.dll"), stdcall, UInt32,
      (Int, UInt32, Ptr{UInt8}),
      hMprServer, dwLevel, lpbBuffer)
# hMprServer : INT_PTR -> Int
# dwLevel : DWORD -> UInt32
# lpbBuffer : BYTE* -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MprConfigServerSetInfo(
    intptr_t hMprServer,
    uint32_t dwLevel,
    uint8_t* lpbBuffer);
]]
local mprapi = ffi.load("mprapi")
-- mprapi.MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
-- hMprServer : INT_PTR
-- dwLevel : DWORD
-- lpbBuffer : BYTE*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MPRAPI.dll');
const MprConfigServerSetInfo = lib.func('__stdcall', 'MprConfigServerSetInfo', 'uint32_t', ['intptr_t', 'uint32_t', 'uint8_t *']);
// MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
// hMprServer : INT_PTR -> 'intptr_t'
// dwLevel : DWORD -> 'uint32_t'
// lpbBuffer : BYTE* -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MPRAPI.dll", {
  MprConfigServerSetInfo: { parameters: ["isize", "u32", "pointer"], result: "u32" },
});
// lib.symbols.MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer)
// hMprServer : INT_PTR -> "isize"
// dwLevel : DWORD -> "u32"
// lpbBuffer : BYTE* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MprConfigServerSetInfo(
    intptr_t hMprServer,
    uint32_t dwLevel,
    uint8_t* lpbBuffer);
C, "MPRAPI.dll");
// $ffi->MprConfigServerSetInfo(hMprServer, dwLevel, lpbBuffer);
// hMprServer : INT_PTR
// dwLevel : DWORD
// lpbBuffer : BYTE*
// 構造体/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 MprConfigServerSetInfo(
        long hMprServer,   // INT_PTR
        int dwLevel,   // DWORD
        byte[] lpbBuffer   // BYTE*
    );
}
@[Link("mprapi")]
lib LibMPRAPI
  fun MprConfigServerSetInfo = MprConfigServerSetInfo(
    hMprServer : LibC::SSizeT,   # INT_PTR
    dwLevel : UInt32,   # DWORD
    lpbBuffer : UInt8*   # BYTE*
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MprConfigServerSetInfoNative = Uint32 Function(IntPtr, Uint32, Pointer<Uint8>);
typedef MprConfigServerSetInfoDart = int Function(int, int, Pointer<Uint8>);
final MprConfigServerSetInfo = DynamicLibrary.open('MPRAPI.dll')
    .lookupFunction<MprConfigServerSetInfoNative, MprConfigServerSetInfoDart>('MprConfigServerSetInfo');
// hMprServer : INT_PTR -> IntPtr
// dwLevel : DWORD -> Uint32
// lpbBuffer : BYTE* -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MprConfigServerSetInfo(
  hMprServer: NativeInt;   // INT_PTR
  dwLevel: DWORD;   // DWORD
  lpbBuffer: Pointer   // BYTE*
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprConfigServerSetInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MprConfigServerSetInfo"
  c_MprConfigServerSetInfo :: CIntPtr -> Word32 -> Ptr Word8 -> IO Word32
-- hMprServer : INT_PTR -> CIntPtr
-- dwLevel : DWORD -> Word32
-- lpbBuffer : BYTE* -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mprconfigserversetinfo =
  foreign "MprConfigServerSetInfo"
    (intptr_t @-> uint32_t @-> (ptr uint8_t) @-> returning uint32_t)
(* hMprServer : INT_PTR -> intptr_t *)
(* dwLevel : DWORD -> uint32_t *)
(* lpbBuffer : BYTE* -> (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 ("MprConfigServerSetInfo" mpr-config-server-set-info :convention :stdcall) :uint32
  (h-mpr-server :int64)   ; INT_PTR
  (dw-level :uint32)   ; DWORD
  (lpb-buffer :pointer))   ; BYTE*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MprConfigServerSetInfo = Win32::API::More->new('MPRAPI',
    'DWORD MprConfigServerSetInfo(LPARAM hMprServer, DWORD dwLevel, LPVOID lpbBuffer)');
# my $ret = $MprConfigServerSetInfo->Call($hMprServer, $dwLevel, $lpbBuffer);
# hMprServer : INT_PTR -> LPARAM
# dwLevel : DWORD -> DWORD
# lpbBuffer : BYTE* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API