ホーム › NetworkManagement.Rras › MprConfigServerConnect
MprConfigServerConnect
関数ルーター構成サーバーへ接続しハンドルを取得する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprConfigServerConnect(
LPWSTR lpwsServerName, // optional
HANDLE* phMprConfig
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpwsServerName | LPWSTR | inoptional |
| phMprConfig | HANDLE* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprConfigServerConnect(
LPWSTR lpwsServerName, // optional
HANDLE* phMprConfig
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprConfigServerConnect(
[MarshalAs(UnmanagedType.LPWStr)] string lpwsServerName, // LPWSTR optional
IntPtr phMprConfig // HANDLE* out
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprConfigServerConnect(
<MarshalAs(UnmanagedType.LPWStr)> lpwsServerName As String, ' LPWSTR optional
phMprConfig As IntPtr ' HANDLE* out
) As UInteger
End Function' lpwsServerName : LPWSTR optional
' phMprConfig : HANDLE* out
Declare PtrSafe Function MprConfigServerConnect Lib "mprapi" ( _
ByVal lpwsServerName As LongPtr, _
ByVal phMprConfig As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprConfigServerConnect = ctypes.windll.mprapi.MprConfigServerConnect
MprConfigServerConnect.restype = wintypes.DWORD
MprConfigServerConnect.argtypes = [
wintypes.LPCWSTR, # lpwsServerName : LPWSTR optional
ctypes.c_void_p, # phMprConfig : HANDLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprConfigServerConnect = Fiddle::Function.new(
lib['MprConfigServerConnect'],
[
Fiddle::TYPE_VOIDP, # lpwsServerName : LPWSTR optional
Fiddle::TYPE_VOIDP, # phMprConfig : HANDLE* out
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprConfigServerConnect(
lpwsServerName: *mut u16, // LPWSTR optional
phMprConfig: *mut *mut core::ffi::c_void // HANDLE* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprConfigServerConnect([MarshalAs(UnmanagedType.LPWStr)] string lpwsServerName, IntPtr phMprConfig);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprConfigServerConnect' -Namespace Win32 -PassThru
# $api::MprConfigServerConnect(lpwsServerName, phMprConfig)#uselib "MPRAPI.dll"
#func global MprConfigServerConnect "MprConfigServerConnect" sptr, sptr
; MprConfigServerConnect lpwsServerName, phMprConfig ; 戻り値は stat
; lpwsServerName : LPWSTR optional -> "sptr"
; phMprConfig : HANDLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MPRAPI.dll"
#cfunc global MprConfigServerConnect "MprConfigServerConnect" wstr, sptr
; res = MprConfigServerConnect(lpwsServerName, phMprConfig)
; lpwsServerName : LPWSTR optional -> "wstr"
; phMprConfig : HANDLE* out -> "sptr"; DWORD MprConfigServerConnect(LPWSTR lpwsServerName, HANDLE* phMprConfig)
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerConnect "MprConfigServerConnect" wstr, intptr
; res = MprConfigServerConnect(lpwsServerName, phMprConfig)
; lpwsServerName : LPWSTR optional -> "wstr"
; phMprConfig : HANDLE* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprConfigServerConnect = mprapi.NewProc("MprConfigServerConnect")
)
// lpwsServerName (LPWSTR optional), phMprConfig (HANDLE* out)
r1, _, err := procMprConfigServerConnect.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpwsServerName))),
uintptr(phMprConfig),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprConfigServerConnect(
lpwsServerName: PWideChar; // LPWSTR optional
phMprConfig: Pointer // HANDLE* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprConfigServerConnect';result := DllCall("MPRAPI\MprConfigServerConnect"
, "WStr", lpwsServerName ; LPWSTR optional
, "Ptr", phMprConfig ; HANDLE* out
, "UInt") ; return: DWORD●MprConfigServerConnect(lpwsServerName, phMprConfig) = DLL("MPRAPI.dll", "dword MprConfigServerConnect(char*, void*)")
# 呼び出し: MprConfigServerConnect(lpwsServerName, phMprConfig)
# lpwsServerName : LPWSTR optional -> "char*"
# phMprConfig : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。