ホーム › Storage.Jet › JetExternalRestoreA
JetExternalRestoreA
関数ログ世代を指定して外部バックアップから復元する(ANSI版)。
シグネチャ
// ESENT.dll (ANSI / -A)
#include <windows.h>
INT JetExternalRestoreA(
CHAR* szCheckpointFilePath,
CHAR* szLogPath,
JET_RSTMAP_A* rgrstmap, // optional
INT crstfilemap,
CHAR* szBackupLogPath,
INT genLow,
INT genHigh,
JET_PFNSTATUS pfn
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szCheckpointFilePath | CHAR* | in |
| szLogPath | CHAR* | in |
| rgrstmap | JET_RSTMAP_A* | inoptional |
| crstfilemap | INT | in |
| szBackupLogPath | CHAR* | in |
| genLow | INT | in |
| genHigh | INT | in |
| pfn | JET_PFNSTATUS | in |
戻り値の型: INT
各言語での呼び出し定義
// ESENT.dll (ANSI / -A)
#include <windows.h>
INT JetExternalRestoreA(
CHAR* szCheckpointFilePath,
CHAR* szLogPath,
JET_RSTMAP_A* rgrstmap, // optional
INT crstfilemap,
CHAR* szBackupLogPath,
INT genLow,
INT genHigh,
JET_PFNSTATUS pfn
);[DllImport("ESENT.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int JetExternalRestoreA(
IntPtr szCheckpointFilePath, // CHAR*
IntPtr szLogPath, // CHAR*
IntPtr rgrstmap, // JET_RSTMAP_A* optional
int crstfilemap, // INT
IntPtr szBackupLogPath, // CHAR*
int genLow, // INT
int genHigh, // INT
IntPtr pfn // JET_PFNSTATUS
);<DllImport("ESENT.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function JetExternalRestoreA(
szCheckpointFilePath As IntPtr, ' CHAR*
szLogPath As IntPtr, ' CHAR*
rgrstmap As IntPtr, ' JET_RSTMAP_A* optional
crstfilemap As Integer, ' INT
szBackupLogPath As IntPtr, ' CHAR*
genLow As Integer, ' INT
genHigh As Integer, ' INT
pfn As IntPtr ' JET_PFNSTATUS
) As Integer
End Function' szCheckpointFilePath : CHAR*
' szLogPath : CHAR*
' rgrstmap : JET_RSTMAP_A* optional
' crstfilemap : INT
' szBackupLogPath : CHAR*
' genLow : INT
' genHigh : INT
' pfn : JET_PFNSTATUS
Declare PtrSafe Function JetExternalRestoreA Lib "esent" ( _
ByVal szCheckpointFilePath As LongPtr, _
ByVal szLogPath As LongPtr, _
ByVal rgrstmap As LongPtr, _
ByVal crstfilemap As Long, _
ByVal szBackupLogPath As LongPtr, _
ByVal genLow As Long, _
ByVal genHigh As Long, _
ByVal pfn As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JetExternalRestoreA = ctypes.windll.esent.JetExternalRestoreA
JetExternalRestoreA.restype = ctypes.c_int
JetExternalRestoreA.argtypes = [
ctypes.POINTER(ctypes.c_byte), # szCheckpointFilePath : CHAR*
ctypes.POINTER(ctypes.c_byte), # szLogPath : CHAR*
ctypes.c_void_p, # rgrstmap : JET_RSTMAP_A* optional
ctypes.c_int, # crstfilemap : INT
ctypes.POINTER(ctypes.c_byte), # szBackupLogPath : CHAR*
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')
JetExternalRestoreA = Fiddle::Function.new(
lib['JetExternalRestoreA'],
[
Fiddle::TYPE_VOIDP, # szCheckpointFilePath : CHAR*
Fiddle::TYPE_VOIDP, # szLogPath : CHAR*
Fiddle::TYPE_VOIDP, # rgrstmap : JET_RSTMAP_A* optional
Fiddle::TYPE_INT, # crstfilemap : INT
Fiddle::TYPE_VOIDP, # szBackupLogPath : CHAR*
Fiddle::TYPE_INT, # genLow : INT
Fiddle::TYPE_INT, # genHigh : INT
Fiddle::TYPE_VOIDP, # pfn : JET_PFNSTATUS
],
Fiddle::TYPE_INT)#[link(name = "esent")]
extern "system" {
fn JetExternalRestoreA(
szCheckpointFilePath: *mut i8, // CHAR*
szLogPath: *mut i8, // CHAR*
rgrstmap: *mut JET_RSTMAP_A, // JET_RSTMAP_A* optional
crstfilemap: i32, // INT
szBackupLogPath: *mut i8, // CHAR*
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.Ansi)]
public static extern int JetExternalRestoreA(IntPtr szCheckpointFilePath, IntPtr szLogPath, IntPtr rgrstmap, int crstfilemap, IntPtr szBackupLogPath, int genLow, int genHigh, IntPtr pfn);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetExternalRestoreA' -Namespace Win32 -PassThru
# $api::JetExternalRestoreA(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)#uselib "ESENT.dll"
#func global JetExternalRestoreA "JetExternalRestoreA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; JetExternalRestoreA varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn ; 戻り値は stat
; szCheckpointFilePath : CHAR* -> "sptr"
; szLogPath : CHAR* -> "sptr"
; rgrstmap : JET_RSTMAP_A* optional -> "sptr"
; crstfilemap : INT -> "sptr"
; szBackupLogPath : CHAR* -> "sptr"
; genLow : INT -> "sptr"
; genHigh : INT -> "sptr"
; pfn : JET_PFNSTATUS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ESENT.dll" #cfunc global JetExternalRestoreA "JetExternalRestoreA" var, var, var, int, var, int, int, sptr ; res = JetExternalRestoreA(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn) ; szCheckpointFilePath : CHAR* -> "var" ; szLogPath : CHAR* -> "var" ; rgrstmap : JET_RSTMAP_A* optional -> "var" ; crstfilemap : INT -> "int" ; szBackupLogPath : CHAR* -> "var" ; genLow : INT -> "int" ; genHigh : INT -> "int" ; pfn : JET_PFNSTATUS -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ESENT.dll" #cfunc global JetExternalRestoreA "JetExternalRestoreA" sptr, sptr, sptr, int, sptr, int, int, sptr ; res = JetExternalRestoreA(varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn) ; szCheckpointFilePath : CHAR* -> "sptr" ; szLogPath : CHAR* -> "sptr" ; rgrstmap : JET_RSTMAP_A* optional -> "sptr" ; crstfilemap : INT -> "int" ; szBackupLogPath : CHAR* -> "sptr" ; genLow : INT -> "int" ; genHigh : INT -> "int" ; pfn : JET_PFNSTATUS -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT JetExternalRestoreA(CHAR* szCheckpointFilePath, CHAR* szLogPath, JET_RSTMAP_A* rgrstmap, INT crstfilemap, CHAR* szBackupLogPath, INT genLow, INT genHigh, JET_PFNSTATUS pfn) #uselib "ESENT.dll" #cfunc global JetExternalRestoreA "JetExternalRestoreA" var, var, var, int, var, int, int, intptr ; res = JetExternalRestoreA(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn) ; szCheckpointFilePath : CHAR* -> "var" ; szLogPath : CHAR* -> "var" ; rgrstmap : JET_RSTMAP_A* optional -> "var" ; crstfilemap : INT -> "int" ; szBackupLogPath : CHAR* -> "var" ; genLow : INT -> "int" ; genHigh : INT -> "int" ; pfn : JET_PFNSTATUS -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT JetExternalRestoreA(CHAR* szCheckpointFilePath, CHAR* szLogPath, JET_RSTMAP_A* rgrstmap, INT crstfilemap, CHAR* szBackupLogPath, INT genLow, INT genHigh, JET_PFNSTATUS pfn) #uselib "ESENT.dll" #cfunc global JetExternalRestoreA "JetExternalRestoreA" intptr, intptr, intptr, int, intptr, int, int, intptr ; res = JetExternalRestoreA(varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn) ; szCheckpointFilePath : CHAR* -> "intptr" ; szLogPath : CHAR* -> "intptr" ; rgrstmap : JET_RSTMAP_A* optional -> "intptr" ; crstfilemap : INT -> "int" ; szBackupLogPath : CHAR* -> "intptr" ; genLow : INT -> "int" ; genHigh : INT -> "int" ; pfn : JET_PFNSTATUS -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
esent = windows.NewLazySystemDLL("ESENT.dll")
procJetExternalRestoreA = esent.NewProc("JetExternalRestoreA")
)
// szCheckpointFilePath (CHAR*), szLogPath (CHAR*), rgrstmap (JET_RSTMAP_A* optional), crstfilemap (INT), szBackupLogPath (CHAR*), genLow (INT), genHigh (INT), pfn (JET_PFNSTATUS)
r1, _, err := procJetExternalRestoreA.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 // INTfunction JetExternalRestoreA(
szCheckpointFilePath: Pointer; // CHAR*
szLogPath: Pointer; // CHAR*
rgrstmap: Pointer; // JET_RSTMAP_A* optional
crstfilemap: Integer; // INT
szBackupLogPath: Pointer; // CHAR*
genLow: Integer; // INT
genHigh: Integer; // INT
pfn: Pointer // JET_PFNSTATUS
): Integer; stdcall;
external 'ESENT.dll' name 'JetExternalRestoreA';result := DllCall("ESENT\JetExternalRestoreA"
, "Ptr", szCheckpointFilePath ; CHAR*
, "Ptr", szLogPath ; CHAR*
, "Ptr", rgrstmap ; JET_RSTMAP_A* optional
, "Int", crstfilemap ; INT
, "Ptr", szBackupLogPath ; CHAR*
, "Int", genLow ; INT
, "Int", genHigh ; INT
, "Ptr", pfn ; JET_PFNSTATUS
, "Int") ; return: INT●JetExternalRestoreA(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn) = DLL("ESENT.dll", "int JetExternalRestoreA(void*, void*, void*, int, void*, int, int, void*)")
# 呼び出し: JetExternalRestoreA(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
# szCheckpointFilePath : CHAR* -> "void*"
# szLogPath : CHAR* -> "void*"
# rgrstmap : JET_RSTMAP_A* optional -> "void*"
# crstfilemap : INT -> "int"
# szBackupLogPath : CHAR* -> "void*"
# genLow : INT -> "int"
# genHigh : INT -> "int"
# pfn : JET_PFNSTATUS -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。