Win32 API 日本語リファレンス
ホームStorage.Jet › JetExternalRestoreW

JetExternalRestoreW

関数
ログ世代を指定して外部バックアップから復元する(Unicode版)。
DLLESENT.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ESENT.dll  (Unicode / -W)
#include <windows.h>

INT JetExternalRestoreW(
    WORD* szCheckpointFilePath,
    WORD* szLogPath,
    JET_RSTMAP_W* rgrstmap,   // optional
    INT crstfilemap,
    WORD* szBackupLogPath,
    INT genLow,
    INT genHigh,
    JET_PFNSTATUS pfn
);

パラメーター

名前方向
szCheckpointFilePathWORD*in
szLogPathWORD*in
rgrstmapJET_RSTMAP_W*inoptional
crstfilemapINTin
szBackupLogPathWORD*in
genLowINTin
genHighINTin
pfnJET_PFNSTATUSin

戻り値の型: INT

各言語での呼び出し定義

// ESENT.dll  (Unicode / -W)
#include <windows.h>

INT JetExternalRestoreW(
    WORD* szCheckpointFilePath,
    WORD* szLogPath,
    JET_RSTMAP_W* rgrstmap,   // optional
    INT crstfilemap,
    WORD* szBackupLogPath,
    INT genLow,
    INT genHigh,
    JET_PFNSTATUS pfn
);
[DllImport("ESENT.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int JetExternalRestoreW(
    ref ushort szCheckpointFilePath,   // WORD*
    ref ushort szLogPath,   // WORD*
    IntPtr rgrstmap,   // JET_RSTMAP_W* optional
    int crstfilemap,   // INT
    ref ushort szBackupLogPath,   // WORD*
    int genLow,   // INT
    int genHigh,   // INT
    IntPtr pfn   // JET_PFNSTATUS
);
<DllImport("ESENT.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function JetExternalRestoreW(
    ByRef szCheckpointFilePath As UShort,   ' WORD*
    ByRef szLogPath As UShort,   ' WORD*
    rgrstmap As IntPtr,   ' JET_RSTMAP_W* optional
    crstfilemap As Integer,   ' INT
    ByRef szBackupLogPath As UShort,   ' WORD*
    genLow As Integer,   ' INT
    genHigh As Integer,   ' INT
    pfn As IntPtr   ' JET_PFNSTATUS
) As Integer
End Function
' szCheckpointFilePath : WORD*
' szLogPath : WORD*
' rgrstmap : JET_RSTMAP_W* optional
' crstfilemap : INT
' szBackupLogPath : WORD*
' genLow : INT
' genHigh : INT
' pfn : JET_PFNSTATUS
Declare PtrSafe Function JetExternalRestoreW Lib "esent" ( _
    ByRef szCheckpointFilePath As Integer, _
    ByRef szLogPath As Integer, _
    ByVal rgrstmap As LongPtr, _
    ByVal crstfilemap As Long, _
    ByRef szBackupLogPath As Integer, _
    ByVal genLow As Long, _
    ByVal genHigh As Long, _
    ByVal pfn As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JetExternalRestoreW = ctypes.windll.esent.JetExternalRestoreW
JetExternalRestoreW.restype = ctypes.c_int
JetExternalRestoreW.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # szCheckpointFilePath : WORD*
    ctypes.POINTER(ctypes.c_ushort),  # szLogPath : WORD*
    ctypes.c_void_p,  # rgrstmap : JET_RSTMAP_W* optional
    ctypes.c_int,  # crstfilemap : INT
    ctypes.POINTER(ctypes.c_ushort),  # szBackupLogPath : WORD*
    ctypes.c_int,  # genLow : INT
    ctypes.c_int,  # genHigh : INT
    ctypes.c_void_p,  # pfn : JET_PFNSTATUS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetExternalRestoreW = Fiddle::Function.new(
  lib['JetExternalRestoreW'],
  [
    Fiddle::TYPE_VOIDP,  # szCheckpointFilePath : WORD*
    Fiddle::TYPE_VOIDP,  # szLogPath : WORD*
    Fiddle::TYPE_VOIDP,  # rgrstmap : JET_RSTMAP_W* optional
    Fiddle::TYPE_INT,  # crstfilemap : INT
    Fiddle::TYPE_VOIDP,  # szBackupLogPath : WORD*
    Fiddle::TYPE_INT,  # genLow : INT
    Fiddle::TYPE_INT,  # genHigh : INT
    Fiddle::TYPE_VOIDP,  # pfn : JET_PFNSTATUS
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "esent")]
extern "system" {
    fn JetExternalRestoreW(
        szCheckpointFilePath: *mut u16,  // WORD*
        szLogPath: *mut u16,  // WORD*
        rgrstmap: *mut JET_RSTMAP_W,  // JET_RSTMAP_W* optional
        crstfilemap: i32,  // INT
        szBackupLogPath: *mut u16,  // WORD*
        genLow: i32,  // INT
        genHigh: i32,  // INT
        pfn: *const core::ffi::c_void  // JET_PFNSTATUS
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll", CharSet = CharSet.Unicode)]
public static extern int JetExternalRestoreW(ref ushort szCheckpointFilePath, ref ushort szLogPath, IntPtr rgrstmap, int crstfilemap, ref ushort szBackupLogPath, int genLow, int genHigh, IntPtr pfn);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetExternalRestoreW' -Namespace Win32 -PassThru
# $api::JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
#uselib "ESENT.dll"
#func global JetExternalRestoreW "JetExternalRestoreW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; JetExternalRestoreW varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn   ; 戻り値は stat
; szCheckpointFilePath : WORD* -> "wptr"
; szLogPath : WORD* -> "wptr"
; rgrstmap : JET_RSTMAP_W* optional -> "wptr"
; crstfilemap : INT -> "wptr"
; szBackupLogPath : WORD* -> "wptr"
; genLow : INT -> "wptr"
; genHigh : INT -> "wptr"
; pfn : JET_PFNSTATUS -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ESENT.dll"
#cfunc global JetExternalRestoreW "JetExternalRestoreW" var, var, var, int, var, int, int, sptr
; res = JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
; szCheckpointFilePath : WORD* -> "var"
; szLogPath : WORD* -> "var"
; rgrstmap : JET_RSTMAP_W* optional -> "var"
; crstfilemap : INT -> "int"
; szBackupLogPath : WORD* -> "var"
; genLow : INT -> "int"
; genHigh : INT -> "int"
; pfn : JET_PFNSTATUS -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT JetExternalRestoreW(WORD* szCheckpointFilePath, WORD* szLogPath, JET_RSTMAP_W* rgrstmap, INT crstfilemap, WORD* szBackupLogPath, INT genLow, INT genHigh, JET_PFNSTATUS pfn)
#uselib "ESENT.dll"
#cfunc global JetExternalRestoreW "JetExternalRestoreW" var, var, var, int, var, int, int, intptr
; res = JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
; szCheckpointFilePath : WORD* -> "var"
; szLogPath : WORD* -> "var"
; rgrstmap : JET_RSTMAP_W* optional -> "var"
; crstfilemap : INT -> "int"
; szBackupLogPath : WORD* -> "var"
; genLow : INT -> "int"
; genHigh : INT -> "int"
; pfn : JET_PFNSTATUS -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetExternalRestoreW = esent.NewProc("JetExternalRestoreW")
)

// szCheckpointFilePath (WORD*), szLogPath (WORD*), rgrstmap (JET_RSTMAP_W* optional), crstfilemap (INT), szBackupLogPath (WORD*), genLow (INT), genHigh (INT), pfn (JET_PFNSTATUS)
r1, _, err := procJetExternalRestoreW.Call(
	uintptr(szCheckpointFilePath),
	uintptr(szLogPath),
	uintptr(rgrstmap),
	uintptr(crstfilemap),
	uintptr(szBackupLogPath),
	uintptr(genLow),
	uintptr(genHigh),
	uintptr(pfn),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function JetExternalRestoreW(
  szCheckpointFilePath: Pointer;   // WORD*
  szLogPath: Pointer;   // WORD*
  rgrstmap: Pointer;   // JET_RSTMAP_W* optional
  crstfilemap: Integer;   // INT
  szBackupLogPath: Pointer;   // WORD*
  genLow: Integer;   // INT
  genHigh: Integer;   // INT
  pfn: Pointer   // JET_PFNSTATUS
): Integer; stdcall;
  external 'ESENT.dll' name 'JetExternalRestoreW';
result := DllCall("ESENT\JetExternalRestoreW"
    , "Ptr", szCheckpointFilePath   ; WORD*
    , "Ptr", szLogPath   ; WORD*
    , "Ptr", rgrstmap   ; JET_RSTMAP_W* optional
    , "Int", crstfilemap   ; INT
    , "Ptr", szBackupLogPath   ; WORD*
    , "Int", genLow   ; INT
    , "Int", genHigh   ; INT
    , "Ptr", pfn   ; JET_PFNSTATUS
    , "Int")   ; return: INT
●JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn) = DLL("ESENT.dll", "int JetExternalRestoreW(void*, void*, void*, int, void*, int, int, void*)")
# 呼び出し: JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
# szCheckpointFilePath : WORD* -> "void*"
# szLogPath : WORD* -> "void*"
# rgrstmap : JET_RSTMAP_W* optional -> "void*"
# crstfilemap : INT -> "int"
# szBackupLogPath : WORD* -> "void*"
# genLow : INT -> "int"
# genHigh : INT -> "int"
# pfn : JET_PFNSTATUS -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。