ホーム › Storage.Jet › JetExternalRestoreW
JetExternalRestoreW
関数ログ世代を指定して外部バックアップから復元する(Unicode版)。
シグネチャ
// 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
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| szCheckpointFilePath | WORD* | in | 復元時に使用するチェックポイントファイルのパスを指す終端付きUnicode文字列ポインタ。 |
| szLogPath | WORD* | in | 復元に使用するログファイルが格納されたディレクトリのパスを指す終端付きUnicode文字列ポインタ。 |
| rgrstmap | JET_RSTMAP_W* | inoptional | バックアップ元と復元先のデータベースパス対応を保持するJET_RSTMAP_W配列のポインタ。 |
| crstfilemap | INT | in | rgrstmap配列の要素数を指定する値。 |
| szBackupLogPath | WORD* | in | バックアップ時のログが格納されたディレクトリのパスを指す終端付きUnicode文字列ポインタ。 |
| genLow | INT | in | 復元に適用するログ世代の下限番号を指定する値。 |
| genHigh | INT | in | 復元に適用するログ世代の上限番号を指定する値。 |
| pfn | JET_PFNSTATUS | in | 進捗通知を受け取るステータスコールバック関数(JET_PFNSTATUS)。NULL可。 |
戻り値の型: 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 方式にも切替可。#uselib "ESENT.dll" #cfunc global JetExternalRestoreW "JetExternalRestoreW" sptr, sptr, sptr, int, sptr, int, int, sptr ; res = JetExternalRestoreW(varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn) ; szCheckpointFilePath : WORD* -> "sptr" ; szLogPath : WORD* -> "sptr" ; rgrstmap : JET_RSTMAP_W* optional -> "sptr" ; crstfilemap : INT -> "int" ; szBackupLogPath : WORD* -> "sptr" ; genLow : INT -> "int" ; genHigh : INT -> "int" ; pfn : JET_PFNSTATUS -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; 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" intptr, intptr, intptr, int, intptr, int, int, intptr ; res = JetExternalRestoreW(varptr(szCheckpointFilePath), varptr(szLogPath), varptr(rgrstmap), crstfilemap, varptr(szBackupLogPath), genLow, genHigh, pfn) ; szCheckpointFilePath : WORD* -> "intptr" ; szLogPath : WORD* -> "intptr" ; rgrstmap : JET_RSTMAP_W* optional -> "intptr" ; crstfilemap : INT -> "int" ; szBackupLogPath : WORD* -> "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")
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 // INTfunction 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 版の利用を推奨。const std = @import("std");
extern "esent" fn JetExternalRestoreW(
szCheckpointFilePath: [*c]u16, // WORD*
szLogPath: [*c]u16, // WORD*
rgrstmap: [*c]JET_RSTMAP_W, // JET_RSTMAP_W* optional
crstfilemap: i32, // INT
szBackupLogPath: [*c]u16, // WORD*
genLow: i32, // INT
genHigh: i32, // INT
pfn: ?*anyopaque // JET_PFNSTATUS
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc JetExternalRestoreW(
szCheckpointFilePath: ptr uint16, # WORD*
szLogPath: ptr uint16, # WORD*
rgrstmap: ptr JET_RSTMAP_W, # JET_RSTMAP_W* optional
crstfilemap: int32, # INT
szBackupLogPath: ptr uint16, # WORD*
genLow: int32, # INT
genHigh: int32, # INT
pfn: pointer # JET_PFNSTATUS
): int32 {.importc: "JetExternalRestoreW", stdcall, dynlib: "ESENT.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "esent");
extern(Windows)
int JetExternalRestoreW(
ushort* szCheckpointFilePath, // WORD*
ushort* szLogPath, // WORD*
JET_RSTMAP_W* rgrstmap, // JET_RSTMAP_W* optional
int crstfilemap, // INT
ushort* szBackupLogPath, // WORD*
int genLow, // INT
int genHigh, // INT
void* pfn // JET_PFNSTATUS
);ccall((:JetExternalRestoreW, "ESENT.dll"), stdcall, Int32,
(Ptr{UInt16}, Ptr{UInt16}, Ptr{JET_RSTMAP_W}, Int32, Ptr{UInt16}, Int32, Int32, Ptr{Cvoid}),
szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
# szCheckpointFilePath : WORD* -> Ptr{UInt16}
# szLogPath : WORD* -> Ptr{UInt16}
# rgrstmap : JET_RSTMAP_W* optional -> Ptr{JET_RSTMAP_W}
# crstfilemap : INT -> Int32
# szBackupLogPath : WORD* -> Ptr{UInt16}
# genLow : INT -> Int32
# genHigh : INT -> Int32
# pfn : JET_PFNSTATUS -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t JetExternalRestoreW(
uint16_t* szCheckpointFilePath,
uint16_t* szLogPath,
void* rgrstmap,
int32_t crstfilemap,
uint16_t* szBackupLogPath,
int32_t genLow,
int32_t genHigh,
void* pfn);
]]
local esent = ffi.load("esent")
-- esent.JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
-- szCheckpointFilePath : WORD*
-- szLogPath : WORD*
-- rgrstmap : JET_RSTMAP_W* optional
-- crstfilemap : INT
-- szBackupLogPath : WORD*
-- genLow : INT
-- genHigh : INT
-- pfn : JET_PFNSTATUS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('ESENT.dll');
const JetExternalRestoreW = lib.func('__stdcall', 'JetExternalRestoreW', 'int32_t', ['uint16_t *', 'uint16_t *', 'void *', 'int32_t', 'uint16_t *', 'int32_t', 'int32_t', 'void *']);
// JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
// szCheckpointFilePath : WORD* -> 'uint16_t *'
// szLogPath : WORD* -> 'uint16_t *'
// rgrstmap : JET_RSTMAP_W* optional -> 'void *'
// crstfilemap : INT -> 'int32_t'
// szBackupLogPath : WORD* -> 'uint16_t *'
// genLow : INT -> 'int32_t'
// genHigh : INT -> 'int32_t'
// pfn : JET_PFNSTATUS -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("ESENT.dll", {
JetExternalRestoreW: { parameters: ["pointer", "pointer", "pointer", "i32", "pointer", "i32", "i32", "pointer"], result: "i32" },
});
// lib.symbols.JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn)
// szCheckpointFilePath : WORD* -> "pointer"
// szLogPath : WORD* -> "pointer"
// rgrstmap : JET_RSTMAP_W* optional -> "pointer"
// crstfilemap : INT -> "i32"
// szBackupLogPath : WORD* -> "pointer"
// genLow : INT -> "i32"
// genHigh : INT -> "i32"
// pfn : JET_PFNSTATUS -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t JetExternalRestoreW(
uint16_t* szCheckpointFilePath,
uint16_t* szLogPath,
void* rgrstmap,
int32_t crstfilemap,
uint16_t* szBackupLogPath,
int32_t genLow,
int32_t genHigh,
void* pfn);
C, "ESENT.dll");
// $ffi->JetExternalRestoreW(szCheckpointFilePath, szLogPath, rgrstmap, crstfilemap, szBackupLogPath, genLow, genHigh, pfn);
// szCheckpointFilePath : WORD*
// szLogPath : WORD*
// rgrstmap : JET_RSTMAP_W* optional
// crstfilemap : INT
// szBackupLogPath : WORD*
// genLow : INT
// genHigh : INT
// pfn : JET_PFNSTATUS
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Esent extends StdCallLibrary {
Esent INSTANCE = Native.load("esent", Esent.class, W32APIOptions.UNICODE_OPTIONS);
int JetExternalRestoreW(
ShortByReference szCheckpointFilePath, // WORD*
ShortByReference szLogPath, // WORD*
Pointer rgrstmap, // JET_RSTMAP_W* optional
int crstfilemap, // INT
ShortByReference szBackupLogPath, // WORD*
int genLow, // INT
int genHigh, // INT
Callback pfn // JET_PFNSTATUS
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("esent")]
lib LibESENT
fun JetExternalRestoreW = JetExternalRestoreW(
szCheckpointFilePath : UInt16*, # WORD*
szLogPath : UInt16*, # WORD*
rgrstmap : JET_RSTMAP_W*, # JET_RSTMAP_W* optional
crstfilemap : Int32, # INT
szBackupLogPath : UInt16*, # WORD*
genLow : Int32, # INT
genHigh : Int32, # INT
pfn : Void* # JET_PFNSTATUS
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef JetExternalRestoreWNative = Int32 Function(Pointer<Uint16>, Pointer<Uint16>, Pointer<Void>, Int32, Pointer<Uint16>, Int32, Int32, Pointer<Void>);
typedef JetExternalRestoreWDart = int Function(Pointer<Uint16>, Pointer<Uint16>, Pointer<Void>, int, Pointer<Uint16>, int, int, Pointer<Void>);
final JetExternalRestoreW = DynamicLibrary.open('ESENT.dll')
.lookupFunction<JetExternalRestoreWNative, JetExternalRestoreWDart>('JetExternalRestoreW');
// szCheckpointFilePath : WORD* -> Pointer<Uint16>
// szLogPath : WORD* -> Pointer<Uint16>
// rgrstmap : JET_RSTMAP_W* optional -> Pointer<Void>
// crstfilemap : INT -> Int32
// szBackupLogPath : WORD* -> Pointer<Uint16>
// genLow : INT -> Int32
// genHigh : INT -> Int32
// pfn : JET_PFNSTATUS -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "JetExternalRestoreW"
c_JetExternalRestoreW :: Ptr Word16 -> Ptr Word16 -> Ptr () -> Int32 -> Ptr Word16 -> Int32 -> Int32 -> Ptr () -> IO Int32
-- szCheckpointFilePath : WORD* -> Ptr Word16
-- szLogPath : WORD* -> Ptr Word16
-- rgrstmap : JET_RSTMAP_W* optional -> Ptr ()
-- crstfilemap : INT -> Int32
-- szBackupLogPath : WORD* -> Ptr Word16
-- genLow : INT -> Int32
-- genHigh : INT -> Int32
-- pfn : JET_PFNSTATUS -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let jetexternalrestorew =
foreign "JetExternalRestoreW"
((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> (ptr void) @-> returning int32_t)
(* szCheckpointFilePath : WORD* -> (ptr uint16_t) *)
(* szLogPath : WORD* -> (ptr uint16_t) *)
(* rgrstmap : JET_RSTMAP_W* optional -> (ptr void) *)
(* crstfilemap : INT -> int32_t *)
(* szBackupLogPath : WORD* -> (ptr uint16_t) *)
(* genLow : INT -> int32_t *)
(* genHigh : INT -> int32_t *)
(* pfn : JET_PFNSTATUS -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library esent (t "ESENT.dll"))
(cffi:use-foreign-library esent)
(cffi:defcfun ("JetExternalRestoreW" jet-external-restore-w :convention :stdcall) :int32
(sz-checkpoint-file-path :pointer) ; WORD*
(sz-log-path :pointer) ; WORD*
(rgrstmap :pointer) ; JET_RSTMAP_W* optional
(crstfilemap :int32) ; INT
(sz-backup-log-path :pointer) ; WORD*
(gen-low :int32) ; INT
(gen-high :int32) ; INT
(pfn :pointer)) ; JET_PFNSTATUS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $JetExternalRestoreW = Win32::API::More->new('ESENT',
'int JetExternalRestoreW(LPVOID szCheckpointFilePath, LPVOID szLogPath, LPVOID rgrstmap, int crstfilemap, LPVOID szBackupLogPath, int genLow, int genHigh, LPVOID pfn)');
# my $ret = $JetExternalRestoreW->Call($szCheckpointFilePath, $szLogPath, $rgrstmap, $crstfilemap, $szBackupLogPath, $genLow, $genHigh, $pfn);
# szCheckpointFilePath : WORD* -> LPVOID
# szLogPath : WORD* -> LPVOID
# rgrstmap : JET_RSTMAP_W* optional -> LPVOID
# crstfilemap : INT -> int
# szBackupLogPath : WORD* -> LPVOID
# genLow : INT -> int
# genHigh : INT -> int
# pfn : JET_PFNSTATUS -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f JetExternalRestoreA (ANSI版) — ログ世代を指定して外部バックアップから復元する(ANSI版)。
類似 API
- f JetExternalRestore2W — 対象インスタンス指定で外部バックアップから復元する(Unicode版)。