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