ホーム › Storage.Jet › JetEscrowUpdate
JetEscrowUpdate
関数列の値をエスクロー方式で原子的に増減更新する。
シグネチャ
// ESENT.dll
#include <windows.h>
INT JetEscrowUpdate(
JET_SESID sesid,
JET_TABLEID tableid,
DWORD columnid,
void* pv,
DWORD cbMax,
void* pvOld, // optional
DWORD cbOldMax,
DWORD* pcbOldActual, // optional
DWORD grbit
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| sesid | JET_SESID | in | エスクロー更新を行うセッションのJET_SESIDハンドル。 |
| tableid | JET_TABLEID | in | 対象レコードを持つテーブルのカーソルハンドル。 |
| columnid | DWORD | in | エスクロー更新対象の列を識別する列ID。JET_bitColumnEscrowUpdate属性が必要である。 |
| pv | void* | in | 現在値に加算する差分値を格納したバッファポインタ。 |
| cbMax | DWORD | in | pvバッファのサイズをバイト単位で指定する値。 |
| pvOld | void* | outoptional | 更新前の列値を受け取る出力バッファポインタ。NULL可。 |
| cbOldMax | DWORD | in | pvOldバッファのサイズをバイト単位で指定する値。 |
| pcbOldActual | DWORD* | outoptional | pvOldに書き込まれた実バイト数を受け取る出力ポインタ。NULL可。 |
| grbit | DWORD | in | エスクロー更新動作を制御するビットフラグ。通常は0を指定する。 |
戻り値の型: INT
各言語での呼び出し定義
// ESENT.dll
#include <windows.h>
INT JetEscrowUpdate(
JET_SESID sesid,
JET_TABLEID tableid,
DWORD columnid,
void* pv,
DWORD cbMax,
void* pvOld, // optional
DWORD cbOldMax,
DWORD* pcbOldActual, // optional
DWORD grbit
);[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetEscrowUpdate(
UIntPtr sesid, // JET_SESID
UIntPtr tableid, // JET_TABLEID
uint columnid, // DWORD
IntPtr pv, // void*
uint cbMax, // DWORD
IntPtr pvOld, // void* optional, out
uint cbOldMax, // DWORD
IntPtr pcbOldActual, // DWORD* optional, out
uint grbit // DWORD
);<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetEscrowUpdate(
sesid As UIntPtr, ' JET_SESID
tableid As UIntPtr, ' JET_TABLEID
columnid As UInteger, ' DWORD
pv As IntPtr, ' void*
cbMax As UInteger, ' DWORD
pvOld As IntPtr, ' void* optional, out
cbOldMax As UInteger, ' DWORD
pcbOldActual As IntPtr, ' DWORD* optional, out
grbit As UInteger ' DWORD
) As Integer
End Function' sesid : JET_SESID
' tableid : JET_TABLEID
' columnid : DWORD
' pv : void*
' cbMax : DWORD
' pvOld : void* optional, out
' cbOldMax : DWORD
' pcbOldActual : DWORD* optional, out
' grbit : DWORD
Declare PtrSafe Function JetEscrowUpdate Lib "esent" ( _
ByVal sesid As LongPtr, _
ByVal tableid As LongPtr, _
ByVal columnid As Long, _
ByVal pv As LongPtr, _
ByVal cbMax As Long, _
ByVal pvOld As LongPtr, _
ByVal cbOldMax As Long, _
ByVal pcbOldActual As LongPtr, _
ByVal grbit As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JetEscrowUpdate = ctypes.windll.esent.JetEscrowUpdate
JetEscrowUpdate.restype = ctypes.c_int
JetEscrowUpdate.argtypes = [
ctypes.c_size_t, # sesid : JET_SESID
ctypes.c_size_t, # tableid : JET_TABLEID
wintypes.DWORD, # columnid : DWORD
ctypes.POINTER(None), # pv : void*
wintypes.DWORD, # cbMax : DWORD
ctypes.POINTER(None), # pvOld : void* optional, out
wintypes.DWORD, # cbOldMax : DWORD
ctypes.POINTER(wintypes.DWORD), # pcbOldActual : DWORD* optional, out
wintypes.DWORD, # grbit : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ESENT.dll')
JetEscrowUpdate = Fiddle::Function.new(
lib['JetEscrowUpdate'],
[
Fiddle::TYPE_UINTPTR_T, # sesid : JET_SESID
Fiddle::TYPE_UINTPTR_T, # tableid : JET_TABLEID
-Fiddle::TYPE_INT, # columnid : DWORD
Fiddle::TYPE_VOIDP, # pv : void*
-Fiddle::TYPE_INT, # cbMax : DWORD
Fiddle::TYPE_VOIDP, # pvOld : void* optional, out
-Fiddle::TYPE_INT, # cbOldMax : DWORD
Fiddle::TYPE_VOIDP, # pcbOldActual : DWORD* optional, out
-Fiddle::TYPE_INT, # grbit : DWORD
],
Fiddle::TYPE_INT)#[link(name = "esent")]
extern "system" {
fn JetEscrowUpdate(
sesid: usize, // JET_SESID
tableid: usize, // JET_TABLEID
columnid: u32, // DWORD
pv: *mut (), // void*
cbMax: u32, // DWORD
pvOld: *mut (), // void* optional, out
cbOldMax: u32, // DWORD
pcbOldActual: *mut u32, // DWORD* optional, out
grbit: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetEscrowUpdate(UIntPtr sesid, UIntPtr tableid, uint columnid, IntPtr pv, uint cbMax, IntPtr pvOld, uint cbOldMax, IntPtr pcbOldActual, uint grbit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetEscrowUpdate' -Namespace Win32 -PassThru
# $api::JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)#uselib "ESENT.dll"
#func global JetEscrowUpdate "JetEscrowUpdate" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; JetEscrowUpdate sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, varptr(pcbOldActual), grbit ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; columnid : DWORD -> "sptr"
; pv : void* -> "sptr"
; cbMax : DWORD -> "sptr"
; pvOld : void* optional, out -> "sptr"
; cbOldMax : DWORD -> "sptr"
; pcbOldActual : DWORD* optional, out -> "sptr"
; grbit : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ESENT.dll" #cfunc global JetEscrowUpdate "JetEscrowUpdate" sptr, sptr, int, sptr, int, sptr, int, var, int ; res = JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit) ; sesid : JET_SESID -> "sptr" ; tableid : JET_TABLEID -> "sptr" ; columnid : DWORD -> "int" ; pv : void* -> "sptr" ; cbMax : DWORD -> "int" ; pvOld : void* optional, out -> "sptr" ; cbOldMax : DWORD -> "int" ; pcbOldActual : DWORD* optional, out -> "var" ; grbit : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ESENT.dll" #cfunc global JetEscrowUpdate "JetEscrowUpdate" sptr, sptr, int, sptr, int, sptr, int, sptr, int ; res = JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, varptr(pcbOldActual), grbit) ; sesid : JET_SESID -> "sptr" ; tableid : JET_TABLEID -> "sptr" ; columnid : DWORD -> "int" ; pv : void* -> "sptr" ; cbMax : DWORD -> "int" ; pvOld : void* optional, out -> "sptr" ; cbOldMax : DWORD -> "int" ; pcbOldActual : DWORD* optional, out -> "sptr" ; grbit : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT JetEscrowUpdate(JET_SESID sesid, JET_TABLEID tableid, DWORD columnid, void* pv, DWORD cbMax, void* pvOld, DWORD cbOldMax, DWORD* pcbOldActual, DWORD grbit) #uselib "ESENT.dll" #cfunc global JetEscrowUpdate "JetEscrowUpdate" intptr, intptr, int, intptr, int, intptr, int, var, int ; res = JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit) ; sesid : JET_SESID -> "intptr" ; tableid : JET_TABLEID -> "intptr" ; columnid : DWORD -> "int" ; pv : void* -> "intptr" ; cbMax : DWORD -> "int" ; pvOld : void* optional, out -> "intptr" ; cbOldMax : DWORD -> "int" ; pcbOldActual : DWORD* optional, out -> "var" ; grbit : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT JetEscrowUpdate(JET_SESID sesid, JET_TABLEID tableid, DWORD columnid, void* pv, DWORD cbMax, void* pvOld, DWORD cbOldMax, DWORD* pcbOldActual, DWORD grbit) #uselib "ESENT.dll" #cfunc global JetEscrowUpdate "JetEscrowUpdate" intptr, intptr, int, intptr, int, intptr, int, intptr, int ; res = JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, varptr(pcbOldActual), grbit) ; sesid : JET_SESID -> "intptr" ; tableid : JET_TABLEID -> "intptr" ; columnid : DWORD -> "int" ; pv : void* -> "intptr" ; cbMax : DWORD -> "int" ; pvOld : void* optional, out -> "intptr" ; cbOldMax : DWORD -> "int" ; pcbOldActual : DWORD* optional, out -> "intptr" ; grbit : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
esent = windows.NewLazySystemDLL("ESENT.dll")
procJetEscrowUpdate = esent.NewProc("JetEscrowUpdate")
)
// sesid (JET_SESID), tableid (JET_TABLEID), columnid (DWORD), pv (void*), cbMax (DWORD), pvOld (void* optional, out), cbOldMax (DWORD), pcbOldActual (DWORD* optional, out), grbit (DWORD)
r1, _, err := procJetEscrowUpdate.Call(
uintptr(sesid),
uintptr(tableid),
uintptr(columnid),
uintptr(pv),
uintptr(cbMax),
uintptr(pvOld),
uintptr(cbOldMax),
uintptr(pcbOldActual),
uintptr(grbit),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction JetEscrowUpdate(
sesid: NativeUInt; // JET_SESID
tableid: NativeUInt; // JET_TABLEID
columnid: DWORD; // DWORD
pv: Pointer; // void*
cbMax: DWORD; // DWORD
pvOld: Pointer; // void* optional, out
cbOldMax: DWORD; // DWORD
pcbOldActual: Pointer; // DWORD* optional, out
grbit: DWORD // DWORD
): Integer; stdcall;
external 'ESENT.dll' name 'JetEscrowUpdate';result := DllCall("ESENT\JetEscrowUpdate"
, "UPtr", sesid ; JET_SESID
, "UPtr", tableid ; JET_TABLEID
, "UInt", columnid ; DWORD
, "Ptr", pv ; void*
, "UInt", cbMax ; DWORD
, "Ptr", pvOld ; void* optional, out
, "UInt", cbOldMax ; DWORD
, "Ptr", pcbOldActual ; DWORD* optional, out
, "UInt", grbit ; DWORD
, "Int") ; return: INT●JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit) = DLL("ESENT.dll", "int JetEscrowUpdate(int, int, dword, void*, dword, void*, dword, void*, dword)")
# 呼び出し: JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)
# sesid : JET_SESID -> "int"
# tableid : JET_TABLEID -> "int"
# columnid : DWORD -> "dword"
# pv : void* -> "void*"
# cbMax : DWORD -> "dword"
# pvOld : void* optional, out -> "void*"
# cbOldMax : DWORD -> "dword"
# pcbOldActual : DWORD* optional, out -> "void*"
# grbit : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "esent" fn JetEscrowUpdate(
sesid: usize, // JET_SESID
tableid: usize, // JET_TABLEID
columnid: u32, // DWORD
pv: ?*anyopaque, // void*
cbMax: u32, // DWORD
pvOld: ?*anyopaque, // void* optional, out
cbOldMax: u32, // DWORD
pcbOldActual: [*c]u32, // DWORD* optional, out
grbit: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc JetEscrowUpdate(
sesid: uint, # JET_SESID
tableid: uint, # JET_TABLEID
columnid: uint32, # DWORD
pv: pointer, # void*
cbMax: uint32, # DWORD
pvOld: pointer, # void* optional, out
cbOldMax: uint32, # DWORD
pcbOldActual: ptr uint32, # DWORD* optional, out
grbit: uint32 # DWORD
): int32 {.importc: "JetEscrowUpdate", stdcall, dynlib: "ESENT.dll".}pragma(lib, "esent");
extern(Windows)
int JetEscrowUpdate(
size_t sesid, // JET_SESID
size_t tableid, // JET_TABLEID
uint columnid, // DWORD
void* pv, // void*
uint cbMax, // DWORD
void* pvOld, // void* optional, out
uint cbOldMax, // DWORD
uint* pcbOldActual, // DWORD* optional, out
uint grbit // DWORD
);ccall((:JetEscrowUpdate, "ESENT.dll"), stdcall, Int32,
(Csize_t, Csize_t, UInt32, Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{UInt32}, UInt32),
sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)
# sesid : JET_SESID -> Csize_t
# tableid : JET_TABLEID -> Csize_t
# columnid : DWORD -> UInt32
# pv : void* -> Ptr{Cvoid}
# cbMax : DWORD -> UInt32
# pvOld : void* optional, out -> Ptr{Cvoid}
# cbOldMax : DWORD -> UInt32
# pcbOldActual : DWORD* optional, out -> Ptr{UInt32}
# grbit : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t JetEscrowUpdate(
uintptr_t sesid,
uintptr_t tableid,
uint32_t columnid,
void* pv,
uint32_t cbMax,
void* pvOld,
uint32_t cbOldMax,
uint32_t* pcbOldActual,
uint32_t grbit);
]]
local esent = ffi.load("esent")
-- esent.JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)
-- sesid : JET_SESID
-- tableid : JET_TABLEID
-- columnid : DWORD
-- pv : void*
-- cbMax : DWORD
-- pvOld : void* optional, out
-- cbOldMax : DWORD
-- pcbOldActual : DWORD* optional, out
-- grbit : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ESENT.dll');
const JetEscrowUpdate = lib.func('__stdcall', 'JetEscrowUpdate', 'int32_t', ['uintptr_t', 'uintptr_t', 'uint32_t', 'void *', 'uint32_t', 'void *', 'uint32_t', 'uint32_t *', 'uint32_t']);
// JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)
// sesid : JET_SESID -> 'uintptr_t'
// tableid : JET_TABLEID -> 'uintptr_t'
// columnid : DWORD -> 'uint32_t'
// pv : void* -> 'void *'
// cbMax : DWORD -> 'uint32_t'
// pvOld : void* optional, out -> 'void *'
// cbOldMax : DWORD -> 'uint32_t'
// pcbOldActual : DWORD* optional, out -> 'uint32_t *'
// grbit : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ESENT.dll", {
JetEscrowUpdate: { parameters: ["usize", "usize", "u32", "pointer", "u32", "pointer", "u32", "pointer", "u32"], result: "i32" },
});
// lib.symbols.JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit)
// sesid : JET_SESID -> "usize"
// tableid : JET_TABLEID -> "usize"
// columnid : DWORD -> "u32"
// pv : void* -> "pointer"
// cbMax : DWORD -> "u32"
// pvOld : void* optional, out -> "pointer"
// cbOldMax : DWORD -> "u32"
// pcbOldActual : DWORD* optional, out -> "pointer"
// grbit : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t JetEscrowUpdate(
size_t sesid,
size_t tableid,
uint32_t columnid,
void* pv,
uint32_t cbMax,
void* pvOld,
uint32_t cbOldMax,
uint32_t* pcbOldActual,
uint32_t grbit);
C, "ESENT.dll");
// $ffi->JetEscrowUpdate(sesid, tableid, columnid, pv, cbMax, pvOld, cbOldMax, pcbOldActual, grbit);
// sesid : JET_SESID
// tableid : JET_TABLEID
// columnid : DWORD
// pv : void*
// cbMax : DWORD
// pvOld : void* optional, out
// cbOldMax : DWORD
// pcbOldActual : DWORD* optional, out
// grbit : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Esent extends StdCallLibrary {
Esent INSTANCE = Native.load("esent", Esent.class);
int JetEscrowUpdate(
long sesid, // JET_SESID
long tableid, // JET_TABLEID
int columnid, // DWORD
Pointer pv, // void*
int cbMax, // DWORD
Pointer pvOld, // void* optional, out
int cbOldMax, // DWORD
IntByReference pcbOldActual, // DWORD* optional, out
int grbit // DWORD
);
}@[Link("esent")]
lib LibESENT
fun JetEscrowUpdate = JetEscrowUpdate(
sesid : LibC::SizeT, # JET_SESID
tableid : LibC::SizeT, # JET_TABLEID
columnid : UInt32, # DWORD
pv : Void*, # void*
cbMax : UInt32, # DWORD
pvOld : Void*, # void* optional, out
cbOldMax : UInt32, # DWORD
pcbOldActual : UInt32*, # DWORD* optional, out
grbit : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef JetEscrowUpdateNative = Int32 Function(UintPtr, UintPtr, Uint32, Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Uint32>, Uint32);
typedef JetEscrowUpdateDart = int Function(int, int, int, Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>, int);
final JetEscrowUpdate = DynamicLibrary.open('ESENT.dll')
.lookupFunction<JetEscrowUpdateNative, JetEscrowUpdateDart>('JetEscrowUpdate');
// sesid : JET_SESID -> UintPtr
// tableid : JET_TABLEID -> UintPtr
// columnid : DWORD -> Uint32
// pv : void* -> Pointer<Void>
// cbMax : DWORD -> Uint32
// pvOld : void* optional, out -> Pointer<Void>
// cbOldMax : DWORD -> Uint32
// pcbOldActual : DWORD* optional, out -> Pointer<Uint32>
// grbit : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function JetEscrowUpdate(
sesid: NativeUInt; // JET_SESID
tableid: NativeUInt; // JET_TABLEID
columnid: DWORD; // DWORD
pv: Pointer; // void*
cbMax: DWORD; // DWORD
pvOld: Pointer; // void* optional, out
cbOldMax: DWORD; // DWORD
pcbOldActual: Pointer; // DWORD* optional, out
grbit: DWORD // DWORD
): Integer; stdcall;
external 'ESENT.dll' name 'JetEscrowUpdate';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "JetEscrowUpdate"
c_JetEscrowUpdate :: CUIntPtr -> CUIntPtr -> Word32 -> Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr Word32 -> Word32 -> IO Int32
-- sesid : JET_SESID -> CUIntPtr
-- tableid : JET_TABLEID -> CUIntPtr
-- columnid : DWORD -> Word32
-- pv : void* -> Ptr ()
-- cbMax : DWORD -> Word32
-- pvOld : void* optional, out -> Ptr ()
-- cbOldMax : DWORD -> Word32
-- pcbOldActual : DWORD* optional, out -> Ptr Word32
-- grbit : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let jetescrowupdate =
foreign "JetEscrowUpdate"
(size_t @-> size_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> uint32_t @-> returning int32_t)
(* sesid : JET_SESID -> size_t *)
(* tableid : JET_TABLEID -> size_t *)
(* columnid : DWORD -> uint32_t *)
(* pv : void* -> (ptr void) *)
(* cbMax : DWORD -> uint32_t *)
(* pvOld : void* optional, out -> (ptr void) *)
(* cbOldMax : DWORD -> uint32_t *)
(* pcbOldActual : DWORD* optional, out -> (ptr uint32_t) *)
(* grbit : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library esent (t "ESENT.dll"))
(cffi:use-foreign-library esent)
(cffi:defcfun ("JetEscrowUpdate" jet-escrow-update :convention :stdcall) :int32
(sesid :uint64) ; JET_SESID
(tableid :uint64) ; JET_TABLEID
(columnid :uint32) ; DWORD
(pv :pointer) ; void*
(cb-max :uint32) ; DWORD
(pv-old :pointer) ; void* optional, out
(cb-old-max :uint32) ; DWORD
(pcb-old-actual :pointer) ; DWORD* optional, out
(grbit :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $JetEscrowUpdate = Win32::API::More->new('ESENT',
'int JetEscrowUpdate(WPARAM sesid, WPARAM tableid, DWORD columnid, LPVOID pv, DWORD cbMax, LPVOID pvOld, DWORD cbOldMax, LPVOID pcbOldActual, DWORD grbit)');
# my $ret = $JetEscrowUpdate->Call($sesid, $tableid, $columnid, $pv, $cbMax, $pvOld, $cbOldMax, $pcbOldActual, $grbit);
# sesid : JET_SESID -> WPARAM
# tableid : JET_TABLEID -> WPARAM
# columnid : DWORD -> DWORD
# pv : void* -> LPVOID
# cbMax : DWORD -> DWORD
# pvOld : void* optional, out -> LPVOID
# cbOldMax : DWORD -> DWORD
# pcbOldActual : DWORD* optional, out -> LPVOID
# grbit : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。