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

VBS_BASIC_ENCLAVE_EXCEPTION_AMD64

構造体
サイズx64: 72 バイト / x86: 40 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ExceptionCodeDWORD4+0+0発生した例外のコード。
NumberParametersDWORD4+4+4ExceptionInformationの有効パラメータ数。
ExceptionInformationUINT_PTR24/12+8+8例外固有の追加情報配列。
ExceptionRAXUINT_PTR8/4+32+20例外発生時のRAXレジスタ値。
ExceptionRCXUINT_PTR8/4+40+24例外発生時のRCXレジスタ値。
ExceptionRIPUINT_PTR8/4+48+28例外発生時のRIP(命令ポインタ)値。
ExceptionRFLAGSUINT_PTR8/4+56+32例外発生時のRFLAGSレジスタ値。
ExceptionRSPUINT_PTR8/4+64+36例外発生時のRSP(スタックポインタ)値。

各言語での定義

#include <windows.h>

// VBS_BASIC_ENCLAVE_EXCEPTION_AMD64  (x64 72 / x86 40 バイト)
typedef struct VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 {
    DWORD ExceptionCode;
    DWORD NumberParameters;
    UINT_PTR ExceptionInformation[3];
    UINT_PTR ExceptionRAX;
    UINT_PTR ExceptionRCX;
    UINT_PTR ExceptionRIP;
    UINT_PTR ExceptionRFLAGS;
    UINT_PTR ExceptionRSP;
} VBS_BASIC_ENCLAVE_EXCEPTION_AMD64;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VBS_BASIC_ENCLAVE_EXCEPTION_AMD64
{
    public uint ExceptionCode;
    public uint NumberParameters;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public UIntPtr[] ExceptionInformation;
    public UIntPtr ExceptionRAX;
    public UIntPtr ExceptionRCX;
    public UIntPtr ExceptionRIP;
    public UIntPtr ExceptionRFLAGS;
    public UIntPtr ExceptionRSP;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VBS_BASIC_ENCLAVE_EXCEPTION_AMD64
    Public ExceptionCode As UInteger
    Public NumberParameters As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public ExceptionInformation() As UIntPtr
    Public ExceptionRAX As UIntPtr
    Public ExceptionRCX As UIntPtr
    Public ExceptionRIP As UIntPtr
    Public ExceptionRFLAGS As UIntPtr
    Public ExceptionRSP As UIntPtr
End Structure
import ctypes
from ctypes import wintypes

class VBS_BASIC_ENCLAVE_EXCEPTION_AMD64(ctypes.Structure):
    _fields_ = [
        ("ExceptionCode", wintypes.DWORD),
        ("NumberParameters", wintypes.DWORD),
        ("ExceptionInformation", ctypes.c_size_t * 3),
        ("ExceptionRAX", ctypes.c_size_t),
        ("ExceptionRCX", ctypes.c_size_t),
        ("ExceptionRIP", ctypes.c_size_t),
        ("ExceptionRFLAGS", ctypes.c_size_t),
        ("ExceptionRSP", ctypes.c_size_t),
    ]
#[repr(C)]
pub struct VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 {
    pub ExceptionCode: u32,
    pub NumberParameters: u32,
    pub ExceptionInformation: [usize; 3],
    pub ExceptionRAX: usize,
    pub ExceptionRCX: usize,
    pub ExceptionRIP: usize,
    pub ExceptionRFLAGS: usize,
    pub ExceptionRSP: usize,
}
import "golang.org/x/sys/windows"

type VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 struct {
	ExceptionCode uint32
	NumberParameters uint32
	ExceptionInformation [3]uintptr
	ExceptionRAX uintptr
	ExceptionRCX uintptr
	ExceptionRIP uintptr
	ExceptionRFLAGS uintptr
	ExceptionRSP uintptr
}
type
  VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 = record
    ExceptionCode: DWORD;
    NumberParameters: DWORD;
    ExceptionInformation: array[0..2] of NativeUInt;
    ExceptionRAX: NativeUInt;
    ExceptionRCX: NativeUInt;
    ExceptionRIP: NativeUInt;
    ExceptionRFLAGS: NativeUInt;
    ExceptionRSP: NativeUInt;
  end;
const VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 = extern struct {
    ExceptionCode: u32,
    NumberParameters: u32,
    ExceptionInformation: [3]usize,
    ExceptionRAX: usize,
    ExceptionRCX: usize,
    ExceptionRIP: usize,
    ExceptionRFLAGS: usize,
    ExceptionRSP: usize,
};
type
  VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 {.bycopy.} = object
    ExceptionCode: uint32
    NumberParameters: uint32
    ExceptionInformation: array[3, uint]
    ExceptionRAX: uint
    ExceptionRCX: uint
    ExceptionRIP: uint
    ExceptionRFLAGS: uint
    ExceptionRSP: uint
struct VBS_BASIC_ENCLAVE_EXCEPTION_AMD64
{
    uint ExceptionCode;
    uint NumberParameters;
    size_t[3] ExceptionInformation;
    size_t ExceptionRAX;
    size_t ExceptionRCX;
    size_t ExceptionRIP;
    size_t ExceptionRFLAGS;
    size_t ExceptionRSP;
}

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_EXCEPTION_AMD64 サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ExceptionCode : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NumberParameters : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ExceptionInformation : UINT_PTR (+8, 12byte)  varptr(st)+8 を基点に操作(12byte:入れ子/配列)
; ExceptionRAX : UINT_PTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ExceptionRCX : UINT_PTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ExceptionRIP : UINT_PTR (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ExceptionRFLAGS : UINT_PTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ExceptionRSP : UINT_PTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VBS_BASIC_ENCLAVE_EXCEPTION_AMD64 サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; ExceptionCode : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NumberParameters : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ExceptionInformation : UINT_PTR (+8, 24byte)  varptr(st)+8 を基点に操作(24byte:入れ子/配列)
; ExceptionRAX : UINT_PTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ExceptionRCX : UINT_PTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ExceptionRIP : UINT_PTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ExceptionRFLAGS : UINT_PTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ExceptionRSP : UINT_PTR (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VBS_BASIC_ENCLAVE_EXCEPTION_AMD64
    #field int ExceptionCode
    #field int NumberParameters
    #field intptr ExceptionInformation 3
    #field intptr ExceptionRAX
    #field intptr ExceptionRCX
    #field intptr ExceptionRIP
    #field intptr ExceptionRFLAGS
    #field intptr ExceptionRSP
#endstruct

stdim st, VBS_BASIC_ENCLAVE_EXCEPTION_AMD64        ; NSTRUCT 変数を確保
st->ExceptionCode = 100
mes "ExceptionCode=" + st->ExceptionCode