ホーム › Networking.WindowsWebServices › WS_FAULT
WS_FAULT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| code | WS_FAULT_CODE* | 8/4 | +0 | +0 | フォルトコードを表す構造体へのポインタ。NULL可。 |
| reasons | WS_FAULT_REASON* | 8/4 | +8 | +4 | フォルト理由の配列へのポインタ。各要素は言語別の説明テキスト。 |
| reasonCount | DWORD | 4 | +16 | +8 | reasons配列の要素数。 |
| actor | WS_STRING | 16/8 | +24 | +12 | フォルトを生成したアクター(ノード)を示す文字列。 |
| node | WS_STRING | 16/8 | +40 | +20 | フォルトを生成したノードを示すURI文字列。 |
| detail | WS_XML_BUFFER* | 8/4 | +56 | +28 | フォルトの詳細情報を保持するXMLバッファへのポインタ。NULL可。 |
各言語での定義
#include <windows.h>
// WS_STRING (x64 16 / x86 8 バイト)
typedef struct WS_STRING {
DWORD length;
LPWSTR chars;
} WS_STRING;
// WS_FAULT (x64 64 / x86 32 バイト)
typedef struct WS_FAULT {
WS_FAULT_CODE* code;
WS_FAULT_REASON* reasons;
DWORD reasonCount;
WS_STRING actor;
WS_STRING node;
WS_XML_BUFFER* detail;
} WS_FAULT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_STRING
{
public uint length;
public IntPtr chars;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_FAULT
{
public IntPtr code;
public IntPtr reasons;
public uint reasonCount;
public WS_STRING actor;
public WS_STRING node;
public IntPtr detail;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_STRING
Public length As UInteger
Public chars As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_FAULT
Public code As IntPtr
Public reasons As IntPtr
Public reasonCount As UInteger
Public actor As WS_STRING
Public node As WS_STRING
Public detail As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class WS_STRING(ctypes.Structure):
_fields_ = [
("length", wintypes.DWORD),
("chars", ctypes.c_void_p),
]
class WS_FAULT(ctypes.Structure):
_fields_ = [
("code", ctypes.c_void_p),
("reasons", ctypes.c_void_p),
("reasonCount", wintypes.DWORD),
("actor", WS_STRING),
("node", WS_STRING),
("detail", ctypes.c_void_p),
]#[repr(C)]
pub struct WS_STRING {
pub length: u32,
pub chars: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct WS_FAULT {
pub code: *mut core::ffi::c_void,
pub reasons: *mut core::ffi::c_void,
pub reasonCount: u32,
pub actor: WS_STRING,
pub node: WS_STRING,
pub detail: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type WS_STRING struct {
length uint32
chars uintptr
}
type WS_FAULT struct {
code uintptr
reasons uintptr
reasonCount uint32
actor WS_STRING
node WS_STRING
detail uintptr
}type
WS_STRING = record
length: DWORD;
chars: Pointer;
end;
WS_FAULT = record
code: Pointer;
reasons: Pointer;
reasonCount: DWORD;
actor: WS_STRING;
node: WS_STRING;
detail: Pointer;
end;const WS_STRING = extern struct {
length: u32,
chars: ?*anyopaque,
};
const WS_FAULT = extern struct {
code: ?*anyopaque,
reasons: ?*anyopaque,
reasonCount: u32,
actor: WS_STRING,
node: WS_STRING,
detail: ?*anyopaque,
};type
WS_STRING {.bycopy.} = object
length: uint32
chars: pointer
WS_FAULT {.bycopy.} = object
code: pointer
reasons: pointer
reasonCount: uint32
actor: WS_STRING
node: WS_STRING
detail: pointerstruct WS_STRING
{
uint length;
void* chars;
}
struct WS_FAULT
{
void* code;
void* reasons;
uint reasonCount;
WS_STRING actor;
WS_STRING node;
void* detail;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_FAULT サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; code : WS_FAULT_CODE* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; reasons : WS_FAULT_REASON* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; reasonCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; actor : WS_STRING (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; node : WS_STRING (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; detail : WS_XML_BUFFER* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_FAULT サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; code : WS_FAULT_CODE* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; reasons : WS_FAULT_REASON* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; reasonCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; actor : WS_STRING (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; node : WS_STRING (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; detail : WS_XML_BUFFER* (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WS_STRING
#field int length
#field intptr chars
#endstruct
#defstruct global WS_FAULT
#field intptr code
#field intptr reasons
#field int reasonCount
#field WS_STRING actor
#field WS_STRING node
#field intptr detail
#endstruct
stdim st, WS_FAULT ; NSTRUCT 変数を確保
st->reasonCount = 100
mes "reasonCount=" + st->reasonCount