ホーム › System.WindowsProgramming › FEATURE_ERROR
FEATURE_ERROR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hr | HRESULT | 4 | +0 | +0 | エラーを表すHRESULT値。 |
| lineNumber | WORD | 2 | +4 | +4 | エラーが発生したソースの行番号。 |
| file | LPSTR | 8/4 | +8 | +8 | エラーが発生したソースファイル名。 |
| process | LPSTR | 8/4 | +16 | +12 | エラーが発生したプロセス名。 |
| module | LPSTR | 8/4 | +24 | +16 | エラーが発生したモジュール名。 |
| callerReturnAddressOffset | DWORD | 4 | +32 | +20 | 呼び出し元の戻りアドレスのモジュール内オフセット。 |
| callerModule | LPSTR | 8/4 | +40 | +24 | 呼び出し元のモジュール名。 |
| message | LPSTR | 8/4 | +48 | +28 | エラーに関する説明メッセージ。 |
| originLineNumber | WORD | 2 | +56 | +32 | エラー発生源の行番号。 |
| originFile | LPSTR | 8/4 | +64 | +36 | エラー発生源のファイル名。 |
| originModule | LPSTR | 8/4 | +72 | +40 | エラー発生源のモジュール名。 |
| originCallerReturnAddressOffset | DWORD | 4 | +80 | +44 | 発生源呼び出し元の戻りアドレスオフセット。 |
| originCallerModule | LPSTR | 8/4 | +88 | +48 | 発生源の呼び出し元モジュール名。 |
| originName | LPSTR | 8/4 | +96 | +52 | エラー発生源の名前(機能名等)。 |
各言語での定義
#include <windows.h>
// FEATURE_ERROR (x64 104 / x86 56 バイト)
typedef struct FEATURE_ERROR {
HRESULT hr;
WORD lineNumber;
LPSTR file;
LPSTR process;
LPSTR module;
DWORD callerReturnAddressOffset;
LPSTR callerModule;
LPSTR message;
WORD originLineNumber;
LPSTR originFile;
LPSTR originModule;
DWORD originCallerReturnAddressOffset;
LPSTR originCallerModule;
LPSTR originName;
} FEATURE_ERROR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FEATURE_ERROR
{
public int hr;
public ushort lineNumber;
public IntPtr file;
public IntPtr process;
public IntPtr module;
public uint callerReturnAddressOffset;
public IntPtr callerModule;
public IntPtr message;
public ushort originLineNumber;
public IntPtr originFile;
public IntPtr originModule;
public uint originCallerReturnAddressOffset;
public IntPtr originCallerModule;
public IntPtr originName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FEATURE_ERROR
Public hr As Integer
Public lineNumber As UShort
Public file As IntPtr
Public process As IntPtr
Public module As IntPtr
Public callerReturnAddressOffset As UInteger
Public callerModule As IntPtr
Public message As IntPtr
Public originLineNumber As UShort
Public originFile As IntPtr
Public originModule As IntPtr
Public originCallerReturnAddressOffset As UInteger
Public originCallerModule As IntPtr
Public originName As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class FEATURE_ERROR(ctypes.Structure):
_fields_ = [
("hr", ctypes.c_int),
("lineNumber", ctypes.c_ushort),
("file", ctypes.c_void_p),
("process", ctypes.c_void_p),
("module", ctypes.c_void_p),
("callerReturnAddressOffset", wintypes.DWORD),
("callerModule", ctypes.c_void_p),
("message", ctypes.c_void_p),
("originLineNumber", ctypes.c_ushort),
("originFile", ctypes.c_void_p),
("originModule", ctypes.c_void_p),
("originCallerReturnAddressOffset", wintypes.DWORD),
("originCallerModule", ctypes.c_void_p),
("originName", ctypes.c_void_p),
]#[repr(C)]
pub struct FEATURE_ERROR {
pub hr: i32,
pub lineNumber: u16,
pub file: *mut core::ffi::c_void,
pub process: *mut core::ffi::c_void,
pub module: *mut core::ffi::c_void,
pub callerReturnAddressOffset: u32,
pub callerModule: *mut core::ffi::c_void,
pub message: *mut core::ffi::c_void,
pub originLineNumber: u16,
pub originFile: *mut core::ffi::c_void,
pub originModule: *mut core::ffi::c_void,
pub originCallerReturnAddressOffset: u32,
pub originCallerModule: *mut core::ffi::c_void,
pub originName: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type FEATURE_ERROR struct {
hr int32
lineNumber uint16
file uintptr
process uintptr
module uintptr
callerReturnAddressOffset uint32
callerModule uintptr
message uintptr
originLineNumber uint16
originFile uintptr
originModule uintptr
originCallerReturnAddressOffset uint32
originCallerModule uintptr
originName uintptr
}type
FEATURE_ERROR = record
hr: Integer;
lineNumber: Word;
file: Pointer;
process: Pointer;
module: Pointer;
callerReturnAddressOffset: DWORD;
callerModule: Pointer;
message: Pointer;
originLineNumber: Word;
originFile: Pointer;
originModule: Pointer;
originCallerReturnAddressOffset: DWORD;
originCallerModule: Pointer;
originName: Pointer;
end;const FEATURE_ERROR = extern struct {
hr: i32,
lineNumber: u16,
file: ?*anyopaque,
process: ?*anyopaque,
module: ?*anyopaque,
callerReturnAddressOffset: u32,
callerModule: ?*anyopaque,
message: ?*anyopaque,
originLineNumber: u16,
originFile: ?*anyopaque,
originModule: ?*anyopaque,
originCallerReturnAddressOffset: u32,
originCallerModule: ?*anyopaque,
originName: ?*anyopaque,
};type
FEATURE_ERROR {.bycopy.} = object
hr: int32
lineNumber: uint16
file: pointer
process: pointer
module: pointer
callerReturnAddressOffset: uint32
callerModule: pointer
message: pointer
originLineNumber: uint16
originFile: pointer
originModule: pointer
originCallerReturnAddressOffset: uint32
originCallerModule: pointer
originName: pointerstruct FEATURE_ERROR
{
int hr;
ushort lineNumber;
void* file;
void* process;
void* module;
uint callerReturnAddressOffset;
void* callerModule;
void* message;
ushort originLineNumber;
void* originFile;
void* originModule;
uint originCallerReturnAddressOffset;
void* originCallerModule;
void* originName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FEATURE_ERROR サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; hr : HRESULT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lineNumber : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; file : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; process : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; module : LPSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; callerReturnAddressOffset : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; callerModule : LPSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; message : LPSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; originLineNumber : WORD (+32, 2byte) wpoke st,32,値 / 値 = wpeek(st,32)
; originFile : LPSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; originModule : LPSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; originCallerReturnAddressOffset : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; originCallerModule : LPSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; originName : LPSTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FEATURE_ERROR サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; hr : HRESULT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lineNumber : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; file : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; process : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; module : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; callerReturnAddressOffset : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; callerModule : LPSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; message : LPSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; originLineNumber : WORD (+56, 2byte) wpoke st,56,値 / 値 = wpeek(st,56)
; originFile : LPSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; originModule : LPSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; originCallerReturnAddressOffset : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; originCallerModule : LPSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; originName : LPSTR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FEATURE_ERROR
#field int hr
#field short lineNumber
#field intptr file
#field intptr process
#field intptr module
#field int callerReturnAddressOffset
#field intptr callerModule
#field intptr message
#field short originLineNumber
#field intptr originFile
#field intptr originModule
#field int originCallerReturnAddressOffset
#field intptr originCallerModule
#field intptr originName
#endstruct
stdim st, FEATURE_ERROR ; NSTRUCT 変数を確保
st->hr = 100
mes "hr=" + st->hr