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

JetGetBookmark

関数
現在のレコードを一意に示すブックマークを取得する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetGetBookmark(
    JET_SESID sesid,
    JET_TABLEID tableid,
    void* pvBookmark,   // optional
    DWORD cbMax,
    DWORD* pcbActual   // optional
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
pvBookmarkvoid*outoptional
cbMaxDWORDin
pcbActualDWORD*outoptional

戻り値の型: INT

各言語での呼び出し定義

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

INT JetGetBookmark(
    JET_SESID sesid,
    JET_TABLEID tableid,
    void* pvBookmark,   // optional
    DWORD cbMax,
    DWORD* pcbActual   // optional
);
[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetGetBookmark(
    UIntPtr sesid,   // JET_SESID
    UIntPtr tableid,   // JET_TABLEID
    IntPtr pvBookmark,   // void* optional, out
    uint cbMax,   // DWORD
    IntPtr pcbActual   // DWORD* optional, out
);
<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetGetBookmark(
    sesid As UIntPtr,   ' JET_SESID
    tableid As UIntPtr,   ' JET_TABLEID
    pvBookmark As IntPtr,   ' void* optional, out
    cbMax As UInteger,   ' DWORD
    pcbActual As IntPtr   ' DWORD* optional, out
) As Integer
End Function
' sesid : JET_SESID
' tableid : JET_TABLEID
' pvBookmark : void* optional, out
' cbMax : DWORD
' pcbActual : DWORD* optional, out
Declare PtrSafe Function JetGetBookmark Lib "esent" ( _
    ByVal sesid As LongPtr, _
    ByVal tableid As LongPtr, _
    ByVal pvBookmark As LongPtr, _
    ByVal cbMax 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

JetGetBookmark = ctypes.windll.esent.JetGetBookmark
JetGetBookmark.restype = ctypes.c_int
JetGetBookmark.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_size_t,  # tableid : JET_TABLEID
    ctypes.POINTER(None),  # pvBookmark : void* optional, out
    wintypes.DWORD,  # cbMax : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pcbActual : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetGetBookmark = Fiddle::Function.new(
  lib['JetGetBookmark'],
  [
    Fiddle::TYPE_UINTPTR_T,  # sesid : JET_SESID
    Fiddle::TYPE_UINTPTR_T,  # tableid : JET_TABLEID
    Fiddle::TYPE_VOIDP,  # pvBookmark : void* optional, out
    -Fiddle::TYPE_INT,  # cbMax : DWORD
    Fiddle::TYPE_VOIDP,  # pcbActual : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetGetBookmark(
        sesid: usize,  // JET_SESID
        tableid: usize,  // JET_TABLEID
        pvBookmark: *mut (),  // void* optional, out
        cbMax: 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 JetGetBookmark(UIntPtr sesid, UIntPtr tableid, IntPtr pvBookmark, uint cbMax, IntPtr pcbActual);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetGetBookmark' -Namespace Win32 -PassThru
# $api::JetGetBookmark(sesid, tableid, pvBookmark, cbMax, pcbActual)
#uselib "ESENT.dll"
#func global JetGetBookmark "JetGetBookmark" sptr, sptr, sptr, sptr, sptr
; JetGetBookmark sesid, tableid, pvBookmark, cbMax, varptr(pcbActual)   ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; pvBookmark : void* optional, out -> "sptr"
; cbMax : DWORD -> "sptr"
; pcbActual : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ESENT.dll"
#cfunc global JetGetBookmark "JetGetBookmark" sptr, sptr, sptr, int, var
; res = JetGetBookmark(sesid, tableid, pvBookmark, cbMax, pcbActual)
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; pvBookmark : void* optional, out -> "sptr"
; cbMax : DWORD -> "int"
; pcbActual : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT JetGetBookmark(JET_SESID sesid, JET_TABLEID tableid, void* pvBookmark, DWORD cbMax, DWORD* pcbActual)
#uselib "ESENT.dll"
#cfunc global JetGetBookmark "JetGetBookmark" intptr, intptr, intptr, int, var
; res = JetGetBookmark(sesid, tableid, pvBookmark, cbMax, pcbActual)
; sesid : JET_SESID -> "intptr"
; tableid : JET_TABLEID -> "intptr"
; pvBookmark : void* optional, out -> "intptr"
; cbMax : DWORD -> "int"
; pcbActual : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGetBookmark = esent.NewProc("JetGetBookmark")
)

// sesid (JET_SESID), tableid (JET_TABLEID), pvBookmark (void* optional, out), cbMax (DWORD), pcbActual (DWORD* optional, out)
r1, _, err := procJetGetBookmark.Call(
	uintptr(sesid),
	uintptr(tableid),
	uintptr(pvBookmark),
	uintptr(cbMax),
	uintptr(pcbActual),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function JetGetBookmark(
  sesid: NativeUInt;   // JET_SESID
  tableid: NativeUInt;   // JET_TABLEID
  pvBookmark: Pointer;   // void* optional, out
  cbMax: DWORD;   // DWORD
  pcbActual: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'ESENT.dll' name 'JetGetBookmark';
result := DllCall("ESENT\JetGetBookmark"
    , "UPtr", sesid   ; JET_SESID
    , "UPtr", tableid   ; JET_TABLEID
    , "Ptr", pvBookmark   ; void* optional, out
    , "UInt", cbMax   ; DWORD
    , "Ptr", pcbActual   ; DWORD* optional, out
    , "Int")   ; return: INT
●JetGetBookmark(sesid, tableid, pvBookmark, cbMax, pcbActual) = DLL("ESENT.dll", "int JetGetBookmark(int, int, void*, dword, void*)")
# 呼び出し: JetGetBookmark(sesid, tableid, pvBookmark, cbMax, pcbActual)
# sesid : JET_SESID -> "int"
# tableid : JET_TABLEID -> "int"
# pvBookmark : void* optional, out -> "void*"
# cbMax : DWORD -> "dword"
# pcbActual : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。