ホーム › System.Diagnostics.Debug › MINIDUMP_THREAD_EX
MINIDUMP_THREAD_EX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ThreadId | DWORD | 4 | +0 | +0 | スレッドの識別子(TID)。 |
| SuspendCount | DWORD | 4 | +4 | +4 | スレッドの中断カウント。 |
| PriorityClass | DWORD | 4 | +8 | +8 | スレッドの優先度クラス。 |
| Priority | DWORD | 4 | +12 | +12 | スレッドの優先度。 |
| Teb | ULONGLONG | 8 | +16 | +16 | スレッド環境ブロック(TEB)のアドレス。 |
| Stack | MINIDUMP_MEMORY_DESCRIPTOR | 16 | +24 | +24 | スレッドスタックのメモリ記述子。 |
| ThreadContext | MINIDUMP_LOCATION_DESCRIPTOR | 8 | +40 | +40 | スレッドのCONTEXTのダンプ内位置。 |
| BackingStore | MINIDUMP_MEMORY_DESCRIPTOR | 16 | +48 | +48 | バッキングストアのメモリ記述子(IA64等)。 |
各言語での定義
#include <windows.h>
// MINIDUMP_LOCATION_DESCRIPTOR (x64 8 / x86 8 バイト)
#pragma pack(push, 4)
typedef struct MINIDUMP_LOCATION_DESCRIPTOR {
DWORD DataSize;
DWORD Rva;
} MINIDUMP_LOCATION_DESCRIPTOR;
#pragma pack(pop)
// MINIDUMP_MEMORY_DESCRIPTOR (x64 16 / x86 16 バイト)
#pragma pack(push, 4)
typedef struct MINIDUMP_MEMORY_DESCRIPTOR {
ULONGLONG StartOfMemoryRange;
MINIDUMP_LOCATION_DESCRIPTOR Memory;
} MINIDUMP_MEMORY_DESCRIPTOR;
#pragma pack(pop)
// MINIDUMP_THREAD_EX (x64 64 / x86 64 バイト)
#pragma pack(push, 4)
typedef struct MINIDUMP_THREAD_EX {
DWORD ThreadId;
DWORD SuspendCount;
DWORD PriorityClass;
DWORD Priority;
ULONGLONG Teb;
MINIDUMP_MEMORY_DESCRIPTOR Stack;
MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
MINIDUMP_MEMORY_DESCRIPTOR BackingStore;
} MINIDUMP_THREAD_EX;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct MINIDUMP_LOCATION_DESCRIPTOR
{
public uint DataSize;
public uint Rva;
}
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct MINIDUMP_MEMORY_DESCRIPTOR
{
public ulong StartOfMemoryRange;
public MINIDUMP_LOCATION_DESCRIPTOR Memory;
}
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct MINIDUMP_THREAD_EX
{
public uint ThreadId;
public uint SuspendCount;
public uint PriorityClass;
public uint Priority;
public ulong Teb;
public MINIDUMP_MEMORY_DESCRIPTOR Stack;
public MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
public MINIDUMP_MEMORY_DESCRIPTOR BackingStore;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure MINIDUMP_LOCATION_DESCRIPTOR
Public DataSize As UInteger
Public Rva As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure MINIDUMP_MEMORY_DESCRIPTOR
Public StartOfMemoryRange As ULong
Public Memory As MINIDUMP_LOCATION_DESCRIPTOR
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure MINIDUMP_THREAD_EX
Public ThreadId As UInteger
Public SuspendCount As UInteger
Public PriorityClass As UInteger
Public Priority As UInteger
Public Teb As ULong
Public Stack As MINIDUMP_MEMORY_DESCRIPTOR
Public ThreadContext As MINIDUMP_LOCATION_DESCRIPTOR
Public BackingStore As MINIDUMP_MEMORY_DESCRIPTOR
End Structureimport ctypes
from ctypes import wintypes
class MINIDUMP_LOCATION_DESCRIPTOR(ctypes.Structure):
_pack_ = 4
_fields_ = [
("DataSize", wintypes.DWORD),
("Rva", wintypes.DWORD),
]
class MINIDUMP_MEMORY_DESCRIPTOR(ctypes.Structure):
_pack_ = 4
_fields_ = [
("StartOfMemoryRange", ctypes.c_ulonglong),
("Memory", MINIDUMP_LOCATION_DESCRIPTOR),
]
class MINIDUMP_THREAD_EX(ctypes.Structure):
_pack_ = 4
_fields_ = [
("ThreadId", wintypes.DWORD),
("SuspendCount", wintypes.DWORD),
("PriorityClass", wintypes.DWORD),
("Priority", wintypes.DWORD),
("Teb", ctypes.c_ulonglong),
("Stack", MINIDUMP_MEMORY_DESCRIPTOR),
("ThreadContext", MINIDUMP_LOCATION_DESCRIPTOR),
("BackingStore", MINIDUMP_MEMORY_DESCRIPTOR),
]#[repr(C, packed(4))]
pub struct MINIDUMP_LOCATION_DESCRIPTOR {
pub DataSize: u32,
pub Rva: u32,
}
#[repr(C, packed(4))]
pub struct MINIDUMP_MEMORY_DESCRIPTOR {
pub StartOfMemoryRange: u64,
pub Memory: MINIDUMP_LOCATION_DESCRIPTOR,
}
#[repr(C, packed(4))]
pub struct MINIDUMP_THREAD_EX {
pub ThreadId: u32,
pub SuspendCount: u32,
pub PriorityClass: u32,
pub Priority: u32,
pub Teb: u64,
pub Stack: MINIDUMP_MEMORY_DESCRIPTOR,
pub ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR,
pub BackingStore: MINIDUMP_MEMORY_DESCRIPTOR,
}import "golang.org/x/sys/windows"
type MINIDUMP_LOCATION_DESCRIPTOR struct {
DataSize uint32
Rva uint32
}
type MINIDUMP_MEMORY_DESCRIPTOR struct {
StartOfMemoryRange uint64
Memory MINIDUMP_LOCATION_DESCRIPTOR
}
type MINIDUMP_THREAD_EX struct {
ThreadId uint32
SuspendCount uint32
PriorityClass uint32
Priority uint32
Teb uint64
Stack MINIDUMP_MEMORY_DESCRIPTOR
ThreadContext MINIDUMP_LOCATION_DESCRIPTOR
BackingStore MINIDUMP_MEMORY_DESCRIPTOR
}type
MINIDUMP_LOCATION_DESCRIPTOR = packed record
DataSize: DWORD;
Rva: DWORD;
end;
MINIDUMP_MEMORY_DESCRIPTOR = packed record
StartOfMemoryRange: UInt64;
Memory: MINIDUMP_LOCATION_DESCRIPTOR;
end;
MINIDUMP_THREAD_EX = packed record
ThreadId: DWORD;
SuspendCount: DWORD;
PriorityClass: DWORD;
Priority: DWORD;
Teb: UInt64;
Stack: MINIDUMP_MEMORY_DESCRIPTOR;
ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR;
BackingStore: MINIDUMP_MEMORY_DESCRIPTOR;
end;const MINIDUMP_LOCATION_DESCRIPTOR = extern struct {
DataSize: u32,
Rva: u32,
};
const MINIDUMP_MEMORY_DESCRIPTOR = extern struct {
StartOfMemoryRange: u64,
Memory: MINIDUMP_LOCATION_DESCRIPTOR,
};
const MINIDUMP_THREAD_EX = extern struct {
ThreadId: u32,
SuspendCount: u32,
PriorityClass: u32,
Priority: u32,
Teb: u64,
Stack: MINIDUMP_MEMORY_DESCRIPTOR,
ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR,
BackingStore: MINIDUMP_MEMORY_DESCRIPTOR,
};type
MINIDUMP_LOCATION_DESCRIPTOR {.packed.} = object
DataSize: uint32
Rva: uint32
MINIDUMP_MEMORY_DESCRIPTOR {.packed.} = object
StartOfMemoryRange: uint64
Memory: MINIDUMP_LOCATION_DESCRIPTOR
MINIDUMP_THREAD_EX {.packed.} = object
ThreadId: uint32
SuspendCount: uint32
PriorityClass: uint32
Priority: uint32
Teb: uint64
Stack: MINIDUMP_MEMORY_DESCRIPTOR
ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR
BackingStore: MINIDUMP_MEMORY_DESCRIPTORalign(4)
struct MINIDUMP_LOCATION_DESCRIPTOR
{
uint DataSize;
uint Rva;
}
align(4)
struct MINIDUMP_MEMORY_DESCRIPTOR
{
ulong StartOfMemoryRange;
MINIDUMP_LOCATION_DESCRIPTOR Memory;
}
align(4)
struct MINIDUMP_THREAD_EX
{
uint ThreadId;
uint SuspendCount;
uint PriorityClass;
uint Priority;
ulong Teb;
MINIDUMP_MEMORY_DESCRIPTOR Stack;
MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
MINIDUMP_MEMORY_DESCRIPTOR BackingStore;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MINIDUMP_THREAD_EX サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; ThreadId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SuspendCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PriorityClass : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Priority : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Teb : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Stack : MINIDUMP_MEMORY_DESCRIPTOR (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ThreadContext : MINIDUMP_LOCATION_DESCRIPTOR (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; BackingStore : MINIDUMP_MEMORY_DESCRIPTOR (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MINIDUMP_LOCATION_DESCRIPTOR, pack=4
#field int DataSize
#field int Rva
#endstruct
#defstruct global MINIDUMP_MEMORY_DESCRIPTOR, pack=4
#field int64 StartOfMemoryRange
#field MINIDUMP_LOCATION_DESCRIPTOR Memory
#endstruct
#defstruct global MINIDUMP_THREAD_EX, pack=4
#field int ThreadId
#field int SuspendCount
#field int PriorityClass
#field int Priority
#field int64 Teb
#field MINIDUMP_MEMORY_DESCRIPTOR Stack
#field MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
#field MINIDUMP_MEMORY_DESCRIPTOR BackingStore
#endstruct
stdim st, MINIDUMP_THREAD_EX ; NSTRUCT 変数を確保
st->ThreadId = 100
mes "ThreadId=" + st->ThreadId