ホーム › System.Diagnostics.Debug.Extensions › DEBUG_DECODE_ERROR
DEBUG_DECODE_ERROR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SizeOfStruct | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| Code | DWORD | 4 | +4 | +4 | デコード対象のエラーコードまたはステータス値。 |
| TreatAsStatus | BOOL | 4 | +8 | +8 | CodeをNTSTATUSとして扱うかを示すBOOL。非0でステータス扱い。 |
| Source | CHAR | 64 | +12 | +12 | エラーの発生源を表すNULL終端文字列。 |
| Message | CHAR | 260 | +76 | +76 | エラーを説明する文字列。 |
各言語での定義
#include <windows.h>
// DEBUG_DECODE_ERROR (x64 336 / x86 336 バイト)
typedef struct DEBUG_DECODE_ERROR {
DWORD SizeOfStruct;
DWORD Code;
BOOL TreatAsStatus;
CHAR Source[64];
CHAR Message[260];
} DEBUG_DECODE_ERROR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_DECODE_ERROR
{
public uint SizeOfStruct;
public uint Code;
[MarshalAs(UnmanagedType.Bool)] public bool TreatAsStatus;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public sbyte[] Source;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public sbyte[] Message;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_DECODE_ERROR
Public SizeOfStruct As UInteger
Public Code As UInteger
<MarshalAs(UnmanagedType.Bool)> Public TreatAsStatus As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public Source() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> Public Message() As SByte
End Structureimport ctypes
from ctypes import wintypes
class DEBUG_DECODE_ERROR(ctypes.Structure):
_fields_ = [
("SizeOfStruct", wintypes.DWORD),
("Code", wintypes.DWORD),
("TreatAsStatus", wintypes.BOOL),
("Source", ctypes.c_byte * 64),
("Message", ctypes.c_byte * 260),
]#[repr(C)]
pub struct DEBUG_DECODE_ERROR {
pub SizeOfStruct: u32,
pub Code: u32,
pub TreatAsStatus: i32,
pub Source: [i8; 64],
pub Message: [i8; 260],
}import "golang.org/x/sys/windows"
type DEBUG_DECODE_ERROR struct {
SizeOfStruct uint32
Code uint32
TreatAsStatus int32
Source [64]int8
Message [260]int8
}type
DEBUG_DECODE_ERROR = record
SizeOfStruct: DWORD;
Code: DWORD;
TreatAsStatus: BOOL;
Source: array[0..63] of Shortint;
Message: array[0..259] of Shortint;
end;const DEBUG_DECODE_ERROR = extern struct {
SizeOfStruct: u32,
Code: u32,
TreatAsStatus: i32,
Source: [64]i8,
Message: [260]i8,
};type
DEBUG_DECODE_ERROR {.bycopy.} = object
SizeOfStruct: uint32
Code: uint32
TreatAsStatus: int32
Source: array[64, int8]
Message: array[260, int8]struct DEBUG_DECODE_ERROR
{
uint SizeOfStruct;
uint Code;
int TreatAsStatus;
byte[64] Source;
byte[260] Message;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEBUG_DECODE_ERROR サイズ: 336 バイト(x64)
dim st, 84 ; 4byte整数×84(構造体サイズ 336 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Code : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; TreatAsStatus : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Source : CHAR (+12, 64byte) varptr(st)+12 を基点に操作(64byte:入れ子/配列)
; Message : CHAR (+76, 260byte) varptr(st)+76 を基点に操作(260byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEBUG_DECODE_ERROR
#field int SizeOfStruct
#field int Code
#field bool TreatAsStatus
#field byte Source 64
#field byte Message 260
#endstruct
stdim st, DEBUG_DECODE_ERROR ; NSTRUCT 変数を確保
st->SizeOfStruct = 100
mes "SizeOfStruct=" + st->SizeOfStruct