ホーム › System.Diagnostics.Debug.Extensions › DEBUG_LAST_EVENT_INFO_EXCEPTION
DEBUG_LAST_EVENT_INFO_EXCEPTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ExceptionRecord | EXCEPTION_RECORD64 | 152 | +0 | +0 | 発生した例外の詳細を保持するEXCEPTION_RECORD64。 |
| FirstChance | DWORD | 4 | +152 | +152 | 第一機会例外かを示すフラグ(非0で第一機会)。 |
各言語での定義
#include <windows.h>
// EXCEPTION_RECORD64 (x64 152 / x86 152 バイト)
typedef struct EXCEPTION_RECORD64 {
NTSTATUS ExceptionCode;
DWORD ExceptionFlags;
ULONGLONG ExceptionRecord;
ULONGLONG ExceptionAddress;
DWORD NumberParameters;
DWORD __unusedAlignment;
ULONGLONG ExceptionInformation[15];
} EXCEPTION_RECORD64;
// DEBUG_LAST_EVENT_INFO_EXCEPTION (x64 160 / x86 160 バイト)
typedef struct DEBUG_LAST_EVENT_INFO_EXCEPTION {
EXCEPTION_RECORD64 ExceptionRecord;
DWORD FirstChance;
} DEBUG_LAST_EVENT_INFO_EXCEPTION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPTION_RECORD64
{
public int ExceptionCode;
public uint ExceptionFlags;
public ulong ExceptionRecord;
public ulong ExceptionAddress;
public uint NumberParameters;
public uint __unusedAlignment;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public ulong[] ExceptionInformation;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_LAST_EVENT_INFO_EXCEPTION
{
public EXCEPTION_RECORD64 ExceptionRecord;
public uint FirstChance;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPTION_RECORD64
Public ExceptionCode As Integer
Public ExceptionFlags As UInteger
Public ExceptionRecord As ULong
Public ExceptionAddress As ULong
Public NumberParameters As UInteger
Public __unusedAlignment As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=15)> Public ExceptionInformation() As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_LAST_EVENT_INFO_EXCEPTION
Public ExceptionRecord As EXCEPTION_RECORD64
Public FirstChance As UInteger
End Structureimport ctypes
from ctypes import wintypes
class EXCEPTION_RECORD64(ctypes.Structure):
_fields_ = [
("ExceptionCode", ctypes.c_int),
("ExceptionFlags", wintypes.DWORD),
("ExceptionRecord", ctypes.c_ulonglong),
("ExceptionAddress", ctypes.c_ulonglong),
("NumberParameters", wintypes.DWORD),
("__unusedAlignment", wintypes.DWORD),
("ExceptionInformation", ctypes.c_ulonglong * 15),
]
class DEBUG_LAST_EVENT_INFO_EXCEPTION(ctypes.Structure):
_fields_ = [
("ExceptionRecord", EXCEPTION_RECORD64),
("FirstChance", wintypes.DWORD),
]#[repr(C)]
pub struct EXCEPTION_RECORD64 {
pub ExceptionCode: i32,
pub ExceptionFlags: u32,
pub ExceptionRecord: u64,
pub ExceptionAddress: u64,
pub NumberParameters: u32,
pub __unusedAlignment: u32,
pub ExceptionInformation: [u64; 15],
}
#[repr(C)]
pub struct DEBUG_LAST_EVENT_INFO_EXCEPTION {
pub ExceptionRecord: EXCEPTION_RECORD64,
pub FirstChance: u32,
}import "golang.org/x/sys/windows"
type EXCEPTION_RECORD64 struct {
ExceptionCode int32
ExceptionFlags uint32
ExceptionRecord uint64
ExceptionAddress uint64
NumberParameters uint32
__unusedAlignment uint32
ExceptionInformation [15]uint64
}
type DEBUG_LAST_EVENT_INFO_EXCEPTION struct {
ExceptionRecord EXCEPTION_RECORD64
FirstChance uint32
}type
EXCEPTION_RECORD64 = record
ExceptionCode: Integer;
ExceptionFlags: DWORD;
ExceptionRecord: UInt64;
ExceptionAddress: UInt64;
NumberParameters: DWORD;
__unusedAlignment: DWORD;
ExceptionInformation: array[0..14] of UInt64;
end;
DEBUG_LAST_EVENT_INFO_EXCEPTION = record
ExceptionRecord: EXCEPTION_RECORD64;
FirstChance: DWORD;
end;const EXCEPTION_RECORD64 = extern struct {
ExceptionCode: i32,
ExceptionFlags: u32,
ExceptionRecord: u64,
ExceptionAddress: u64,
NumberParameters: u32,
__unusedAlignment: u32,
ExceptionInformation: [15]u64,
};
const DEBUG_LAST_EVENT_INFO_EXCEPTION = extern struct {
ExceptionRecord: EXCEPTION_RECORD64,
FirstChance: u32,
};type
EXCEPTION_RECORD64 {.bycopy.} = object
ExceptionCode: int32
ExceptionFlags: uint32
ExceptionRecord: uint64
ExceptionAddress: uint64
NumberParameters: uint32
__unusedAlignment: uint32
ExceptionInformation: array[15, uint64]
DEBUG_LAST_EVENT_INFO_EXCEPTION {.bycopy.} = object
ExceptionRecord: EXCEPTION_RECORD64
FirstChance: uint32struct EXCEPTION_RECORD64
{
int ExceptionCode;
uint ExceptionFlags;
ulong ExceptionRecord;
ulong ExceptionAddress;
uint NumberParameters;
uint __unusedAlignment;
ulong[15] ExceptionInformation;
}
struct DEBUG_LAST_EVENT_INFO_EXCEPTION
{
EXCEPTION_RECORD64 ExceptionRecord;
uint FirstChance;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEBUG_LAST_EVENT_INFO_EXCEPTION サイズ: 160 バイト(x64)
dim st, 40 ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; ExceptionRecord : EXCEPTION_RECORD64 (+0, 152byte) varptr(st)+0 を基点に操作(152byte:入れ子/配列)
; FirstChance : DWORD (+152, 4byte) st.38 = 値 / 値 = st.38 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global EXCEPTION_RECORD64
#field int ExceptionCode
#field int ExceptionFlags
#field int64 ExceptionRecord
#field int64 ExceptionAddress
#field int NumberParameters
#field int __unusedAlignment
#field int64 ExceptionInformation 15
#endstruct
#defstruct global DEBUG_LAST_EVENT_INFO_EXCEPTION
#field EXCEPTION_RECORD64 ExceptionRecord
#field int FirstChance
#endstruct
stdim st, DEBUG_LAST_EVENT_INFO_EXCEPTION ; NSTRUCT 変数を確保
st->FirstChance = 100
mes "FirstChance=" + st->FirstChance