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

JetSetDatabaseSizeA

関数
データベースファイルのサイズをページ単位で設定する(ANSI版)。
DLLESENT.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// ESENT.dll  (ANSI / -A)
#include <windows.h>

INT JetSetDatabaseSizeA(
    JET_SESID sesid,
    CHAR* szDatabaseName,
    DWORD cpg,
    DWORD* pcpgReal
);

パラメーター

名前方向
sesidJET_SESIDin
szDatabaseNameCHAR*in
cpgDWORDin
pcpgRealDWORD*out

戻り値の型: INT

各言語での呼び出し定義

// ESENT.dll  (ANSI / -A)
#include <windows.h>

INT JetSetDatabaseSizeA(
    JET_SESID sesid,
    CHAR* szDatabaseName,
    DWORD cpg,
    DWORD* pcpgReal
);
[DllImport("ESENT.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int JetSetDatabaseSizeA(
    UIntPtr sesid,   // JET_SESID
    IntPtr szDatabaseName,   // CHAR*
    uint cpg,   // DWORD
    out uint pcpgReal   // DWORD* out
);
<DllImport("ESENT.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function JetSetDatabaseSizeA(
    sesid As UIntPtr,   ' JET_SESID
    szDatabaseName As IntPtr,   ' CHAR*
    cpg As UInteger,   ' DWORD
    <Out> ByRef pcpgReal As UInteger   ' DWORD* out
) As Integer
End Function
' sesid : JET_SESID
' szDatabaseName : CHAR*
' cpg : DWORD
' pcpgReal : DWORD* out
Declare PtrSafe Function JetSetDatabaseSizeA Lib "esent" ( _
    ByVal sesid As LongPtr, _
    ByVal szDatabaseName As LongPtr, _
    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

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

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetSetDatabaseSizeA = esent.NewProc("JetSetDatabaseSizeA")
)

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