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

JetCloseFile

関数
外部バックアップで開いたファイルを閉じる。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetCloseFile(
    JET_HANDLE hfFile
);

パラメーター

名前方向
hfFileJET_HANDLEin

戻り値の型: INT

各言語での呼び出し定義

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

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

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

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetCloseFile = esent.NewProc("JetCloseFile")
)

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