ホーム › System.Environment › LoadEnclaveImageW
LoadEnclaveImageW
関数指定したイメージをエンクレーブにロードする(Unicode版)。
シグネチャ
// api-ms-win-core-enclave-l1-1-1.dll (Unicode / -W)
#include <windows.h>
BOOL LoadEnclaveImageW(
void* lpEnclaveAddress,
LPCWSTR lpImageName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpEnclaveAddress | void* | in |
| lpImageName | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// api-ms-win-core-enclave-l1-1-1.dll (Unicode / -W)
#include <windows.h>
BOOL LoadEnclaveImageW(
void* lpEnclaveAddress,
LPCWSTR lpImageName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-enclave-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool LoadEnclaveImageW(
IntPtr lpEnclaveAddress, // void*
[MarshalAs(UnmanagedType.LPWStr)] string lpImageName // LPCWSTR
);<DllImport("api-ms-win-core-enclave-l1-1-1.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function LoadEnclaveImageW(
lpEnclaveAddress As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> lpImageName As String ' LPCWSTR
) As Boolean
End Function' lpEnclaveAddress : void*
' lpImageName : LPCWSTR
Declare PtrSafe Function LoadEnclaveImageW Lib "api-ms-win-core-enclave-l1-1-1" ( _
ByVal lpEnclaveAddress As LongPtr, _
ByVal lpImageName As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
LoadEnclaveImageW = ctypes.windll.LoadLibrary("api-ms-win-core-enclave-l1-1-1.dll").LoadEnclaveImageW
LoadEnclaveImageW.restype = wintypes.BOOL
LoadEnclaveImageW.argtypes = [
ctypes.POINTER(None), # lpEnclaveAddress : void*
wintypes.LPCWSTR, # lpImageName : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-enclave-l1-1-1.dll')
LoadEnclaveImageW = Fiddle::Function.new(
lib['LoadEnclaveImageW'],
[
Fiddle::TYPE_VOIDP, # lpEnclaveAddress : void*
Fiddle::TYPE_VOIDP, # lpImageName : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "api-ms-win-core-enclave-l1-1-1")]
extern "system" {
fn LoadEnclaveImageW(
lpEnclaveAddress: *mut (), // void*
lpImageName: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-enclave-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool LoadEnclaveImageW(IntPtr lpEnclaveAddress, [MarshalAs(UnmanagedType.LPWStr)] string lpImageName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-enclave-l1-1-1_LoadEnclaveImageW' -Namespace Win32 -PassThru
# $api::LoadEnclaveImageW(lpEnclaveAddress, lpImageName)#uselib "api-ms-win-core-enclave-l1-1-1.dll"
#func global LoadEnclaveImageW "LoadEnclaveImageW" wptr, wptr
; LoadEnclaveImageW lpEnclaveAddress, lpImageName ; 戻り値は stat
; lpEnclaveAddress : void* -> "wptr"
; lpImageName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-enclave-l1-1-1.dll"
#cfunc global LoadEnclaveImageW "LoadEnclaveImageW" sptr, wstr
; res = LoadEnclaveImageW(lpEnclaveAddress, lpImageName)
; lpEnclaveAddress : void* -> "sptr"
; lpImageName : LPCWSTR -> "wstr"; BOOL LoadEnclaveImageW(void* lpEnclaveAddress, LPCWSTR lpImageName)
#uselib "api-ms-win-core-enclave-l1-1-1.dll"
#cfunc global LoadEnclaveImageW "LoadEnclaveImageW" intptr, wstr
; res = LoadEnclaveImageW(lpEnclaveAddress, lpImageName)
; lpEnclaveAddress : void* -> "intptr"
; lpImageName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_enclave_l1_1_1 = windows.NewLazySystemDLL("api-ms-win-core-enclave-l1-1-1.dll")
procLoadEnclaveImageW = api_ms_win_core_enclave_l1_1_1.NewProc("LoadEnclaveImageW")
)
// lpEnclaveAddress (void*), lpImageName (LPCWSTR)
r1, _, err := procLoadEnclaveImageW.Call(
uintptr(lpEnclaveAddress),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpImageName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction LoadEnclaveImageW(
lpEnclaveAddress: Pointer; // void*
lpImageName: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'api-ms-win-core-enclave-l1-1-1.dll' name 'LoadEnclaveImageW';result := DllCall("api-ms-win-core-enclave-l1-1-1\LoadEnclaveImageW"
, "Ptr", lpEnclaveAddress ; void*
, "WStr", lpImageName ; LPCWSTR
, "Int") ; return: BOOL●LoadEnclaveImageW(lpEnclaveAddress, lpImageName) = DLL("api-ms-win-core-enclave-l1-1-1.dll", "bool LoadEnclaveImageW(void*, char*)")
# 呼び出し: LoadEnclaveImageW(lpEnclaveAddress, lpImageName)
# lpEnclaveAddress : void* -> "void*"
# lpImageName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。