ホーム › System.Environment › InitializeEnclave
InitializeEnclave
関数作成したエンクレーブを初期化して実行可能状態にする。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL InitializeEnclave(
HANDLE hProcess,
void* lpAddress,
const void* lpEnclaveInformation,
DWORD dwInfoLength,
DWORD* lpEnclaveError // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProcess | HANDLE | in |
| lpAddress | void* | in |
| lpEnclaveInformation | void* | in |
| dwInfoLength | DWORD | in |
| lpEnclaveError | DWORD* | outoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL InitializeEnclave(
HANDLE hProcess,
void* lpAddress,
const void* lpEnclaveInformation,
DWORD dwInfoLength,
DWORD* lpEnclaveError // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool InitializeEnclave(
IntPtr hProcess, // HANDLE
IntPtr lpAddress, // void*
IntPtr lpEnclaveInformation, // void*
uint dwInfoLength, // DWORD
IntPtr lpEnclaveError // DWORD* optional, out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function InitializeEnclave(
hProcess As IntPtr, ' HANDLE
lpAddress As IntPtr, ' void*
lpEnclaveInformation As IntPtr, ' void*
dwInfoLength As UInteger, ' DWORD
lpEnclaveError As IntPtr ' DWORD* optional, out
) As Boolean
End Function' hProcess : HANDLE
' lpAddress : void*
' lpEnclaveInformation : void*
' dwInfoLength : DWORD
' lpEnclaveError : DWORD* optional, out
Declare PtrSafe Function InitializeEnclave Lib "kernel32" ( _
ByVal hProcess As LongPtr, _
ByVal lpAddress As LongPtr, _
ByVal lpEnclaveInformation As LongPtr, _
ByVal dwInfoLength As Long, _
ByVal lpEnclaveError As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
InitializeEnclave = ctypes.windll.kernel32.InitializeEnclave
InitializeEnclave.restype = wintypes.BOOL
InitializeEnclave.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE
ctypes.POINTER(None), # lpAddress : void*
ctypes.POINTER(None), # lpEnclaveInformation : void*
wintypes.DWORD, # dwInfoLength : DWORD
ctypes.POINTER(wintypes.DWORD), # lpEnclaveError : DWORD* optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
InitializeEnclave = Fiddle::Function.new(
lib['InitializeEnclave'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
Fiddle::TYPE_VOIDP, # lpAddress : void*
Fiddle::TYPE_VOIDP, # lpEnclaveInformation : void*
-Fiddle::TYPE_INT, # dwInfoLength : DWORD
Fiddle::TYPE_VOIDP, # lpEnclaveError : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn InitializeEnclave(
hProcess: *mut core::ffi::c_void, // HANDLE
lpAddress: *mut (), // void*
lpEnclaveInformation: *const (), // void*
dwInfoLength: u32, // DWORD
lpEnclaveError: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool InitializeEnclave(IntPtr hProcess, IntPtr lpAddress, IntPtr lpEnclaveInformation, uint dwInfoLength, IntPtr lpEnclaveError);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_InitializeEnclave' -Namespace Win32 -PassThru
# $api::InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, lpEnclaveError)#uselib "KERNEL32.dll"
#func global InitializeEnclave "InitializeEnclave" sptr, sptr, sptr, sptr, sptr
; InitializeEnclave hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, varptr(lpEnclaveError) ; 戻り値は stat
; hProcess : HANDLE -> "sptr"
; lpAddress : void* -> "sptr"
; lpEnclaveInformation : void* -> "sptr"
; dwInfoLength : DWORD -> "sptr"
; lpEnclaveError : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global InitializeEnclave "InitializeEnclave" sptr, sptr, sptr, int, var ; res = InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, lpEnclaveError) ; hProcess : HANDLE -> "sptr" ; lpAddress : void* -> "sptr" ; lpEnclaveInformation : void* -> "sptr" ; dwInfoLength : DWORD -> "int" ; lpEnclaveError : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global InitializeEnclave "InitializeEnclave" sptr, sptr, sptr, int, sptr ; res = InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, varptr(lpEnclaveError)) ; hProcess : HANDLE -> "sptr" ; lpAddress : void* -> "sptr" ; lpEnclaveInformation : void* -> "sptr" ; dwInfoLength : DWORD -> "int" ; lpEnclaveError : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL InitializeEnclave(HANDLE hProcess, void* lpAddress, void* lpEnclaveInformation, DWORD dwInfoLength, DWORD* lpEnclaveError) #uselib "KERNEL32.dll" #cfunc global InitializeEnclave "InitializeEnclave" intptr, intptr, intptr, int, var ; res = InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, lpEnclaveError) ; hProcess : HANDLE -> "intptr" ; lpAddress : void* -> "intptr" ; lpEnclaveInformation : void* -> "intptr" ; dwInfoLength : DWORD -> "int" ; lpEnclaveError : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL InitializeEnclave(HANDLE hProcess, void* lpAddress, void* lpEnclaveInformation, DWORD dwInfoLength, DWORD* lpEnclaveError) #uselib "KERNEL32.dll" #cfunc global InitializeEnclave "InitializeEnclave" intptr, intptr, intptr, int, intptr ; res = InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, varptr(lpEnclaveError)) ; hProcess : HANDLE -> "intptr" ; lpAddress : void* -> "intptr" ; lpEnclaveInformation : void* -> "intptr" ; dwInfoLength : DWORD -> "int" ; lpEnclaveError : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procInitializeEnclave = kernel32.NewProc("InitializeEnclave")
)
// hProcess (HANDLE), lpAddress (void*), lpEnclaveInformation (void*), dwInfoLength (DWORD), lpEnclaveError (DWORD* optional, out)
r1, _, err := procInitializeEnclave.Call(
uintptr(hProcess),
uintptr(lpAddress),
uintptr(lpEnclaveInformation),
uintptr(dwInfoLength),
uintptr(lpEnclaveError),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction InitializeEnclave(
hProcess: THandle; // HANDLE
lpAddress: Pointer; // void*
lpEnclaveInformation: Pointer; // void*
dwInfoLength: DWORD; // DWORD
lpEnclaveError: Pointer // DWORD* optional, out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'InitializeEnclave';result := DllCall("KERNEL32\InitializeEnclave"
, "Ptr", hProcess ; HANDLE
, "Ptr", lpAddress ; void*
, "Ptr", lpEnclaveInformation ; void*
, "UInt", dwInfoLength ; DWORD
, "Ptr", lpEnclaveError ; DWORD* optional, out
, "Int") ; return: BOOL●InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, lpEnclaveError) = DLL("KERNEL32.dll", "bool InitializeEnclave(void*, void*, void*, dword, void*)")
# 呼び出し: InitializeEnclave(hProcess, lpAddress, lpEnclaveInformation, dwInfoLength, lpEnclaveError)
# hProcess : HANDLE -> "void*"
# lpAddress : void* -> "void*"
# lpEnclaveInformation : void* -> "void*"
# dwInfoLength : DWORD -> "dword"
# lpEnclaveError : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。