Win32 API 日本語リファレンス
ホームNetworking.WindowsWebServices › WsSendFaultMessageForError

WsSendFaultMessageForError

関数
エラーに対応するフォルトメッセージを送信する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

// webservices.dll
#include <windows.h>

HRESULT WsSendFaultMessageForError(
    WS_CHANNEL* channel,
    WS_MESSAGE* replyMessage,
    WS_ERROR* faultError,
    HRESULT faultErrorCode,
    WS_FAULT_DISCLOSURE faultDisclosure,
    WS_MESSAGE* requestMessage,
    const WS_ASYNC_CONTEXT* asyncContext,   // optional
    WS_ERROR* error   // optional
);

パラメーター

名前方向
channelWS_CHANNEL*in
replyMessageWS_MESSAGE*in
faultErrorWS_ERROR*in
faultErrorCodeHRESULTin
faultDisclosureWS_FAULT_DISCLOSUREin
requestMessageWS_MESSAGE*in
asyncContextWS_ASYNC_CONTEXT*inoptional
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

// webservices.dll
#include <windows.h>

HRESULT WsSendFaultMessageForError(
    WS_CHANNEL* channel,
    WS_MESSAGE* replyMessage,
    WS_ERROR* faultError,
    HRESULT faultErrorCode,
    WS_FAULT_DISCLOSURE faultDisclosure,
    WS_MESSAGE* requestMessage,
    const WS_ASYNC_CONTEXT* asyncContext,   // optional
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsSendFaultMessageForError(
    ref IntPtr channel,   // WS_CHANNEL*
    ref IntPtr replyMessage,   // WS_MESSAGE*
    ref IntPtr faultError,   // WS_ERROR*
    int faultErrorCode,   // HRESULT
    int faultDisclosure,   // WS_FAULT_DISCLOSURE
    ref IntPtr requestMessage,   // WS_MESSAGE*
    IntPtr asyncContext,   // WS_ASYNC_CONTEXT* optional
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsSendFaultMessageForError(
    ByRef channel As IntPtr,   ' WS_CHANNEL*
    ByRef replyMessage As IntPtr,   ' WS_MESSAGE*
    ByRef faultError As IntPtr,   ' WS_ERROR*
    faultErrorCode As Integer,   ' HRESULT
    faultDisclosure As Integer,   ' WS_FAULT_DISCLOSURE
    ByRef requestMessage As IntPtr,   ' WS_MESSAGE*
    asyncContext As IntPtr,   ' WS_ASYNC_CONTEXT* optional
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' channel : WS_CHANNEL*
' replyMessage : WS_MESSAGE*
' faultError : WS_ERROR*
' faultErrorCode : HRESULT
' faultDisclosure : WS_FAULT_DISCLOSURE
' requestMessage : WS_MESSAGE*
' asyncContext : WS_ASYNC_CONTEXT* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsSendFaultMessageForError Lib "webservices" ( _
    ByRef channel As LongPtr, _
    ByRef replyMessage As LongPtr, _
    ByRef faultError As LongPtr, _
    ByVal faultErrorCode As Long, _
    ByVal faultDisclosure As Long, _
    ByRef requestMessage As LongPtr, _
    ByVal asyncContext As LongPtr, _
    ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsSendFaultMessageForError = ctypes.windll.webservices.WsSendFaultMessageForError
WsSendFaultMessageForError.restype = ctypes.c_int
WsSendFaultMessageForError.argtypes = [
    ctypes.c_void_p,  # channel : WS_CHANNEL*
    ctypes.c_void_p,  # replyMessage : WS_MESSAGE*
    ctypes.c_void_p,  # faultError : WS_ERROR*
    ctypes.c_int,  # faultErrorCode : HRESULT
    ctypes.c_int,  # faultDisclosure : WS_FAULT_DISCLOSURE
    ctypes.c_void_p,  # requestMessage : WS_MESSAGE*
    ctypes.c_void_p,  # asyncContext : WS_ASYNC_CONTEXT* optional
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsSendFaultMessageForError = Fiddle::Function.new(
  lib['WsSendFaultMessageForError'],
  [
    Fiddle::TYPE_VOIDP,  # channel : WS_CHANNEL*
    Fiddle::TYPE_VOIDP,  # replyMessage : WS_MESSAGE*
    Fiddle::TYPE_VOIDP,  # faultError : WS_ERROR*
    Fiddle::TYPE_INT,  # faultErrorCode : HRESULT
    Fiddle::TYPE_INT,  # faultDisclosure : WS_FAULT_DISCLOSURE
    Fiddle::TYPE_VOIDP,  # requestMessage : WS_MESSAGE*
    Fiddle::TYPE_VOIDP,  # asyncContext : WS_ASYNC_CONTEXT* optional
    Fiddle::TYPE_VOIDP,  # error : WS_ERROR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsSendFaultMessageForError(
        channel: *mut isize,  // WS_CHANNEL*
        replyMessage: *mut isize,  // WS_MESSAGE*
        faultError: *mut isize,  // WS_ERROR*
        faultErrorCode: i32,  // HRESULT
        faultDisclosure: i32,  // WS_FAULT_DISCLOSURE
        requestMessage: *mut isize,  // WS_MESSAGE*
        asyncContext: *const WS_ASYNC_CONTEXT,  // WS_ASYNC_CONTEXT* optional
        error: *mut isize  // WS_ERROR* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("webservices.dll")]
public static extern int WsSendFaultMessageForError(ref IntPtr channel, ref IntPtr replyMessage, ref IntPtr faultError, int faultErrorCode, int faultDisclosure, ref IntPtr requestMessage, IntPtr asyncContext, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsSendFaultMessageForError' -Namespace Win32 -PassThru
# $api::WsSendFaultMessageForError(channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, asyncContext, error)
#uselib "webservices.dll"
#func global WsSendFaultMessageForError "WsSendFaultMessageForError" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WsSendFaultMessageForError channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, varptr(asyncContext), error   ; 戻り値は stat
; channel : WS_CHANNEL* -> "sptr"
; replyMessage : WS_MESSAGE* -> "sptr"
; faultError : WS_ERROR* -> "sptr"
; faultErrorCode : HRESULT -> "sptr"
; faultDisclosure : WS_FAULT_DISCLOSURE -> "sptr"
; requestMessage : WS_MESSAGE* -> "sptr"
; asyncContext : WS_ASYNC_CONTEXT* optional -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "webservices.dll"
#cfunc global WsSendFaultMessageForError "WsSendFaultMessageForError" int, int, int, int, int, int, var, int
; res = WsSendFaultMessageForError(channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, asyncContext, error)
; channel : WS_CHANNEL* -> "int"
; replyMessage : WS_MESSAGE* -> "int"
; faultError : WS_ERROR* -> "int"
; faultErrorCode : HRESULT -> "int"
; faultDisclosure : WS_FAULT_DISCLOSURE -> "int"
; requestMessage : WS_MESSAGE* -> "int"
; asyncContext : WS_ASYNC_CONTEXT* optional -> "var"
; error : WS_ERROR* optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WsSendFaultMessageForError(WS_CHANNEL* channel, WS_MESSAGE* replyMessage, WS_ERROR* faultError, HRESULT faultErrorCode, WS_FAULT_DISCLOSURE faultDisclosure, WS_MESSAGE* requestMessage, WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsSendFaultMessageForError "WsSendFaultMessageForError" int, int, int, int, int, int, var, int
; res = WsSendFaultMessageForError(channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, asyncContext, error)
; channel : WS_CHANNEL* -> "int"
; replyMessage : WS_MESSAGE* -> "int"
; faultError : WS_ERROR* -> "int"
; faultErrorCode : HRESULT -> "int"
; faultDisclosure : WS_FAULT_DISCLOSURE -> "int"
; requestMessage : WS_MESSAGE* -> "int"
; asyncContext : WS_ASYNC_CONTEXT* optional -> "var"
; error : WS_ERROR* optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsSendFaultMessageForError = webservices.NewProc("WsSendFaultMessageForError")
)

// channel (WS_CHANNEL*), replyMessage (WS_MESSAGE*), faultError (WS_ERROR*), faultErrorCode (HRESULT), faultDisclosure (WS_FAULT_DISCLOSURE), requestMessage (WS_MESSAGE*), asyncContext (WS_ASYNC_CONTEXT* optional), error (WS_ERROR* optional)
r1, _, err := procWsSendFaultMessageForError.Call(
	uintptr(channel),
	uintptr(replyMessage),
	uintptr(faultError),
	uintptr(faultErrorCode),
	uintptr(faultDisclosure),
	uintptr(requestMessage),
	uintptr(asyncContext),
	uintptr(error),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WsSendFaultMessageForError(
  channel: Pointer;   // WS_CHANNEL*
  replyMessage: Pointer;   // WS_MESSAGE*
  faultError: Pointer;   // WS_ERROR*
  faultErrorCode: Integer;   // HRESULT
  faultDisclosure: Integer;   // WS_FAULT_DISCLOSURE
  requestMessage: Pointer;   // WS_MESSAGE*
  asyncContext: Pointer;   // WS_ASYNC_CONTEXT* optional
  error: Pointer   // WS_ERROR* optional
): Integer; stdcall;
  external 'webservices.dll' name 'WsSendFaultMessageForError';
result := DllCall("webservices\WsSendFaultMessageForError"
    , "Ptr", channel   ; WS_CHANNEL*
    , "Ptr", replyMessage   ; WS_MESSAGE*
    , "Ptr", faultError   ; WS_ERROR*
    , "Int", faultErrorCode   ; HRESULT
    , "Int", faultDisclosure   ; WS_FAULT_DISCLOSURE
    , "Ptr", requestMessage   ; WS_MESSAGE*
    , "Ptr", asyncContext   ; WS_ASYNC_CONTEXT* optional
    , "Ptr", error   ; WS_ERROR* optional
    , "Int")   ; return: HRESULT
●WsSendFaultMessageForError(channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, asyncContext, error) = DLL("webservices.dll", "int WsSendFaultMessageForError(void*, void*, void*, int, int, void*, void*, void*)")
# 呼び出し: WsSendFaultMessageForError(channel, replyMessage, faultError, faultErrorCode, faultDisclosure, requestMessage, asyncContext, error)
# channel : WS_CHANNEL* -> "void*"
# replyMessage : WS_MESSAGE* -> "void*"
# faultError : WS_ERROR* -> "void*"
# faultErrorCode : HRESULT -> "int"
# faultDisclosure : WS_FAULT_DISCLOSURE -> "int"
# requestMessage : WS_MESSAGE* -> "void*"
# asyncContext : WS_ASYNC_CONTEXT* optional -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。