ホーム › System.Environment › VBS_BASIC_ENCLAVE_SYSCALL_PAGE
VBS_BASIC_ENCLAVE_SYSCALL_PAGE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
各言語での定義
#include <windows.h>
// VBS_BASIC_ENCLAVE_SYSCALL_PAGE (x64 104 / x86 52 バイト)
typedef struct VBS_BASIC_ENCLAVE_SYSCALL_PAGE {
VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_ENCLAVE ReturnFromEnclave;
VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_EXCEPTION ReturnFromException;
VBS_BASIC_ENCLAVE_BASIC_CALL_TERMINATE_THREAD TerminateThread;
VBS_BASIC_ENCLAVE_BASIC_CALL_INTERRUPT_THREAD InterruptThread;
VBS_BASIC_ENCLAVE_BASIC_CALL_COMMIT_PAGES CommitPages;
VBS_BASIC_ENCLAVE_BASIC_CALL_DECOMMIT_PAGES DecommitPages;
VBS_BASIC_ENCLAVE_BASIC_CALL_PROTECT_PAGES ProtectPages;
VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD CreateThread;
VBS_BASIC_ENCLAVE_BASIC_CALL_GET_ENCLAVE_INFORMATION GetEnclaveInformation;
VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_KEY GenerateKey;
VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_REPORT GenerateReport;
VBS_BASIC_ENCLAVE_BASIC_CALL_VERIFY_REPORT VerifyReport;
VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_RANDOM_DATA GenerateRandomData;
} VBS_BASIC_ENCLAVE_SYSCALL_PAGE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VBS_BASIC_ENCLAVE_SYSCALL_PAGE
{
public IntPtr ReturnFromEnclave;
public IntPtr ReturnFromException;
public IntPtr TerminateThread;
public IntPtr InterruptThread;
public IntPtr CommitPages;
public IntPtr DecommitPages;
public IntPtr ProtectPages;
public IntPtr CreateThread;
public IntPtr GetEnclaveInformation;
public IntPtr GenerateKey;
public IntPtr GenerateReport;
public IntPtr VerifyReport;
public IntPtr GenerateRandomData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VBS_BASIC_ENCLAVE_SYSCALL_PAGE
Public ReturnFromEnclave As IntPtr
Public ReturnFromException As IntPtr
Public TerminateThread As IntPtr
Public InterruptThread As IntPtr
Public CommitPages As IntPtr
Public DecommitPages As IntPtr
Public ProtectPages As IntPtr
Public CreateThread As IntPtr
Public GetEnclaveInformation As IntPtr
Public GenerateKey As IntPtr
Public GenerateReport As IntPtr
Public VerifyReport As IntPtr
Public GenerateRandomData As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class VBS_BASIC_ENCLAVE_SYSCALL_PAGE(ctypes.Structure):
_fields_ = [
("ReturnFromEnclave", ctypes.c_void_p),
("ReturnFromException", ctypes.c_void_p),
("TerminateThread", ctypes.c_void_p),
("InterruptThread", ctypes.c_void_p),
("CommitPages", ctypes.c_void_p),
("DecommitPages", ctypes.c_void_p),
("ProtectPages", ctypes.c_void_p),
("CreateThread", ctypes.c_void_p),
("GetEnclaveInformation", ctypes.c_void_p),
("GenerateKey", ctypes.c_void_p),
("GenerateReport", ctypes.c_void_p),
("VerifyReport", ctypes.c_void_p),
("GenerateRandomData", ctypes.c_void_p),
]#[repr(C)]
pub struct VBS_BASIC_ENCLAVE_SYSCALL_PAGE {
pub ReturnFromEnclave: *mut core::ffi::c_void,
pub ReturnFromException: *mut core::ffi::c_void,
pub TerminateThread: *mut core::ffi::c_void,
pub InterruptThread: *mut core::ffi::c_void,
pub CommitPages: *mut core::ffi::c_void,
pub DecommitPages: *mut core::ffi::c_void,
pub ProtectPages: *mut core::ffi::c_void,
pub CreateThread: *mut core::ffi::c_void,
pub GetEnclaveInformation: *mut core::ffi::c_void,
pub GenerateKey: *mut core::ffi::c_void,
pub GenerateReport: *mut core::ffi::c_void,
pub VerifyReport: *mut core::ffi::c_void,
pub GenerateRandomData: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type VBS_BASIC_ENCLAVE_SYSCALL_PAGE struct {
ReturnFromEnclave uintptr
ReturnFromException uintptr
TerminateThread uintptr
InterruptThread uintptr
CommitPages uintptr
DecommitPages uintptr
ProtectPages uintptr
CreateThread uintptr
GetEnclaveInformation uintptr
GenerateKey uintptr
GenerateReport uintptr
VerifyReport uintptr
GenerateRandomData uintptr
}type
VBS_BASIC_ENCLAVE_SYSCALL_PAGE = record
ReturnFromEnclave: Pointer;
ReturnFromException: Pointer;
TerminateThread: Pointer;
InterruptThread: Pointer;
CommitPages: Pointer;
DecommitPages: Pointer;
ProtectPages: Pointer;
CreateThread: Pointer;
GetEnclaveInformation: Pointer;
GenerateKey: Pointer;
GenerateReport: Pointer;
VerifyReport: Pointer;
GenerateRandomData: Pointer;
end;const VBS_BASIC_ENCLAVE_SYSCALL_PAGE = extern struct {
ReturnFromEnclave: ?*anyopaque,
ReturnFromException: ?*anyopaque,
TerminateThread: ?*anyopaque,
InterruptThread: ?*anyopaque,
CommitPages: ?*anyopaque,
DecommitPages: ?*anyopaque,
ProtectPages: ?*anyopaque,
CreateThread: ?*anyopaque,
GetEnclaveInformation: ?*anyopaque,
GenerateKey: ?*anyopaque,
GenerateReport: ?*anyopaque,
VerifyReport: ?*anyopaque,
GenerateRandomData: ?*anyopaque,
};type
VBS_BASIC_ENCLAVE_SYSCALL_PAGE {.bycopy.} = object
ReturnFromEnclave: pointer
ReturnFromException: pointer
TerminateThread: pointer
InterruptThread: pointer
CommitPages: pointer
DecommitPages: pointer
ProtectPages: pointer
CreateThread: pointer
GetEnclaveInformation: pointer
GenerateKey: pointer
GenerateReport: pointer
VerifyReport: pointer
GenerateRandomData: pointerstruct VBS_BASIC_ENCLAVE_SYSCALL_PAGE
{
void* ReturnFromEnclave;
void* ReturnFromException;
void* TerminateThread;
void* InterruptThread;
void* CommitPages;
void* DecommitPages;
void* ProtectPages;
void* CreateThread;
void* GetEnclaveInformation;
void* GenerateKey;
void* GenerateReport;
void* VerifyReport;
void* GenerateRandomData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VBS_BASIC_ENCLAVE_SYSCALL_PAGE サイズ: 52 バイト(x86)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; ReturnFromEnclave : VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_ENCLAVE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ReturnFromException : VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_EXCEPTION (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; TerminateThread : VBS_BASIC_ENCLAVE_BASIC_CALL_TERMINATE_THREAD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; InterruptThread : VBS_BASIC_ENCLAVE_BASIC_CALL_INTERRUPT_THREAD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; CommitPages : VBS_BASIC_ENCLAVE_BASIC_CALL_COMMIT_PAGES (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DecommitPages : VBS_BASIC_ENCLAVE_BASIC_CALL_DECOMMIT_PAGES (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ProtectPages : VBS_BASIC_ENCLAVE_BASIC_CALL_PROTECT_PAGES (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; CreateThread : VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; GetEnclaveInformation : VBS_BASIC_ENCLAVE_BASIC_CALL_GET_ENCLAVE_INFORMATION (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; GenerateKey : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_KEY (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; GenerateReport : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_REPORT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; VerifyReport : VBS_BASIC_ENCLAVE_BASIC_CALL_VERIFY_REPORT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; GenerateRandomData : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_RANDOM_DATA (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VBS_BASIC_ENCLAVE_SYSCALL_PAGE サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; ReturnFromEnclave : VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_ENCLAVE (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ReturnFromException : VBS_BASIC_ENCLAVE_BASIC_CALL_RETURN_FROM_EXCEPTION (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; TerminateThread : VBS_BASIC_ENCLAVE_BASIC_CALL_TERMINATE_THREAD (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; InterruptThread : VBS_BASIC_ENCLAVE_BASIC_CALL_INTERRUPT_THREAD (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; CommitPages : VBS_BASIC_ENCLAVE_BASIC_CALL_COMMIT_PAGES (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; DecommitPages : VBS_BASIC_ENCLAVE_BASIC_CALL_DECOMMIT_PAGES (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ProtectPages : VBS_BASIC_ENCLAVE_BASIC_CALL_PROTECT_PAGES (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; CreateThread : VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; GetEnclaveInformation : VBS_BASIC_ENCLAVE_BASIC_CALL_GET_ENCLAVE_INFORMATION (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; GenerateKey : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_KEY (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; GenerateReport : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_REPORT (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; VerifyReport : VBS_BASIC_ENCLAVE_BASIC_CALL_VERIFY_REPORT (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; GenerateRandomData : VBS_BASIC_ENCLAVE_BASIC_CALL_GENERATE_RANDOM_DATA (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VBS_BASIC_ENCLAVE_SYSCALL_PAGE
#field intptr ReturnFromEnclave
#field intptr ReturnFromException
#field intptr TerminateThread
#field intptr InterruptThread
#field intptr CommitPages
#field intptr DecommitPages
#field intptr ProtectPages
#field intptr CreateThread
#field intptr GetEnclaveInformation
#field intptr GenerateKey
#field intptr GenerateReport
#field intptr VerifyReport
#field intptr GenerateRandomData
#endstruct
stdim st, VBS_BASIC_ENCLAVE_SYSCALL_PAGE ; NSTRUCT 変数を確保