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

JetGrowDatabase

関数
データベースを指定したページ数まで拡張する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetGrowDatabase(
    JET_SESID sesid,
    DWORD dbid,
    DWORD cpg,
    DWORD* pcpgReal
);

パラメーター

名前方向
sesidJET_SESIDin
dbidDWORDin
cpgDWORDin
pcpgRealDWORD*in

戻り値の型: INT

各言語での呼び出し定義

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

INT JetGrowDatabase(
    JET_SESID sesid,
    DWORD dbid,
    DWORD cpg,
    DWORD* pcpgReal
);
[DllImport("ESENT.dll", ExactSpelling = true)]
static extern int JetGrowDatabase(
    UIntPtr sesid,   // JET_SESID
    uint dbid,   // DWORD
    uint cpg,   // DWORD
    ref uint pcpgReal   // DWORD*
);
<DllImport("ESENT.dll", ExactSpelling:=True)>
Public Shared Function JetGrowDatabase(
    sesid As UIntPtr,   ' JET_SESID
    dbid As UInteger,   ' DWORD
    cpg As UInteger,   ' DWORD
    ByRef pcpgReal As UInteger   ' DWORD*
) As Integer
End Function
' sesid : JET_SESID
' dbid : DWORD
' cpg : DWORD
' pcpgReal : DWORD*
Declare PtrSafe Function JetGrowDatabase Lib "esent" ( _
    ByVal sesid As LongPtr, _
    ByVal dbid As Long, _
    ByVal cpg As Long, _
    ByRef pcpgReal As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JetGrowDatabase = ctypes.windll.esent.JetGrowDatabase
JetGrowDatabase.restype = ctypes.c_int
JetGrowDatabase.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    wintypes.DWORD,  # dbid : DWORD
    wintypes.DWORD,  # cpg : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pcpgReal : DWORD*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGrowDatabase = esent.NewProc("JetGrowDatabase")
)

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