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

MprConfigServerRestore

関数
指定パスからルーター構成情報を復元する。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD MprConfigServerRestore(
    HANDLE hMprConfig,
    LPWSTR lpwsPath
);

パラメーター

名前方向
hMprConfigHANDLEin
lpwsPathLPWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MprConfigServerRestore(
    HANDLE hMprConfig,
    LPWSTR lpwsPath
);
[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprConfigServerRestore(
    IntPtr hMprConfig,   // HANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string lpwsPath   // LPWSTR
);
<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprConfigServerRestore(
    hMprConfig As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPWStr)> lpwsPath As String   ' LPWSTR
) As UInteger
End Function
' hMprConfig : HANDLE
' lpwsPath : LPWSTR
Declare PtrSafe Function MprConfigServerRestore 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

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

lib = Fiddle.dlopen('MPRAPI.dll')
MprConfigServerRestore = Fiddle::Function.new(
  lib['MprConfigServerRestore'],
  [
    Fiddle::TYPE_VOIDP,  # hMprConfig : HANDLE
    Fiddle::TYPE_VOIDP,  # lpwsPath : LPWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mprapi")]
extern "system" {
    fn MprConfigServerRestore(
        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 MprConfigServerRestore(IntPtr hMprConfig, [MarshalAs(UnmanagedType.LPWStr)] string lpwsPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprConfigServerRestore' -Namespace Win32 -PassThru
# $api::MprConfigServerRestore(hMprConfig, lpwsPath)
#uselib "MPRAPI.dll"
#func global MprConfigServerRestore "MprConfigServerRestore" sptr, sptr
; MprConfigServerRestore hMprConfig, lpwsPath   ; 戻り値は stat
; hMprConfig : HANDLE -> "sptr"
; lpwsPath : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerRestore "MprConfigServerRestore" sptr, wstr
; res = MprConfigServerRestore(hMprConfig, lpwsPath)
; hMprConfig : HANDLE -> "sptr"
; lpwsPath : LPWSTR -> "wstr"
; DWORD MprConfigServerRestore(HANDLE hMprConfig, LPWSTR lpwsPath)
#uselib "MPRAPI.dll"
#cfunc global MprConfigServerRestore "MprConfigServerRestore" intptr, wstr
; res = MprConfigServerRestore(hMprConfig, lpwsPath)
; hMprConfig : HANDLE -> "intptr"
; lpwsPath : LPWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprConfigServerRestore = mprapi.NewProc("MprConfigServerRestore")
)

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