ホーム › System.Environment › EnclaveGetEnclaveInformation
EnclaveGetEnclaveInformation
関数現在のエンクレーブに関する情報を取得する。
シグネチャ
// vertdll.dll
#include <windows.h>
HRESULT EnclaveGetEnclaveInformation(
DWORD InformationSize,
ENCLAVE_INFORMATION* EnclaveInformation
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| InformationSize | DWORD | in | EnclaveInformationバッファのサイズ(バイト)。 |
| EnclaveInformation | ENCLAVE_INFORMATION* | out | 現在のエンクレーブ情報を受け取るENCLAVE_INFORMATION構造体へのポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// vertdll.dll
#include <windows.h>
HRESULT EnclaveGetEnclaveInformation(
DWORD InformationSize,
ENCLAVE_INFORMATION* EnclaveInformation
);[DllImport("vertdll.dll", ExactSpelling = true)]
static extern int EnclaveGetEnclaveInformation(
uint InformationSize, // DWORD
IntPtr EnclaveInformation // ENCLAVE_INFORMATION* out
);<DllImport("vertdll.dll", ExactSpelling:=True)>
Public Shared Function EnclaveGetEnclaveInformation(
InformationSize As UInteger, ' DWORD
EnclaveInformation As IntPtr ' ENCLAVE_INFORMATION* out
) As Integer
End Function' InformationSize : DWORD
' EnclaveInformation : ENCLAVE_INFORMATION* out
Declare PtrSafe Function EnclaveGetEnclaveInformation Lib "vertdll" ( _
ByVal InformationSize As Long, _
ByVal EnclaveInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnclaveGetEnclaveInformation = ctypes.windll.vertdll.EnclaveGetEnclaveInformation
EnclaveGetEnclaveInformation.restype = ctypes.c_int
EnclaveGetEnclaveInformation.argtypes = [
wintypes.DWORD, # InformationSize : DWORD
ctypes.c_void_p, # EnclaveInformation : ENCLAVE_INFORMATION* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('vertdll.dll')
EnclaveGetEnclaveInformation = Fiddle::Function.new(
lib['EnclaveGetEnclaveInformation'],
[
-Fiddle::TYPE_INT, # InformationSize : DWORD
Fiddle::TYPE_VOIDP, # EnclaveInformation : ENCLAVE_INFORMATION* out
],
Fiddle::TYPE_INT)#[link(name = "vertdll")]
extern "system" {
fn EnclaveGetEnclaveInformation(
InformationSize: u32, // DWORD
EnclaveInformation: *mut ENCLAVE_INFORMATION // ENCLAVE_INFORMATION* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("vertdll.dll")]
public static extern int EnclaveGetEnclaveInformation(uint InformationSize, IntPtr EnclaveInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vertdll_EnclaveGetEnclaveInformation' -Namespace Win32 -PassThru
# $api::EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation)#uselib "vertdll.dll"
#func global EnclaveGetEnclaveInformation "EnclaveGetEnclaveInformation" sptr, sptr
; EnclaveGetEnclaveInformation InformationSize, varptr(EnclaveInformation) ; 戻り値は stat
; InformationSize : DWORD -> "sptr"
; EnclaveInformation : ENCLAVE_INFORMATION* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "vertdll.dll" #cfunc global EnclaveGetEnclaveInformation "EnclaveGetEnclaveInformation" int, var ; res = EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation) ; InformationSize : DWORD -> "int" ; EnclaveInformation : ENCLAVE_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "vertdll.dll" #cfunc global EnclaveGetEnclaveInformation "EnclaveGetEnclaveInformation" int, sptr ; res = EnclaveGetEnclaveInformation(InformationSize, varptr(EnclaveInformation)) ; InformationSize : DWORD -> "int" ; EnclaveInformation : ENCLAVE_INFORMATION* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT EnclaveGetEnclaveInformation(DWORD InformationSize, ENCLAVE_INFORMATION* EnclaveInformation) #uselib "vertdll.dll" #cfunc global EnclaveGetEnclaveInformation "EnclaveGetEnclaveInformation" int, var ; res = EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation) ; InformationSize : DWORD -> "int" ; EnclaveInformation : ENCLAVE_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT EnclaveGetEnclaveInformation(DWORD InformationSize, ENCLAVE_INFORMATION* EnclaveInformation) #uselib "vertdll.dll" #cfunc global EnclaveGetEnclaveInformation "EnclaveGetEnclaveInformation" int, intptr ; res = EnclaveGetEnclaveInformation(InformationSize, varptr(EnclaveInformation)) ; InformationSize : DWORD -> "int" ; EnclaveInformation : ENCLAVE_INFORMATION* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vertdll = windows.NewLazySystemDLL("vertdll.dll")
procEnclaveGetEnclaveInformation = vertdll.NewProc("EnclaveGetEnclaveInformation")
)
// InformationSize (DWORD), EnclaveInformation (ENCLAVE_INFORMATION* out)
r1, _, err := procEnclaveGetEnclaveInformation.Call(
uintptr(InformationSize),
uintptr(EnclaveInformation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction EnclaveGetEnclaveInformation(
InformationSize: DWORD; // DWORD
EnclaveInformation: Pointer // ENCLAVE_INFORMATION* out
): Integer; stdcall;
external 'vertdll.dll' name 'EnclaveGetEnclaveInformation';result := DllCall("vertdll\EnclaveGetEnclaveInformation"
, "UInt", InformationSize ; DWORD
, "Ptr", EnclaveInformation ; ENCLAVE_INFORMATION* out
, "Int") ; return: HRESULT●EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation) = DLL("vertdll.dll", "int EnclaveGetEnclaveInformation(dword, void*)")
# 呼び出し: EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation)
# InformationSize : DWORD -> "dword"
# EnclaveInformation : ENCLAVE_INFORMATION* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "vertdll" fn EnclaveGetEnclaveInformation(
InformationSize: u32, // DWORD
EnclaveInformation: [*c]ENCLAVE_INFORMATION // ENCLAVE_INFORMATION* out
) callconv(std.os.windows.WINAPI) i32;proc EnclaveGetEnclaveInformation(
InformationSize: uint32, # DWORD
EnclaveInformation: ptr ENCLAVE_INFORMATION # ENCLAVE_INFORMATION* out
): int32 {.importc: "EnclaveGetEnclaveInformation", stdcall, dynlib: "vertdll.dll".}pragma(lib, "vertdll");
extern(Windows)
int EnclaveGetEnclaveInformation(
uint InformationSize, // DWORD
ENCLAVE_INFORMATION* EnclaveInformation // ENCLAVE_INFORMATION* out
);ccall((:EnclaveGetEnclaveInformation, "vertdll.dll"), stdcall, Int32,
(UInt32, Ptr{ENCLAVE_INFORMATION}),
InformationSize, EnclaveInformation)
# InformationSize : DWORD -> UInt32
# EnclaveInformation : ENCLAVE_INFORMATION* out -> Ptr{ENCLAVE_INFORMATION}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t EnclaveGetEnclaveInformation(
uint32_t InformationSize,
void* EnclaveInformation);
]]
local vertdll = ffi.load("vertdll")
-- vertdll.EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation)
-- InformationSize : DWORD
-- EnclaveInformation : ENCLAVE_INFORMATION* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('vertdll.dll');
const EnclaveGetEnclaveInformation = lib.func('__stdcall', 'EnclaveGetEnclaveInformation', 'int32_t', ['uint32_t', 'void *']);
// EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation)
// InformationSize : DWORD -> 'uint32_t'
// EnclaveInformation : ENCLAVE_INFORMATION* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("vertdll.dll", {
EnclaveGetEnclaveInformation: { parameters: ["u32", "pointer"], result: "i32" },
});
// lib.symbols.EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation)
// InformationSize : DWORD -> "u32"
// EnclaveInformation : ENCLAVE_INFORMATION* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t EnclaveGetEnclaveInformation(
uint32_t InformationSize,
void* EnclaveInformation);
C, "vertdll.dll");
// $ffi->EnclaveGetEnclaveInformation(InformationSize, EnclaveInformation);
// InformationSize : DWORD
// EnclaveInformation : ENCLAVE_INFORMATION* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Vertdll extends StdCallLibrary {
Vertdll INSTANCE = Native.load("vertdll", Vertdll.class);
int EnclaveGetEnclaveInformation(
int InformationSize, // DWORD
Pointer EnclaveInformation // ENCLAVE_INFORMATION* out
);
}@[Link("vertdll")]
lib Libvertdll
fun EnclaveGetEnclaveInformation = EnclaveGetEnclaveInformation(
InformationSize : UInt32, # DWORD
EnclaveInformation : ENCLAVE_INFORMATION* # ENCLAVE_INFORMATION* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef EnclaveGetEnclaveInformationNative = Int32 Function(Uint32, Pointer<Void>);
typedef EnclaveGetEnclaveInformationDart = int Function(int, Pointer<Void>);
final EnclaveGetEnclaveInformation = DynamicLibrary.open('vertdll.dll')
.lookupFunction<EnclaveGetEnclaveInformationNative, EnclaveGetEnclaveInformationDart>('EnclaveGetEnclaveInformation');
// InformationSize : DWORD -> Uint32
// EnclaveInformation : ENCLAVE_INFORMATION* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function EnclaveGetEnclaveInformation(
InformationSize: DWORD; // DWORD
EnclaveInformation: Pointer // ENCLAVE_INFORMATION* out
): Integer; stdcall;
external 'vertdll.dll' name 'EnclaveGetEnclaveInformation';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "EnclaveGetEnclaveInformation"
c_EnclaveGetEnclaveInformation :: Word32 -> Ptr () -> IO Int32
-- InformationSize : DWORD -> Word32
-- EnclaveInformation : ENCLAVE_INFORMATION* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let enclavegetenclaveinformation =
foreign "EnclaveGetEnclaveInformation"
(uint32_t @-> (ptr void) @-> returning int32_t)
(* InformationSize : DWORD -> uint32_t *)
(* EnclaveInformation : ENCLAVE_INFORMATION* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library vertdll (t "vertdll.dll"))
(cffi:use-foreign-library vertdll)
(cffi:defcfun ("EnclaveGetEnclaveInformation" enclave-get-enclave-information :convention :stdcall) :int32
(information-size :uint32) ; DWORD
(enclave-information :pointer)) ; ENCLAVE_INFORMATION* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $EnclaveGetEnclaveInformation = Win32::API::More->new('vertdll',
'int EnclaveGetEnclaveInformation(DWORD InformationSize, LPVOID EnclaveInformation)');
# my $ret = $EnclaveGetEnclaveInformation->Call($InformationSize, $EnclaveInformation);
# InformationSize : DWORD -> DWORD
# EnclaveInformation : ENCLAVE_INFORMATION* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。