Win32 API 日本語リファレンス
ホームSystem.SystemServices › NT_TIB32

NT_TIB32

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ExceptionListDWORD4+0+0現在の例外登録レコードチェーンの先頭アドレス(32ビット)。
StackBaseDWORD4+4+4スタックの基底(上限)アドレス。
StackLimitDWORD4+8+8スタックの下限アドレス。
SubSystemTibDWORD4+12+12サブシステム固有のTIBへのポインタ。
Anonymous_Anonymous_e__Union4+16+16FiberDataまたはバージョン情報を保持する無名共用体。
ArbitraryUserPointerDWORD4+20+20ユーザーが任意用途に使えるポインタ。
SelfDWORD4+24+24このTIB構造体自身を指す自己参照ポインタ。

共用体: _Anonymous_e__Union x64 4B / x86 4B

フィールドサイズx64x86
FiberDataDWORD4+0+0
VersionDWORD4+0+0

各言語での定義

#include <windows.h>

// NT_TIB32  (x64 28 / x86 28 バイト)
typedef struct NT_TIB32 {
    DWORD ExceptionList;
    DWORD StackBase;
    DWORD StackLimit;
    DWORD SubSystemTib;
    _Anonymous_e__Union Anonymous;
    DWORD ArbitraryUserPointer;
    DWORD Self;
} NT_TIB32;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NT_TIB32
{
    public uint ExceptionList;
    public uint StackBase;
    public uint StackLimit;
    public uint SubSystemTib;
    public _Anonymous_e__Union Anonymous;
    public uint ArbitraryUserPointer;
    public uint Self;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NT_TIB32
    Public ExceptionList As UInteger
    Public StackBase As UInteger
    Public StackLimit As UInteger
    Public SubSystemTib As UInteger
    Public Anonymous As _Anonymous_e__Union
    Public ArbitraryUserPointer As UInteger
    Public Self As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NT_TIB32(ctypes.Structure):
    _fields_ = [
        ("ExceptionList", wintypes.DWORD),
        ("StackBase", wintypes.DWORD),
        ("StackLimit", wintypes.DWORD),
        ("SubSystemTib", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("ArbitraryUserPointer", wintypes.DWORD),
        ("Self", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NT_TIB32 {
    pub ExceptionList: u32,
    pub StackBase: u32,
    pub StackLimit: u32,
    pub SubSystemTib: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub ArbitraryUserPointer: u32,
    pub Self: u32,
}
import "golang.org/x/sys/windows"

type NT_TIB32 struct {
	ExceptionList uint32
	StackBase uint32
	StackLimit uint32
	SubSystemTib uint32
	Anonymous _Anonymous_e__Union
	ArbitraryUserPointer uint32
	Self uint32
}
type
  NT_TIB32 = record
    ExceptionList: DWORD;
    StackBase: DWORD;
    StackLimit: DWORD;
    SubSystemTib: DWORD;
    Anonymous: _Anonymous_e__Union;
    ArbitraryUserPointer: DWORD;
    Self: DWORD;
  end;
const NT_TIB32 = extern struct {
    ExceptionList: u32,
    StackBase: u32,
    StackLimit: u32,
    SubSystemTib: u32,
    Anonymous: _Anonymous_e__Union,
    ArbitraryUserPointer: u32,
    Self: u32,
};
type
  NT_TIB32 {.bycopy.} = object
    ExceptionList: uint32
    StackBase: uint32
    StackLimit: uint32
    SubSystemTib: uint32
    Anonymous: _Anonymous_e__Union
    ArbitraryUserPointer: uint32
    Self: uint32
struct NT_TIB32
{
    uint ExceptionList;
    uint StackBase;
    uint StackLimit;
    uint SubSystemTib;
    _Anonymous_e__Union Anonymous;
    uint ArbitraryUserPointer;
    uint Self;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NT_TIB32 サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; ExceptionList : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; StackBase : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; StackLimit : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SubSystemTib : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ArbitraryUserPointer : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Self : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NT_TIB32
    #field int ExceptionList
    #field int StackBase
    #field int StackLimit
    #field int SubSystemTib
    #field byte Anonymous 4
    #field int ArbitraryUserPointer
    #field int Self
#endstruct

stdim st, NT_TIB32        ; NSTRUCT 変数を確保
st->ExceptionList = 100
mes "ExceptionList=" + st->ExceptionList
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。