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

JetGetRecordSize2

関数
拡張構造体で現在のレコードのサイズ情報を取得する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetGetRecordSize2(
    JET_SESID sesid,
    JET_TABLEID tableid,
    JET_RECSIZE2* precsize,
    DWORD grbit
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
precsizeJET_RECSIZE2*inout
grbitDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

JetGetRecordSize2 = ctypes.windll.esent.JetGetRecordSize2
JetGetRecordSize2.restype = ctypes.c_int
JetGetRecordSize2.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_size_t,  # tableid : JET_TABLEID
    ctypes.c_void_p,  # precsize : JET_RECSIZE2* in/out
    wintypes.DWORD,  # grbit : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetGetRecordSize2 = Fiddle::Function.new(
  lib['JetGetRecordSize2'],
  [
    Fiddle::TYPE_UINTPTR_T,  # sesid : JET_SESID
    Fiddle::TYPE_UINTPTR_T,  # tableid : JET_TABLEID
    Fiddle::TYPE_VOIDP,  # precsize : JET_RECSIZE2* in/out
    -Fiddle::TYPE_INT,  # grbit : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetGetRecordSize2(
        sesid: usize,  // JET_SESID
        tableid: usize,  // JET_TABLEID
        precsize: *mut JET_RECSIZE2,  // JET_RECSIZE2* in/out
        grbit: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetGetRecordSize2(UIntPtr sesid, UIntPtr tableid, IntPtr precsize, uint grbit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetGetRecordSize2' -Namespace Win32 -PassThru
# $api::JetGetRecordSize2(sesid, tableid, precsize, grbit)
#uselib "ESENT.dll"
#func global JetGetRecordSize2 "JetGetRecordSize2" sptr, sptr, sptr, sptr
; JetGetRecordSize2 sesid, tableid, varptr(precsize), grbit   ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; precsize : JET_RECSIZE2* in/out -> "sptr"
; grbit : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ESENT.dll"
#cfunc global JetGetRecordSize2 "JetGetRecordSize2" sptr, sptr, var, int
; res = JetGetRecordSize2(sesid, tableid, precsize, grbit)
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; precsize : JET_RECSIZE2* in/out -> "var"
; grbit : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT JetGetRecordSize2(JET_SESID sesid, JET_TABLEID tableid, JET_RECSIZE2* precsize, DWORD grbit)
#uselib "ESENT.dll"
#cfunc global JetGetRecordSize2 "JetGetRecordSize2" intptr, intptr, var, int
; res = JetGetRecordSize2(sesid, tableid, precsize, grbit)
; sesid : JET_SESID -> "intptr"
; tableid : JET_TABLEID -> "intptr"
; precsize : JET_RECSIZE2* in/out -> "var"
; grbit : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGetRecordSize2 = esent.NewProc("JetGetRecordSize2")
)

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