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