Win32 API 日本語リファレンス
ホームSystem.Environment › CallEnclave

CallEnclave

関数
エンクレーブ内のルーチンを呼び出して実行する。
DLLvertdll.dll呼出規約winapiSetLastErrorあり対応OSWindows 10 以降

シグネチャ

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

BOOL CallEnclave(
    INT_PTR lpRoutine,
    void* lpParameter,
    BOOL fWaitForThread,
    void** lpReturnValue
);

パラメーター

名前方向
lpRoutineINT_PTRin
lpParametervoid*in
fWaitForThreadBOOLin
lpReturnValuevoid**out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CallEnclave(
    INT_PTR lpRoutine,
    void* lpParameter,
    BOOL fWaitForThread,
    void** lpReturnValue
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("vertdll.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CallEnclave(
    IntPtr lpRoutine,   // INT_PTR
    IntPtr lpParameter,   // void*
    bool fWaitForThread,   // BOOL
    IntPtr lpReturnValue   // void** out
);
<DllImport("vertdll.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CallEnclave(
    lpRoutine As IntPtr,   ' INT_PTR
    lpParameter As IntPtr,   ' void*
    fWaitForThread As Boolean,   ' BOOL
    lpReturnValue As IntPtr   ' void** out
) As Boolean
End Function
' lpRoutine : INT_PTR
' lpParameter : void*
' fWaitForThread : BOOL
' lpReturnValue : void** out
Declare PtrSafe Function CallEnclave Lib "vertdll" ( _
    ByVal lpRoutine As LongPtr, _
    ByVal lpParameter As LongPtr, _
    ByVal fWaitForThread As Long, _
    ByVal lpReturnValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CallEnclave = ctypes.windll.vertdll.CallEnclave
CallEnclave.restype = wintypes.BOOL
CallEnclave.argtypes = [
    ctypes.c_ssize_t,  # lpRoutine : INT_PTR
    ctypes.POINTER(None),  # lpParameter : void*
    wintypes.BOOL,  # fWaitForThread : BOOL
    ctypes.c_void_p,  # lpReturnValue : void** out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('vertdll.dll')
CallEnclave = Fiddle::Function.new(
  lib['CallEnclave'],
  [
    Fiddle::TYPE_INTPTR_T,  # lpRoutine : INT_PTR
    Fiddle::TYPE_VOIDP,  # lpParameter : void*
    Fiddle::TYPE_INT,  # fWaitForThread : BOOL
    Fiddle::TYPE_VOIDP,  # lpReturnValue : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "vertdll")]
extern "system" {
    fn CallEnclave(
        lpRoutine: isize,  // INT_PTR
        lpParameter: *mut (),  // void*
        fWaitForThread: i32,  // BOOL
        lpReturnValue: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("vertdll.dll", SetLastError = true)]
public static extern bool CallEnclave(IntPtr lpRoutine, IntPtr lpParameter, bool fWaitForThread, IntPtr lpReturnValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vertdll_CallEnclave' -Namespace Win32 -PassThru
# $api::CallEnclave(lpRoutine, lpParameter, fWaitForThread, lpReturnValue)
#uselib "vertdll.dll"
#func global CallEnclave "CallEnclave" sptr, sptr, sptr, sptr
; CallEnclave lpRoutine, lpParameter, fWaitForThread, lpReturnValue   ; 戻り値は stat
; lpRoutine : INT_PTR -> "sptr"
; lpParameter : void* -> "sptr"
; fWaitForThread : BOOL -> "sptr"
; lpReturnValue : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "vertdll.dll"
#cfunc global CallEnclave "CallEnclave" sptr, sptr, int, sptr
; res = CallEnclave(lpRoutine, lpParameter, fWaitForThread, lpReturnValue)
; lpRoutine : INT_PTR -> "sptr"
; lpParameter : void* -> "sptr"
; fWaitForThread : BOOL -> "int"
; lpReturnValue : void** out -> "sptr"
; BOOL CallEnclave(INT_PTR lpRoutine, void* lpParameter, BOOL fWaitForThread, void** lpReturnValue)
#uselib "vertdll.dll"
#cfunc global CallEnclave "CallEnclave" intptr, intptr, int, intptr
; res = CallEnclave(lpRoutine, lpParameter, fWaitForThread, lpReturnValue)
; lpRoutine : INT_PTR -> "intptr"
; lpParameter : void* -> "intptr"
; fWaitForThread : BOOL -> "int"
; lpReturnValue : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	vertdll = windows.NewLazySystemDLL("vertdll.dll")
	procCallEnclave = vertdll.NewProc("CallEnclave")
)

// lpRoutine (INT_PTR), lpParameter (void*), fWaitForThread (BOOL), lpReturnValue (void** out)
r1, _, err := procCallEnclave.Call(
	uintptr(lpRoutine),
	uintptr(lpParameter),
	uintptr(fWaitForThread),
	uintptr(lpReturnValue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CallEnclave(
  lpRoutine: NativeInt;   // INT_PTR
  lpParameter: Pointer;   // void*
  fWaitForThread: BOOL;   // BOOL
  lpReturnValue: Pointer   // void** out
): BOOL; stdcall;
  external 'vertdll.dll' name 'CallEnclave';
result := DllCall("vertdll\CallEnclave"
    , "Ptr", lpRoutine   ; INT_PTR
    , "Ptr", lpParameter   ; void*
    , "Int", fWaitForThread   ; BOOL
    , "Ptr", lpReturnValue   ; void** out
    , "Int")   ; return: BOOL
●CallEnclave(lpRoutine, lpParameter, fWaitForThread, lpReturnValue) = DLL("vertdll.dll", "bool CallEnclave(int, void*, bool, void*)")
# 呼び出し: CallEnclave(lpRoutine, lpParameter, fWaitForThread, lpReturnValue)
# lpRoutine : INT_PTR -> "int"
# lpParameter : void* -> "void*"
# fWaitForThread : BOOL -> "bool"
# lpReturnValue : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。