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

MprConfigServerBackup

関数
ルーター構成情報を指定パスにバックアップする。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD MprConfigServerBackup(
    HANDLE hMprConfig,
    LPWSTR lpwsPath
);

パラメーター

名前方向
hMprConfigHANDLEin
lpwsPathLPWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

MprConfigServerBackup = ctypes.windll.mprapi.MprConfigServerBackup
MprConfigServerBackup.restype = wintypes.DWORD
MprConfigServerBackup.argtypes = [
    wintypes.HANDLE,  # hMprConfig : HANDLE
    wintypes.LPCWSTR,  # lpwsPath : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPRAPI.dll')
MprConfigServerBackup = Fiddle::Function.new(
  lib['MprConfigServerBackup'],
  [
    Fiddle::TYPE_VOIDP,  # hMprConfig : HANDLE
    Fiddle::TYPE_VOIDP,  # lpwsPath : LPWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mprapi")]
extern "system" {
    fn MprConfigServerBackup(
        hMprConfig: *mut core::ffi::c_void,  // HANDLE
        lpwsPath: *mut u16  // LPWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprConfigServerBackup(IntPtr hMprConfig, [MarshalAs(UnmanagedType.LPWStr)] string lpwsPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprConfigServerBackup' -Namespace Win32 -PassThru
# $api::MprConfigServerBackup(hMprConfig, lpwsPath)
#uselib "MPRAPI.dll"
#func global MprConfigServerBackup "MprConfigServerBackup" sptr, sptr
; MprConfigServerBackup hMprConfig, lpwsPath   ; 戻り値は stat
; hMprConfig : HANDLE -> "sptr"
; lpwsPath : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerBackup "MprConfigServerBackup" sptr, wstr
; res = MprConfigServerBackup(hMprConfig, lpwsPath)
; hMprConfig : HANDLE -> "sptr"
; lpwsPath : LPWSTR -> "wstr"
; DWORD MprConfigServerBackup(HANDLE hMprConfig, LPWSTR lpwsPath)
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerBackup "MprConfigServerBackup" intptr, wstr
; res = MprConfigServerBackup(hMprConfig, lpwsPath)
; hMprConfig : HANDLE -> "intptr"
; lpwsPath : LPWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprConfigServerBackup = mprapi.NewProc("MprConfigServerBackup")
)

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