ホーム › System.Diagnostics.Debug › XSTATE_CONTEXT
XSTATE_CONTEXT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Mask | ULONGLONG | 8 | +0 | +0 | 有効な拡張状態(XSAVE)機能を示すビットマスク。 |
| Length | DWORD | 4 | +8 | +8 | XSAVE領域のバイト長。 |
| Flags | BYTE | 1 | +12 | +12 | コンテキスト取得/設定の動作を制御するフラグ。 |
| Reserved0 | BYTE | 3 | +13 | +13 | 予約バイト。 |
| Area | XSAVE_AREA* | 8/4 | +16 | +16 | XSAVE領域(XSAVE_AREA)へのポインタ。 |
| Reserved2 | DWORD | 4 | +24 | +20 | 予約フィールド(アラインメント用)。 |
| Buffer | void* | 8/4 | +32 | +24 | 拡張状態データ用バッファへのポインタ。 |
| Reserved3 | DWORD | 4 | +40 | +28 | 予約フィールド(アラインメント用)。 |
各言語での定義
#include <windows.h>
// XSTATE_CONTEXT (x64 48 / x86 32 バイト)
typedef struct XSTATE_CONTEXT {
ULONGLONG Mask;
DWORD Length;
BYTE Flags;
BYTE Reserved0[3];
XSAVE_AREA* Area;
DWORD Reserved2;
void* Buffer;
DWORD Reserved3;
} XSTATE_CONTEXT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XSTATE_CONTEXT
{
public ulong Mask;
public uint Length;
public byte Flags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
public IntPtr Area;
public uint Reserved2;
public IntPtr Buffer;
public uint Reserved3;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XSTATE_CONTEXT
Public Mask As ULong
Public Length As UInteger
Public Flags As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
Public Area As IntPtr
Public Reserved2 As UInteger
Public Buffer As IntPtr
Public Reserved3 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class XSTATE_CONTEXT(ctypes.Structure):
_fields_ = [
("Mask", ctypes.c_ulonglong),
("Length", wintypes.DWORD),
("Flags", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte * 3),
("Area", ctypes.c_void_p),
("Reserved2", wintypes.DWORD),
("Buffer", ctypes.c_void_p),
("Reserved3", wintypes.DWORD),
]#[repr(C)]
pub struct XSTATE_CONTEXT {
pub Mask: u64,
pub Length: u32,
pub Flags: u8,
pub Reserved0: [u8; 3],
pub Area: *mut core::ffi::c_void,
pub Reserved2: u32,
pub Buffer: *mut core::ffi::c_void,
pub Reserved3: u32,
}import "golang.org/x/sys/windows"
type XSTATE_CONTEXT struct {
Mask uint64
Length uint32
Flags byte
Reserved0 [3]byte
Area uintptr
Reserved2 uint32
Buffer uintptr
Reserved3 uint32
}type
XSTATE_CONTEXT = record
Mask: UInt64;
Length: DWORD;
Flags: Byte;
Reserved0: array[0..2] of Byte;
Area: Pointer;
Reserved2: DWORD;
Buffer: Pointer;
Reserved3: DWORD;
end;const XSTATE_CONTEXT = extern struct {
Mask: u64,
Length: u32,
Flags: u8,
Reserved0: [3]u8,
Area: ?*anyopaque,
Reserved2: u32,
Buffer: ?*anyopaque,
Reserved3: u32,
};type
XSTATE_CONTEXT {.bycopy.} = object
Mask: uint64
Length: uint32
Flags: uint8
Reserved0: array[3, uint8]
Area: pointer
Reserved2: uint32
Buffer: pointer
Reserved3: uint32struct XSTATE_CONTEXT
{
ulong Mask;
uint Length;
ubyte Flags;
ubyte[3] Reserved0;
void* Area;
uint Reserved2;
void* Buffer;
uint Reserved3;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; XSTATE_CONTEXT サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Mask : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Length : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Flags : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; Reserved0 : BYTE (+13, 3byte) varptr(st)+13 を基点に操作(3byte:入れ子/配列)
; Area : XSAVE_AREA* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; Reserved2 : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Buffer : void* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Reserved3 : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XSTATE_CONTEXT サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Mask : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Length : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Flags : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; Reserved0 : BYTE (+13, 3byte) varptr(st)+13 を基点に操作(3byte:入れ子/配列)
; Area : XSAVE_AREA* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; Reserved2 : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Buffer : void* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Reserved3 : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XSTATE_CONTEXT
#field int64 Mask
#field int Length
#field byte Flags
#field byte Reserved0 3
#field intptr Area
#field int Reserved2
#field intptr Buffer
#field int Reserved3
#endstruct
stdim st, XSTATE_CONTEXT ; NSTRUCT 変数を確保
st->Mask = 100
mes "Mask=" + st->Mask