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

JetRestoreW

関数
バックアップからデータベースを復元する(Unicode版)。
DLLESENT.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT JetRestoreW(
    WORD* szSource,
    JET_PFNSTATUS pfn   // optional
);

パラメーター

名前方向
szSourceWORD*in
pfnJET_PFNSTATUSinoptional

戻り値の型: INT

各言語での呼び出し定義

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

INT JetRestoreW(
    WORD* szSource,
    JET_PFNSTATUS pfn   // optional
);
[DllImport("ESENT.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int JetRestoreW(
    ref ushort szSource,   // WORD*
    IntPtr pfn   // JET_PFNSTATUS optional
);
<DllImport("ESENT.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function JetRestoreW(
    ByRef szSource As UShort,   ' WORD*
    pfn As IntPtr   ' JET_PFNSTATUS optional
) As Integer
End Function
' szSource : WORD*
' pfn : JET_PFNSTATUS optional
Declare PtrSafe Function JetRestoreW Lib "esent" ( _
    ByRef szSource As Integer, _
    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

JetRestoreW = ctypes.windll.esent.JetRestoreW
JetRestoreW.restype = ctypes.c_int
JetRestoreW.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # szSource : WORD*
    ctypes.c_void_p,  # pfn : JET_PFNSTATUS optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetRestoreW = Fiddle::Function.new(
  lib['JetRestoreW'],
  [
    Fiddle::TYPE_VOIDP,  # szSource : WORD*
    Fiddle::TYPE_VOIDP,  # pfn : JET_PFNSTATUS optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "esent")]
extern "system" {
    fn JetRestoreW(
        szSource: *mut u16,  // WORD*
        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.Unicode)]
public static extern int JetRestoreW(ref ushort szSource, IntPtr pfn);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetRestoreW' -Namespace Win32 -PassThru
# $api::JetRestoreW(szSource, pfn)
#uselib "ESENT.dll"
#func global JetRestoreW "JetRestoreW" wptr, wptr
; JetRestoreW varptr(szSource), pfn   ; 戻り値は stat
; szSource : WORD* -> "wptr"
; pfn : JET_PFNSTATUS optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ESENT.dll"
#cfunc global JetRestoreW "JetRestoreW" var, sptr
; res = JetRestoreW(szSource, pfn)
; szSource : WORD* -> "var"
; pfn : JET_PFNSTATUS optional -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT JetRestoreW(WORD* szSource, JET_PFNSTATUS pfn)
#uselib "ESENT.dll"
#cfunc global JetRestoreW "JetRestoreW" var, intptr
; res = JetRestoreW(szSource, pfn)
; szSource : WORD* -> "var"
; pfn : JET_PFNSTATUS optional -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetRestoreW = esent.NewProc("JetRestoreW")
)

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