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