ホーム › System.Diagnostics.Debug › EXCEPTION_DEBUG_INFO
EXCEPTION_DEBUG_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ExceptionRecord | EXCEPTION_RECORD | 152/80 | +0 | +0 | 発生した例外の詳細を保持するEXCEPTION_RECORD。 |
| dwFirstChance | DWORD | 4 | +152 | +80 | 初回チャンス例外なら非0、二回目チャンスなら0。 |
各言語での定義
#include <windows.h>
// EXCEPTION_RECORD (x64 152 / x86 80 バイト)
typedef struct EXCEPTION_RECORD {
NTSTATUS ExceptionCode;
DWORD ExceptionFlags;
EXCEPTION_RECORD* ExceptionRecord;
void* ExceptionAddress;
DWORD NumberParameters;
UINT_PTR ExceptionInformation[15];
} EXCEPTION_RECORD;
// EXCEPTION_DEBUG_INFO (x64 160 / x86 84 バイト)
typedef struct EXCEPTION_DEBUG_INFO {
EXCEPTION_RECORD ExceptionRecord;
DWORD dwFirstChance;
} EXCEPTION_DEBUG_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPTION_RECORD
{
public int ExceptionCode;
public uint ExceptionFlags;
public IntPtr ExceptionRecord;
public IntPtr ExceptionAddress;
public uint NumberParameters;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public UIntPtr[] ExceptionInformation;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPTION_DEBUG_INFO
{
public EXCEPTION_RECORD ExceptionRecord;
public uint dwFirstChance;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPTION_RECORD
Public ExceptionCode As Integer
Public ExceptionFlags As UInteger
Public ExceptionRecord As IntPtr
Public ExceptionAddress As IntPtr
Public NumberParameters As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=15)> Public ExceptionInformation() As UIntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPTION_DEBUG_INFO
Public ExceptionRecord As EXCEPTION_RECORD
Public dwFirstChance As UInteger
End Structureimport ctypes
from ctypes import wintypes
class EXCEPTION_RECORD(ctypes.Structure):
_fields_ = [
("ExceptionCode", ctypes.c_int),
("ExceptionFlags", wintypes.DWORD),
("ExceptionRecord", ctypes.c_void_p),
("ExceptionAddress", ctypes.c_void_p),
("NumberParameters", wintypes.DWORD),
("ExceptionInformation", ctypes.c_size_t * 15),
]
class EXCEPTION_DEBUG_INFO(ctypes.Structure):
_fields_ = [
("ExceptionRecord", EXCEPTION_RECORD),
("dwFirstChance", wintypes.DWORD),
]#[repr(C)]
pub struct EXCEPTION_RECORD {
pub ExceptionCode: i32,
pub ExceptionFlags: u32,
pub ExceptionRecord: *mut core::ffi::c_void,
pub ExceptionAddress: *mut core::ffi::c_void,
pub NumberParameters: u32,
pub ExceptionInformation: [usize; 15],
}
#[repr(C)]
pub struct EXCEPTION_DEBUG_INFO {
pub ExceptionRecord: EXCEPTION_RECORD,
pub dwFirstChance: u32,
}import "golang.org/x/sys/windows"
type EXCEPTION_RECORD struct {
ExceptionCode int32
ExceptionFlags uint32
ExceptionRecord uintptr
ExceptionAddress uintptr
NumberParameters uint32
ExceptionInformation [15]uintptr
}
type EXCEPTION_DEBUG_INFO struct {
ExceptionRecord EXCEPTION_RECORD
dwFirstChance uint32
}type
EXCEPTION_RECORD = record
ExceptionCode: Integer;
ExceptionFlags: DWORD;
ExceptionRecord: Pointer;
ExceptionAddress: Pointer;
NumberParameters: DWORD;
ExceptionInformation: array[0..14] of NativeUInt;
end;
EXCEPTION_DEBUG_INFO = record
ExceptionRecord: EXCEPTION_RECORD;
dwFirstChance: DWORD;
end;const EXCEPTION_RECORD = extern struct {
ExceptionCode: i32,
ExceptionFlags: u32,
ExceptionRecord: ?*anyopaque,
ExceptionAddress: ?*anyopaque,
NumberParameters: u32,
ExceptionInformation: [15]usize,
};
const EXCEPTION_DEBUG_INFO = extern struct {
ExceptionRecord: EXCEPTION_RECORD,
dwFirstChance: u32,
};type
EXCEPTION_RECORD {.bycopy.} = object
ExceptionCode: int32
ExceptionFlags: uint32
ExceptionRecord: pointer
ExceptionAddress: pointer
NumberParameters: uint32
ExceptionInformation: array[15, uint]
EXCEPTION_DEBUG_INFO {.bycopy.} = object
ExceptionRecord: EXCEPTION_RECORD
dwFirstChance: uint32struct EXCEPTION_RECORD
{
int ExceptionCode;
uint ExceptionFlags;
void* ExceptionRecord;
void* ExceptionAddress;
uint NumberParameters;
size_t[15] ExceptionInformation;
}
struct EXCEPTION_DEBUG_INFO
{
EXCEPTION_RECORD ExceptionRecord;
uint dwFirstChance;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; EXCEPTION_DEBUG_INFO サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; ExceptionRecord : EXCEPTION_RECORD (+0, 80byte) varptr(st)+0 を基点に操作(80byte:入れ子/配列)
; dwFirstChance : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EXCEPTION_DEBUG_INFO サイズ: 160 バイト(x64)
dim st, 40 ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; ExceptionRecord : EXCEPTION_RECORD (+0, 152byte) varptr(st)+0 を基点に操作(152byte:入れ子/配列)
; dwFirstChance : 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_RECORD
#field int ExceptionCode
#field int ExceptionFlags
#field intptr ExceptionRecord
#field intptr ExceptionAddress
#field int NumberParameters
#field intptr ExceptionInformation 15
#endstruct
#defstruct global EXCEPTION_DEBUG_INFO
#field EXCEPTION_RECORD ExceptionRecord
#field int dwFirstChance
#endstruct
stdim st, EXCEPTION_DEBUG_INFO ; NSTRUCT 変数を確保
st->dwFirstChance = 100
mes "dwFirstChance=" + st->dwFirstChance