ホーム › NetworkManagement.Rras › MprAdminServerGetCredentials
MprAdminServerGetCredentials
関数ルーターサーバーの認証資格情報を取得する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminServerGetCredentials(
INT_PTR hMprServer,
DWORD dwLevel,
BYTE** lplpbBuffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hMprServer | INT_PTR | in |
| dwLevel | DWORD | in |
| lplpbBuffer | BYTE** | in |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminServerGetCredentials(
INT_PTR hMprServer,
DWORD dwLevel,
BYTE** lplpbBuffer
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminServerGetCredentials(
IntPtr hMprServer, // INT_PTR
uint dwLevel, // DWORD
IntPtr lplpbBuffer // BYTE**
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminServerGetCredentials(
hMprServer As IntPtr, ' INT_PTR
dwLevel As UInteger, ' DWORD
lplpbBuffer As IntPtr ' BYTE**
) As UInteger
End Function' hMprServer : INT_PTR
' dwLevel : DWORD
' lplpbBuffer : BYTE**
Declare PtrSafe Function MprAdminServerGetCredentials Lib "mprapi" ( _
ByVal hMprServer As LongPtr, _
ByVal dwLevel As Long, _
ByVal lplpbBuffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprAdminServerGetCredentials = ctypes.windll.mprapi.MprAdminServerGetCredentials
MprAdminServerGetCredentials.restype = wintypes.DWORD
MprAdminServerGetCredentials.argtypes = [
ctypes.c_ssize_t, # hMprServer : INT_PTR
wintypes.DWORD, # dwLevel : DWORD
ctypes.c_void_p, # lplpbBuffer : BYTE**
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminServerGetCredentials = Fiddle::Function.new(
lib['MprAdminServerGetCredentials'],
[
Fiddle::TYPE_INTPTR_T, # hMprServer : INT_PTR
-Fiddle::TYPE_INT, # dwLevel : DWORD
Fiddle::TYPE_VOIDP, # lplpbBuffer : BYTE**
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprAdminServerGetCredentials(
hMprServer: isize, // INT_PTR
dwLevel: u32, // DWORD
lplpbBuffer: *mut *mut u8 // BYTE**
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminServerGetCredentials(IntPtr hMprServer, uint dwLevel, IntPtr lplpbBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminServerGetCredentials' -Namespace Win32 -PassThru
# $api::MprAdminServerGetCredentials(hMprServer, dwLevel, lplpbBuffer)#uselib "MPRAPI.dll"
#func global MprAdminServerGetCredentials "MprAdminServerGetCredentials" sptr, sptr, sptr
; MprAdminServerGetCredentials hMprServer, dwLevel, varptr(lplpbBuffer) ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; dwLevel : DWORD -> "sptr"
; lplpbBuffer : BYTE** -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MPRAPI.dll" #cfunc global MprAdminServerGetCredentials "MprAdminServerGetCredentials" sptr, int, var ; res = MprAdminServerGetCredentials(hMprServer, dwLevel, lplpbBuffer) ; hMprServer : INT_PTR -> "sptr" ; dwLevel : DWORD -> "int" ; lplpbBuffer : BYTE** -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MPRAPI.dll" #cfunc global MprAdminServerGetCredentials "MprAdminServerGetCredentials" sptr, int, sptr ; res = MprAdminServerGetCredentials(hMprServer, dwLevel, varptr(lplpbBuffer)) ; hMprServer : INT_PTR -> "sptr" ; dwLevel : DWORD -> "int" ; lplpbBuffer : BYTE** -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MprAdminServerGetCredentials(INT_PTR hMprServer, DWORD dwLevel, BYTE** lplpbBuffer) #uselib "MPRAPI.dll" #cfunc global MprAdminServerGetCredentials "MprAdminServerGetCredentials" intptr, int, var ; res = MprAdminServerGetCredentials(hMprServer, dwLevel, lplpbBuffer) ; hMprServer : INT_PTR -> "intptr" ; dwLevel : DWORD -> "int" ; lplpbBuffer : BYTE** -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MprAdminServerGetCredentials(INT_PTR hMprServer, DWORD dwLevel, BYTE** lplpbBuffer) #uselib "MPRAPI.dll" #cfunc global MprAdminServerGetCredentials "MprAdminServerGetCredentials" intptr, int, intptr ; res = MprAdminServerGetCredentials(hMprServer, dwLevel, varptr(lplpbBuffer)) ; hMprServer : INT_PTR -> "intptr" ; dwLevel : DWORD -> "int" ; lplpbBuffer : BYTE** -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprAdminServerGetCredentials = mprapi.NewProc("MprAdminServerGetCredentials")
)
// hMprServer (INT_PTR), dwLevel (DWORD), lplpbBuffer (BYTE**)
r1, _, err := procMprAdminServerGetCredentials.Call(
uintptr(hMprServer),
uintptr(dwLevel),
uintptr(lplpbBuffer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprAdminServerGetCredentials(
hMprServer: NativeInt; // INT_PTR
dwLevel: DWORD; // DWORD
lplpbBuffer: Pointer // BYTE**
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminServerGetCredentials';result := DllCall("MPRAPI\MprAdminServerGetCredentials"
, "Ptr", hMprServer ; INT_PTR
, "UInt", dwLevel ; DWORD
, "Ptr", lplpbBuffer ; BYTE**
, "UInt") ; return: DWORD●MprAdminServerGetCredentials(hMprServer, dwLevel, lplpbBuffer) = DLL("MPRAPI.dll", "dword MprAdminServerGetCredentials(int, dword, void*)")
# 呼び出し: MprAdminServerGetCredentials(hMprServer, dwLevel, lplpbBuffer)
# hMprServer : INT_PTR -> "int"
# dwLevel : DWORD -> "dword"
# lplpbBuffer : BYTE** -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。