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

WsGetFaultErrorDetail

関数
フォルトエラーの詳細情報を取得する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsGetFaultErrorDetail(
    WS_ERROR* error,
    const WS_FAULT_DETAIL_DESCRIPTION* faultDetailDescription,
    WS_READ_OPTION readOption,
    WS_HEAP* heap,   // optional
    void* value,
    DWORD valueSize
);

パラメーター

名前方向
errorWS_ERROR*in
faultDetailDescriptionWS_FAULT_DETAIL_DESCRIPTION*in
readOptionWS_READ_OPTIONin
heapWS_HEAP*inoptional
valuevoid*out
valueSizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsGetFaultErrorDetail(
    WS_ERROR* error,
    const WS_FAULT_DETAIL_DESCRIPTION* faultDetailDescription,
    WS_READ_OPTION readOption,
    WS_HEAP* heap,   // optional
    void* value,
    DWORD valueSize
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsGetFaultErrorDetail(
    ref IntPtr error,   // WS_ERROR*
    IntPtr faultDetailDescription,   // WS_FAULT_DETAIL_DESCRIPTION*
    int readOption,   // WS_READ_OPTION
    IntPtr heap,   // WS_HEAP* optional
    IntPtr value,   // void* out
    uint valueSize   // DWORD
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsGetFaultErrorDetail(
    ByRef [error] As IntPtr,   ' WS_ERROR*
    faultDetailDescription As IntPtr,   ' WS_FAULT_DETAIL_DESCRIPTION*
    readOption As Integer,   ' WS_READ_OPTION
    heap As IntPtr,   ' WS_HEAP* optional
    value As IntPtr,   ' void* out
    valueSize As UInteger   ' DWORD
) As Integer
End Function
' error : WS_ERROR*
' faultDetailDescription : WS_FAULT_DETAIL_DESCRIPTION*
' readOption : WS_READ_OPTION
' heap : WS_HEAP* optional
' value : void* out
' valueSize : DWORD
Declare PtrSafe Function WsGetFaultErrorDetail Lib "webservices" ( _
    ByRef error As LongPtr, _
    ByVal faultDetailDescription As LongPtr, _
    ByVal readOption As Long, _
    ByVal heap As LongPtr, _
    ByVal value As LongPtr, _
    ByVal valueSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsGetFaultErrorDetail = ctypes.windll.webservices.WsGetFaultErrorDetail
WsGetFaultErrorDetail.restype = ctypes.c_int
WsGetFaultErrorDetail.argtypes = [
    ctypes.c_void_p,  # error : WS_ERROR*
    ctypes.c_void_p,  # faultDetailDescription : WS_FAULT_DETAIL_DESCRIPTION*
    ctypes.c_int,  # readOption : WS_READ_OPTION
    ctypes.c_void_p,  # heap : WS_HEAP* optional
    ctypes.POINTER(None),  # value : void* out
    wintypes.DWORD,  # valueSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsGetFaultErrorDetail = webservices.NewProc("WsGetFaultErrorDetail")
)

// error (WS_ERROR*), faultDetailDescription (WS_FAULT_DETAIL_DESCRIPTION*), readOption (WS_READ_OPTION), heap (WS_HEAP* optional), value (void* out), valueSize (DWORD)
r1, _, err := procWsGetFaultErrorDetail.Call(
	uintptr(error),
	uintptr(faultDetailDescription),
	uintptr(readOption),
	uintptr(heap),
	uintptr(value),
	uintptr(valueSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WsGetFaultErrorDetail(
  error: Pointer;   // WS_ERROR*
  faultDetailDescription: Pointer;   // WS_FAULT_DETAIL_DESCRIPTION*
  readOption: Integer;   // WS_READ_OPTION
  heap: Pointer;   // WS_HEAP* optional
  value: Pointer;   // void* out
  valueSize: DWORD   // DWORD
): Integer; stdcall;
  external 'webservices.dll' name 'WsGetFaultErrorDetail';
result := DllCall("webservices\WsGetFaultErrorDetail"
    , "Ptr", error   ; WS_ERROR*
    , "Ptr", faultDetailDescription   ; WS_FAULT_DETAIL_DESCRIPTION*
    , "Int", readOption   ; WS_READ_OPTION
    , "Ptr", heap   ; WS_HEAP* optional
    , "Ptr", value   ; void* out
    , "UInt", valueSize   ; DWORD
    , "Int")   ; return: HRESULT
●WsGetFaultErrorDetail(error, faultDetailDescription, readOption, heap, value, valueSize) = DLL("webservices.dll", "int WsGetFaultErrorDetail(void*, void*, int, void*, void*, dword)")
# 呼び出し: WsGetFaultErrorDetail(error, faultDetailDescription, readOption, heap, value, valueSize)
# error : WS_ERROR* -> "void*"
# faultDetailDescription : WS_FAULT_DETAIL_DESCRIPTION* -> "void*"
# readOption : WS_READ_OPTION -> "int"
# heap : WS_HEAP* optional -> "void*"
# value : void* out -> "void*"
# valueSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。