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

JetCloseFileInstance

関数
指定インスタンスのバックアップ用ファイルを閉じる。
DLLESENT.dll呼出規約winapi

シグネチャ

// ESENT.dll
#include <windows.h>

INT JetCloseFileInstance(
    JET_INSTANCE instance,
    JET_HANDLE hfFile
);

パラメーター

名前方向
instanceJET_INSTANCEin
hfFileJET_HANDLEin

戻り値の型: INT

各言語での呼び出し定義

// ESENT.dll
#include <windows.h>

INT JetCloseFileInstance(
    JET_INSTANCE instance,
    JET_HANDLE hfFile
);
[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetCloseFileInstance(
    UIntPtr instance,   // JET_INSTANCE
    UIntPtr hfFile   // JET_HANDLE
);
<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetCloseFileInstance(
    instance As UIntPtr,   ' JET_INSTANCE
    hfFile As UIntPtr   ' JET_HANDLE
) As Integer
End Function
' instance : JET_INSTANCE
' hfFile : JET_HANDLE
Declare PtrSafe Function JetCloseFileInstance Lib "esent" ( _
    ByVal instance As LongPtr, _
    ByVal hfFile As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JetCloseFileInstance = ctypes.windll.esent.JetCloseFileInstance
JetCloseFileInstance.restype = ctypes.c_int
JetCloseFileInstance.argtypes = [
    ctypes.c_size_t,  # instance : JET_INSTANCE
    ctypes.c_size_t,  # hfFile : JET_HANDLE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetCloseFileInstance = Fiddle::Function.new(
  lib['JetCloseFileInstance'],
  [
    Fiddle::TYPE_UINTPTR_T,  # instance : JET_INSTANCE
    Fiddle::TYPE_UINTPTR_T,  # hfFile : JET_HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetCloseFileInstance(
        instance: usize,  // JET_INSTANCE
        hfFile: usize  // JET_HANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetCloseFileInstance(UIntPtr instance, UIntPtr hfFile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetCloseFileInstance' -Namespace Win32 -PassThru
# $api::JetCloseFileInstance(instance, hfFile)
#uselib "ESENT.dll"
#func global JetCloseFileInstance "JetCloseFileInstance" sptr, sptr
; JetCloseFileInstance instance, hfFile   ; 戻り値は stat
; instance : JET_INSTANCE -> "sptr"
; hfFile : JET_HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ESENT.dll"
#cfunc global JetCloseFileInstance "JetCloseFileInstance" sptr, sptr
; res = JetCloseFileInstance(instance, hfFile)
; instance : JET_INSTANCE -> "sptr"
; hfFile : JET_HANDLE -> "sptr"
; INT JetCloseFileInstance(JET_INSTANCE instance, JET_HANDLE hfFile)
#uselib "ESENT.dll"
#cfunc global JetCloseFileInstance "JetCloseFileInstance" intptr, intptr
; res = JetCloseFileInstance(instance, hfFile)
; instance : JET_INSTANCE -> "intptr"
; hfFile : JET_HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetCloseFileInstance = esent.NewProc("JetCloseFileInstance")
)

// instance (JET_INSTANCE), hfFile (JET_HANDLE)
r1, _, err := procJetCloseFileInstance.Call(
	uintptr(instance),
	uintptr(hfFile),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function JetCloseFileInstance(
  instance: NativeUInt;   // JET_INSTANCE
  hfFile: NativeUInt   // JET_HANDLE
): Integer; stdcall;
  external 'ESENT.dll' name 'JetCloseFileInstance';
result := DllCall("ESENT\JetCloseFileInstance"
    , "UPtr", instance   ; JET_INSTANCE
    , "UPtr", hfFile   ; JET_HANDLE
    , "Int")   ; return: INT
●JetCloseFileInstance(instance, hfFile) = DLL("ESENT.dll", "int JetCloseFileInstance(int, int)")
# 呼び出し: JetCloseFileInstance(instance, hfFile)
# instance : JET_INSTANCE -> "int"
# hfFile : JET_HANDLE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。