ホーム › System.Diagnostics.Debug › KDHELP
KDHELP
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Thread | DWORD | 4 | +0 | +0 | 現在のスレッドを表すアドレス値(32ビット)を示す。 |
| ThCallbackStack | DWORD | 4 | +4 | +4 | スレッド内のコールバックスタックフィールドへのオフセットを示す。 |
| NextCallback | DWORD | 4 | +8 | +8 | 次のコールバックフレームへのオフセットを示す。 |
| FramePointer | DWORD | 4 | +12 | +12 | コールバックフレームのフレームポインタへのオフセットを示す。 |
| KiCallUserMode | DWORD | 4 | +16 | +16 | KiCallUserMode 関数のアドレスを示す。 |
| KeUserCallbackDispatcher | DWORD | 4 | +20 | +20 | KeUserCallbackDispatcher 関数のアドレスを示す。 |
| SystemRangeStart | DWORD | 4 | +24 | +24 | ユーザー空間とシステム空間の境界開始アドレスを示す。 |
| ThCallbackBStore | DWORD | 4 | +28 | +28 | スレッド内のコールバックバッキングストアへのオフセットを示す。 |
| KiUserExceptionDispatcher | DWORD | 4 | +32 | +32 | KiUserExceptionDispatcher 関数のアドレスを示す。 |
| StackBase | DWORD | 4 | +36 | +36 | スタックの底アドレスを示す。 |
| StackLimit | DWORD | 4 | +40 | +40 | スタックの上限アドレスを示す。 |
| Reserved | DWORD | 20 | +44 | +44 | 予約フィールド。使用しない。 |
各言語での定義
#include <windows.h>
// KDHELP (x64 64 / x86 64 バイト)
typedef struct KDHELP {
DWORD Thread;
DWORD ThCallbackStack;
DWORD NextCallback;
DWORD FramePointer;
DWORD KiCallUserMode;
DWORD KeUserCallbackDispatcher;
DWORD SystemRangeStart;
DWORD ThCallbackBStore;
DWORD KiUserExceptionDispatcher;
DWORD StackBase;
DWORD StackLimit;
DWORD Reserved[5];
} KDHELP;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KDHELP
{
public uint Thread;
public uint ThCallbackStack;
public uint NextCallback;
public uint FramePointer;
public uint KiCallUserMode;
public uint KeUserCallbackDispatcher;
public uint SystemRangeStart;
public uint ThCallbackBStore;
public uint KiUserExceptionDispatcher;
public uint StackBase;
public uint StackLimit;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KDHELP
Public Thread As UInteger
Public ThCallbackStack As UInteger
Public NextCallback As UInteger
Public FramePointer As UInteger
Public KiCallUserMode As UInteger
Public KeUserCallbackDispatcher As UInteger
Public SystemRangeStart As UInteger
Public ThCallbackBStore As UInteger
Public KiUserExceptionDispatcher As UInteger
Public StackBase As UInteger
Public StackLimit As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public Reserved() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class KDHELP(ctypes.Structure):
_fields_ = [
("Thread", wintypes.DWORD),
("ThCallbackStack", wintypes.DWORD),
("NextCallback", wintypes.DWORD),
("FramePointer", wintypes.DWORD),
("KiCallUserMode", wintypes.DWORD),
("KeUserCallbackDispatcher", wintypes.DWORD),
("SystemRangeStart", wintypes.DWORD),
("ThCallbackBStore", wintypes.DWORD),
("KiUserExceptionDispatcher", wintypes.DWORD),
("StackBase", wintypes.DWORD),
("StackLimit", wintypes.DWORD),
("Reserved", wintypes.DWORD * 5),
]#[repr(C)]
pub struct KDHELP {
pub Thread: u32,
pub ThCallbackStack: u32,
pub NextCallback: u32,
pub FramePointer: u32,
pub KiCallUserMode: u32,
pub KeUserCallbackDispatcher: u32,
pub SystemRangeStart: u32,
pub ThCallbackBStore: u32,
pub KiUserExceptionDispatcher: u32,
pub StackBase: u32,
pub StackLimit: u32,
pub Reserved: [u32; 5],
}import "golang.org/x/sys/windows"
type KDHELP struct {
Thread uint32
ThCallbackStack uint32
NextCallback uint32
FramePointer uint32
KiCallUserMode uint32
KeUserCallbackDispatcher uint32
SystemRangeStart uint32
ThCallbackBStore uint32
KiUserExceptionDispatcher uint32
StackBase uint32
StackLimit uint32
Reserved [5]uint32
}type
KDHELP = record
Thread: DWORD;
ThCallbackStack: DWORD;
NextCallback: DWORD;
FramePointer: DWORD;
KiCallUserMode: DWORD;
KeUserCallbackDispatcher: DWORD;
SystemRangeStart: DWORD;
ThCallbackBStore: DWORD;
KiUserExceptionDispatcher: DWORD;
StackBase: DWORD;
StackLimit: DWORD;
Reserved: array[0..4] of DWORD;
end;const KDHELP = extern struct {
Thread: u32,
ThCallbackStack: u32,
NextCallback: u32,
FramePointer: u32,
KiCallUserMode: u32,
KeUserCallbackDispatcher: u32,
SystemRangeStart: u32,
ThCallbackBStore: u32,
KiUserExceptionDispatcher: u32,
StackBase: u32,
StackLimit: u32,
Reserved: [5]u32,
};type
KDHELP {.bycopy.} = object
Thread: uint32
ThCallbackStack: uint32
NextCallback: uint32
FramePointer: uint32
KiCallUserMode: uint32
KeUserCallbackDispatcher: uint32
SystemRangeStart: uint32
ThCallbackBStore: uint32
KiUserExceptionDispatcher: uint32
StackBase: uint32
StackLimit: uint32
Reserved: array[5, uint32]struct KDHELP
{
uint Thread;
uint ThCallbackStack;
uint NextCallback;
uint FramePointer;
uint KiCallUserMode;
uint KeUserCallbackDispatcher;
uint SystemRangeStart;
uint ThCallbackBStore;
uint KiUserExceptionDispatcher;
uint StackBase;
uint StackLimit;
uint[5] Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KDHELP サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Thread : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ThCallbackStack : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; NextCallback : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; FramePointer : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; KiCallUserMode : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; KeUserCallbackDispatcher : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SystemRangeStart : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ThCallbackBStore : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; KiUserExceptionDispatcher : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; StackBase : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; StackLimit : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; Reserved : DWORD (+44, 20byte) varptr(st)+44 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KDHELP
#field int Thread
#field int ThCallbackStack
#field int NextCallback
#field int FramePointer
#field int KiCallUserMode
#field int KeUserCallbackDispatcher
#field int SystemRangeStart
#field int ThCallbackBStore
#field int KiUserExceptionDispatcher
#field int StackBase
#field int StackLimit
#field int Reserved 5
#endstruct
stdim st, KDHELP ; NSTRUCT 変数を確保
st->Thread = 100
mes "Thread=" + st->Thread