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

JetDupSession

関数
既存のESEセッションを複製して新しいセッションを作成する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetDupSession(
    JET_SESID sesid,
    JET_SESID* psesid
);

パラメーター

名前方向
sesidJET_SESIDin
psesidJET_SESID*out

戻り値の型: INT

各言語での呼び出し定義

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

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

JetDupSession = ctypes.windll.esent.JetDupSession
JetDupSession.restype = ctypes.c_int
JetDupSession.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_void_p,  # psesid : JET_SESID* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetDupSession = Fiddle::Function.new(
  lib['JetDupSession'],
  [
    Fiddle::TYPE_UINTPTR_T,  # sesid : JET_SESID
    Fiddle::TYPE_VOIDP,  # psesid : JET_SESID* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetDupSession(
        sesid: usize,  // JET_SESID
        psesid: *mut usize  // JET_SESID* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetDupSession(UIntPtr sesid, out UIntPtr psesid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetDupSession' -Namespace Win32 -PassThru
# $api::JetDupSession(sesid, psesid)
#uselib "ESENT.dll"
#func global JetDupSession "JetDupSession" sptr, sptr
; JetDupSession sesid, psesid   ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; psesid : JET_SESID* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ESENT.dll"
#cfunc global JetDupSession "JetDupSession" sptr, int
; res = JetDupSession(sesid, psesid)
; sesid : JET_SESID -> "sptr"
; psesid : JET_SESID* out -> "int"
; INT JetDupSession(JET_SESID sesid, JET_SESID* psesid)
#uselib "ESENT.dll"
#cfunc global JetDupSession "JetDupSession" intptr, int
; res = JetDupSession(sesid, psesid)
; sesid : JET_SESID -> "intptr"
; psesid : JET_SESID* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetDupSession = esent.NewProc("JetDupSession")
)

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