ホーム › System.Com › EXCEPINFO
EXCEPINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wCode | WORD | 2 | +0 | +0 | エラーコード。scodeを使う場合は0。 |
| wReserved | WORD | 2 | +2 | +2 | 予約済みフィールド。 |
| bstrSource | LPWSTR | 8/4 | +8 | +4 | 例外を発生させたソース名のBSTR。 |
| bstrDescription | LPWSTR | 8/4 | +16 | +8 | 例外の説明テキストのBSTR。NULL可。 |
| bstrHelpFile | LPWSTR | 8/4 | +24 | +12 | 関連ヘルプファイルのパスBSTR。NULL可。 |
| dwHelpContext | DWORD | 4 | +32 | +16 | ヘルプファイル内のヘルプコンテキストID。 |
| pvReserved | void* | 8/4 | +40 | +20 | 予約済み。NULLを設定する。 |
| pfnDeferredFillIn | LPEXCEPFINO_DEFERRED_FILLIN | 8/4 | +48 | +24 | 情報を遅延補完するコールバック関数へのポインタ。NULL可。 |
| scode | INT | 4 | +56 | +28 | 返すエラーステータスコード(SCODE)。wCode使用時は0。 |
各言語での定義
#include <windows.h>
// EXCEPINFO (x64 64 / x86 32 バイト)
typedef struct EXCEPINFO {
WORD wCode;
WORD wReserved;
LPWSTR bstrSource;
LPWSTR bstrDescription;
LPWSTR bstrHelpFile;
DWORD dwHelpContext;
void* pvReserved;
LPEXCEPFINO_DEFERRED_FILLIN pfnDeferredFillIn;
INT scode;
} EXCEPINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPINFO
{
public ushort wCode;
public ushort wReserved;
public IntPtr bstrSource;
public IntPtr bstrDescription;
public IntPtr bstrHelpFile;
public uint dwHelpContext;
public IntPtr pvReserved;
public IntPtr pfnDeferredFillIn;
public int scode;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPINFO
Public wCode As UShort
Public wReserved As UShort
Public bstrSource As IntPtr
Public bstrDescription As IntPtr
Public bstrHelpFile As IntPtr
Public dwHelpContext As UInteger
Public pvReserved As IntPtr
Public pfnDeferredFillIn As IntPtr
Public scode As Integer
End Structureimport ctypes
from ctypes import wintypes
class EXCEPINFO(ctypes.Structure):
_fields_ = [
("wCode", ctypes.c_ushort),
("wReserved", ctypes.c_ushort),
("bstrSource", ctypes.c_void_p),
("bstrDescription", ctypes.c_void_p),
("bstrHelpFile", ctypes.c_void_p),
("dwHelpContext", wintypes.DWORD),
("pvReserved", ctypes.c_void_p),
("pfnDeferredFillIn", ctypes.c_void_p),
("scode", ctypes.c_int),
]#[repr(C)]
pub struct EXCEPINFO {
pub wCode: u16,
pub wReserved: u16,
pub bstrSource: *mut core::ffi::c_void,
pub bstrDescription: *mut core::ffi::c_void,
pub bstrHelpFile: *mut core::ffi::c_void,
pub dwHelpContext: u32,
pub pvReserved: *mut core::ffi::c_void,
pub pfnDeferredFillIn: *mut core::ffi::c_void,
pub scode: i32,
}import "golang.org/x/sys/windows"
type EXCEPINFO struct {
wCode uint16
wReserved uint16
bstrSource uintptr
bstrDescription uintptr
bstrHelpFile uintptr
dwHelpContext uint32
pvReserved uintptr
pfnDeferredFillIn uintptr
scode int32
}type
EXCEPINFO = record
wCode: Word;
wReserved: Word;
bstrSource: Pointer;
bstrDescription: Pointer;
bstrHelpFile: Pointer;
dwHelpContext: DWORD;
pvReserved: Pointer;
pfnDeferredFillIn: Pointer;
scode: Integer;
end;const EXCEPINFO = extern struct {
wCode: u16,
wReserved: u16,
bstrSource: ?*anyopaque,
bstrDescription: ?*anyopaque,
bstrHelpFile: ?*anyopaque,
dwHelpContext: u32,
pvReserved: ?*anyopaque,
pfnDeferredFillIn: ?*anyopaque,
scode: i32,
};type
EXCEPINFO {.bycopy.} = object
wCode: uint16
wReserved: uint16
bstrSource: pointer
bstrDescription: pointer
bstrHelpFile: pointer
dwHelpContext: uint32
pvReserved: pointer
pfnDeferredFillIn: pointer
scode: int32struct EXCEPINFO
{
ushort wCode;
ushort wReserved;
void* bstrSource;
void* bstrDescription;
void* bstrHelpFile;
uint dwHelpContext;
void* pvReserved;
void* pfnDeferredFillIn;
int scode;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; EXCEPINFO サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; wCode : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wReserved : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; bstrSource : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; bstrDescription : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; bstrHelpFile : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwHelpContext : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pvReserved : void* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pfnDeferredFillIn : LPEXCEPFINO_DEFERRED_FILLIN (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; scode : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EXCEPINFO サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; wCode : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wReserved : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; bstrSource : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; bstrDescription : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; bstrHelpFile : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwHelpContext : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; pvReserved : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pfnDeferredFillIn : LPEXCEPFINO_DEFERRED_FILLIN (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; scode : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global EXCEPINFO
#field short wCode
#field short wReserved
#field intptr bstrSource
#field intptr bstrDescription
#field intptr bstrHelpFile
#field int dwHelpContext
#field intptr pvReserved
#field intptr pfnDeferredFillIn
#field int scode
#endstruct
stdim st, EXCEPINFO ; NSTRUCT 変数を確保
st->wCode = 100
mes "wCode=" + st->wCode