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

MprConfigServerSetInfoEx

関数
MPR構成にサーバーの拡張構成情報を設定する。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD MprConfigServerSetInfoEx(
    HANDLE hMprConfig,
    MPR_SERVER_SET_CONFIG_EX1* pSetServerConfig
);

パラメーター

名前方向説明
hMprConfigHANDLEinMprConfigServerConnectで取得した構成サーバーハンドル。
pSetServerConfigMPR_SERVER_SET_CONFIG_EX1*in設定するサーバー構成を格納したMPR_SERVER_SET_CONFIG_EX1構造体へのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MprConfigServerSetInfoEx = ctypes.windll.mprapi.MprConfigServerSetInfoEx
MprConfigServerSetInfoEx.restype = wintypes.DWORD
MprConfigServerSetInfoEx.argtypes = [
    wintypes.HANDLE,  # hMprConfig : HANDLE
    ctypes.c_void_p,  # pSetServerConfig : MPR_SERVER_SET_CONFIG_EX1*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprConfigServerSetInfoEx = mprapi.NewProc("MprConfigServerSetInfoEx")
)

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

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

typedef MprConfigServerSetInfoExNative = Uint32 Function(Pointer<Void>, Pointer<Void>);
typedef MprConfigServerSetInfoExDart = int Function(Pointer<Void>, Pointer<Void>);
final MprConfigServerSetInfoEx = DynamicLibrary.open('MPRAPI.dll')
    .lookupFunction<MprConfigServerSetInfoExNative, MprConfigServerSetInfoExDart>('MprConfigServerSetInfoEx');
// hMprConfig : HANDLE -> Pointer<Void>
// pSetServerConfig : MPR_SERVER_SET_CONFIG_EX1* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MprConfigServerSetInfoEx(
  hMprConfig: THandle;   // HANDLE
  pSetServerConfig: Pointer   // MPR_SERVER_SET_CONFIG_EX1*
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprConfigServerSetInfoEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MprConfigServerSetInfoEx"
  c_MprConfigServerSetInfoEx :: Ptr () -> Ptr () -> IO Word32
-- hMprConfig : HANDLE -> Ptr ()
-- pSetServerConfig : MPR_SERVER_SET_CONFIG_EX1* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mprconfigserversetinfoex =
  foreign "MprConfigServerSetInfoEx"
    ((ptr void) @-> (ptr void) @-> returning uint32_t)
(* hMprConfig : HANDLE -> (ptr void) *)
(* pSetServerConfig : MPR_SERVER_SET_CONFIG_EX1* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mprapi (t "MPRAPI.dll"))
(cffi:use-foreign-library mprapi)

(cffi:defcfun ("MprConfigServerSetInfoEx" mpr-config-server-set-info-ex :convention :stdcall) :uint32
  (h-mpr-config :pointer)   ; HANDLE
  (p-set-server-config :pointer))   ; MPR_SERVER_SET_CONFIG_EX1*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MprConfigServerSetInfoEx = Win32::API::More->new('MPRAPI',
    'DWORD MprConfigServerSetInfoEx(HANDLE hMprConfig, LPVOID pSetServerConfig)');
# my $ret = $MprConfigServerSetInfoEx->Call($hMprConfig, $pSetServerConfig);
# hMprConfig : HANDLE -> HANDLE
# pSetServerConfig : MPR_SERVER_SET_CONFIG_EX1* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
使用する型