ホーム › System.Diagnostics.Debug › DEBUG_EVENT
DEBUG_EVENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwDebugEventCode | DEBUG_EVENT_CODE | 4 | +0 | +0 | 発生したデバッグイベントの種別(DEBUG_EVENT_CODE)。 |
| dwProcessId | DWORD | 4 | +4 | +4 | イベントを発生させたプロセスのID。 |
| dwThreadId | DWORD | 4 | +8 | +8 | イベントを発生させたスレッドのID。 |
| u | _u_e__Union | 160/84 | +16 | +12 | イベント種別に応じた詳細情報を格納する無名共用体。 |
共用体: _u_e__Union x64 160B / x86 84B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Exception | EXCEPTION_DEBUG_INFO | 160/84 | +0 | +0 |
| CreateThread | CREATE_THREAD_DEBUG_INFO | 24/12 | +0 | +0 |
| CreateProcessInfo | CREATE_PROCESS_DEBUG_INFO | 72/40 | +0 | +0 |
| ExitThread | EXIT_THREAD_DEBUG_INFO | 4 | +0 | +0 |
| ExitProcess | EXIT_PROCESS_DEBUG_INFO | 4 | +0 | +0 |
| LoadDll | LOAD_DLL_DEBUG_INFO | 40/24 | +0 | +0 |
| UnloadDll | UNLOAD_DLL_DEBUG_INFO | 8/4 | +0 | +0 |
| DebugString | OUTPUT_DEBUG_STRING_INFO | 16/8 | +0 | +0 |
| RipInfo | RIP_INFO | 8 | +0 | +0 |
各言語での定義
#include <windows.h>
// DEBUG_EVENT (x64 176 / x86 96 バイト)
typedef struct DEBUG_EVENT {
DEBUG_EVENT_CODE dwDebugEventCode;
DWORD dwProcessId;
DWORD dwThreadId;
_u_e__Union u;
} DEBUG_EVENT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_EVENT
{
public uint dwDebugEventCode;
public uint dwProcessId;
public uint dwThreadId;
public _u_e__Union u;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_EVENT
Public dwDebugEventCode As UInteger
Public dwProcessId As UInteger
Public dwThreadId As UInteger
Public u As _u_e__Union
End Structureimport ctypes
from ctypes import wintypes
class DEBUG_EVENT(ctypes.Structure):
_fields_ = [
("dwDebugEventCode", wintypes.DWORD),
("dwProcessId", wintypes.DWORD),
("dwThreadId", wintypes.DWORD),
("u", _u_e__Union),
]#[repr(C)]
pub struct DEBUG_EVENT {
pub dwDebugEventCode: u32,
pub dwProcessId: u32,
pub dwThreadId: u32,
pub u: _u_e__Union,
}import "golang.org/x/sys/windows"
type DEBUG_EVENT struct {
dwDebugEventCode uint32
dwProcessId uint32
dwThreadId uint32
u _u_e__Union
}type
DEBUG_EVENT = record
dwDebugEventCode: DWORD;
dwProcessId: DWORD;
dwThreadId: DWORD;
u: _u_e__Union;
end;const DEBUG_EVENT = extern struct {
dwDebugEventCode: u32,
dwProcessId: u32,
dwThreadId: u32,
u: _u_e__Union,
};type
DEBUG_EVENT {.bycopy.} = object
dwDebugEventCode: uint32
dwProcessId: uint32
dwThreadId: uint32
u: _u_e__Unionstruct DEBUG_EVENT
{
uint dwDebugEventCode;
uint dwProcessId;
uint dwThreadId;
_u_e__Union u;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DEBUG_EVENT サイズ: 96 バイト(x86)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; dwDebugEventCode : DEBUG_EVENT_CODE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwProcessId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwThreadId : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; u : _u_e__Union (+12, 84byte) varptr(st)+12 を基点に操作(84byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEBUG_EVENT サイズ: 176 バイト(x64)
dim st, 44 ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; dwDebugEventCode : DEBUG_EVENT_CODE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwProcessId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwThreadId : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; u : _u_e__Union (+16, 160byte) varptr(st)+16 を基点に操作(160byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEBUG_EVENT
#field int dwDebugEventCode
#field int dwProcessId
#field int dwThreadId
#field byte u 160
#endstruct
stdim st, DEBUG_EVENT ; NSTRUCT 変数を確保
st->dwDebugEventCode = 100
mes "dwDebugEventCode=" + st->dwDebugEventCode
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。