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

JetGetRecordSize

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

シグネチャ

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

INT JetGetRecordSize(
    JET_SESID sesid,
    JET_TABLEID tableid,
    JET_RECSIZE* precsize,
    DWORD grbit
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
precsizeJET_RECSIZE*inout
grbitDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

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

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGetRecordSize = esent.NewProc("JetGetRecordSize")
)

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