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

EnclaveCopyIntoEnclave

関数
非保護領域からエンクレーブ内へデータをコピーする。
DLLvertdll.dll呼出規約winapi

シグネチャ

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

HRESULT EnclaveCopyIntoEnclave(
    void* EnclaveAddress,
    const void* UnsecureAddress,
    UINT_PTR NumberOfBytes
);

パラメーター

名前方向
EnclaveAddressvoid*out
UnsecureAddressvoid*in
NumberOfBytesUINT_PTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT EnclaveCopyIntoEnclave(
    void* EnclaveAddress,
    const void* UnsecureAddress,
    UINT_PTR NumberOfBytes
);
[DllImport("vertdll.dll", ExactSpelling = true)]
static extern int EnclaveCopyIntoEnclave(
    IntPtr EnclaveAddress,   // void* out
    IntPtr UnsecureAddress,   // void*
    UIntPtr NumberOfBytes   // UINT_PTR
);
<DllImport("vertdll.dll", ExactSpelling:=True)>
Public Shared Function EnclaveCopyIntoEnclave(
    EnclaveAddress As IntPtr,   ' void* out
    UnsecureAddress As IntPtr,   ' void*
    NumberOfBytes As UIntPtr   ' UINT_PTR
) As Integer
End Function
' EnclaveAddress : void* out
' UnsecureAddress : void*
' NumberOfBytes : UINT_PTR
Declare PtrSafe Function EnclaveCopyIntoEnclave Lib "vertdll" ( _
    ByVal EnclaveAddress As LongPtr, _
    ByVal UnsecureAddress As LongPtr, _
    ByVal NumberOfBytes As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EnclaveCopyIntoEnclave = ctypes.windll.vertdll.EnclaveCopyIntoEnclave
EnclaveCopyIntoEnclave.restype = ctypes.c_int
EnclaveCopyIntoEnclave.argtypes = [
    ctypes.POINTER(None),  # EnclaveAddress : void* out
    ctypes.POINTER(None),  # UnsecureAddress : void*
    ctypes.c_size_t,  # NumberOfBytes : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	vertdll = windows.NewLazySystemDLL("vertdll.dll")
	procEnclaveCopyIntoEnclave = vertdll.NewProc("EnclaveCopyIntoEnclave")
)

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