ホーム › Devices.WebServicesOnDevices › WSDGenerateFault
WSDGenerateFault
関数コードや理由からWSD SOAPフォルト構造体を生成する。
シグネチャ
// wsdapi.dll
#include <windows.h>
HRESULT WSDGenerateFault(
LPCWSTR pszCode,
LPCWSTR pszSubCode, // optional
LPCWSTR pszReason,
LPCWSTR pszDetail, // optional
IWSDXMLContext* pContext,
WSD_SOAP_FAULT** ppFault
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszCode | LPCWSTR | in |
| pszSubCode | LPCWSTR | inoptional |
| pszReason | LPCWSTR | in |
| pszDetail | LPCWSTR | inoptional |
| pContext | IWSDXMLContext* | in |
| ppFault | WSD_SOAP_FAULT** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// wsdapi.dll
#include <windows.h>
HRESULT WSDGenerateFault(
LPCWSTR pszCode,
LPCWSTR pszSubCode, // optional
LPCWSTR pszReason,
LPCWSTR pszDetail, // optional
IWSDXMLContext* pContext,
WSD_SOAP_FAULT** ppFault
);[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDGenerateFault(
[MarshalAs(UnmanagedType.LPWStr)] string pszCode, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pszSubCode, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string pszReason, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pszDetail, // LPCWSTR optional
IntPtr pContext, // IWSDXMLContext*
IntPtr ppFault // WSD_SOAP_FAULT** out
);<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDGenerateFault(
<MarshalAs(UnmanagedType.LPWStr)> pszCode As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pszSubCode As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> pszReason As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pszDetail As String, ' LPCWSTR optional
pContext As IntPtr, ' IWSDXMLContext*
ppFault As IntPtr ' WSD_SOAP_FAULT** out
) As Integer
End Function' pszCode : LPCWSTR
' pszSubCode : LPCWSTR optional
' pszReason : LPCWSTR
' pszDetail : LPCWSTR optional
' pContext : IWSDXMLContext*
' ppFault : WSD_SOAP_FAULT** out
Declare PtrSafe Function WSDGenerateFault Lib "wsdapi" ( _
ByVal pszCode As LongPtr, _
ByVal pszSubCode As LongPtr, _
ByVal pszReason As LongPtr, _
ByVal pszDetail As LongPtr, _
ByVal pContext As LongPtr, _
ByVal ppFault As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSDGenerateFault = ctypes.windll.wsdapi.WSDGenerateFault
WSDGenerateFault.restype = ctypes.c_int
WSDGenerateFault.argtypes = [
wintypes.LPCWSTR, # pszCode : LPCWSTR
wintypes.LPCWSTR, # pszSubCode : LPCWSTR optional
wintypes.LPCWSTR, # pszReason : LPCWSTR
wintypes.LPCWSTR, # pszDetail : LPCWSTR optional
ctypes.c_void_p, # pContext : IWSDXMLContext*
ctypes.c_void_p, # ppFault : WSD_SOAP_FAULT** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wsdapi.dll')
WSDGenerateFault = Fiddle::Function.new(
lib['WSDGenerateFault'],
[
Fiddle::TYPE_VOIDP, # pszCode : LPCWSTR
Fiddle::TYPE_VOIDP, # pszSubCode : LPCWSTR optional
Fiddle::TYPE_VOIDP, # pszReason : LPCWSTR
Fiddle::TYPE_VOIDP, # pszDetail : LPCWSTR optional
Fiddle::TYPE_VOIDP, # pContext : IWSDXMLContext*
Fiddle::TYPE_VOIDP, # ppFault : WSD_SOAP_FAULT** out
],
Fiddle::TYPE_INT)#[link(name = "wsdapi")]
extern "system" {
fn WSDGenerateFault(
pszCode: *const u16, // LPCWSTR
pszSubCode: *const u16, // LPCWSTR optional
pszReason: *const u16, // LPCWSTR
pszDetail: *const u16, // LPCWSTR optional
pContext: *mut core::ffi::c_void, // IWSDXMLContext*
ppFault: *mut *mut WSD_SOAP_FAULT // WSD_SOAP_FAULT** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDGenerateFault([MarshalAs(UnmanagedType.LPWStr)] string pszCode, [MarshalAs(UnmanagedType.LPWStr)] string pszSubCode, [MarshalAs(UnmanagedType.LPWStr)] string pszReason, [MarshalAs(UnmanagedType.LPWStr)] string pszDetail, IntPtr pContext, IntPtr ppFault);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDGenerateFault' -Namespace Win32 -PassThru
# $api::WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, ppFault)#uselib "wsdapi.dll"
#func global WSDGenerateFault "WSDGenerateFault" sptr, sptr, sptr, sptr, sptr, sptr
; WSDGenerateFault pszCode, pszSubCode, pszReason, pszDetail, pContext, varptr(ppFault) ; 戻り値は stat
; pszCode : LPCWSTR -> "sptr"
; pszSubCode : LPCWSTR optional -> "sptr"
; pszReason : LPCWSTR -> "sptr"
; pszDetail : LPCWSTR optional -> "sptr"
; pContext : IWSDXMLContext* -> "sptr"
; ppFault : WSD_SOAP_FAULT** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wsdapi.dll" #cfunc global WSDGenerateFault "WSDGenerateFault" wstr, wstr, wstr, wstr, sptr, var ; res = WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, ppFault) ; pszCode : LPCWSTR -> "wstr" ; pszSubCode : LPCWSTR optional -> "wstr" ; pszReason : LPCWSTR -> "wstr" ; pszDetail : LPCWSTR optional -> "wstr" ; pContext : IWSDXMLContext* -> "sptr" ; ppFault : WSD_SOAP_FAULT** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wsdapi.dll" #cfunc global WSDGenerateFault "WSDGenerateFault" wstr, wstr, wstr, wstr, sptr, sptr ; res = WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, varptr(ppFault)) ; pszCode : LPCWSTR -> "wstr" ; pszSubCode : LPCWSTR optional -> "wstr" ; pszReason : LPCWSTR -> "wstr" ; pszDetail : LPCWSTR optional -> "wstr" ; pContext : IWSDXMLContext* -> "sptr" ; ppFault : WSD_SOAP_FAULT** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WSDGenerateFault(LPCWSTR pszCode, LPCWSTR pszSubCode, LPCWSTR pszReason, LPCWSTR pszDetail, IWSDXMLContext* pContext, WSD_SOAP_FAULT** ppFault) #uselib "wsdapi.dll" #cfunc global WSDGenerateFault "WSDGenerateFault" wstr, wstr, wstr, wstr, intptr, var ; res = WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, ppFault) ; pszCode : LPCWSTR -> "wstr" ; pszSubCode : LPCWSTR optional -> "wstr" ; pszReason : LPCWSTR -> "wstr" ; pszDetail : LPCWSTR optional -> "wstr" ; pContext : IWSDXMLContext* -> "intptr" ; ppFault : WSD_SOAP_FAULT** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WSDGenerateFault(LPCWSTR pszCode, LPCWSTR pszSubCode, LPCWSTR pszReason, LPCWSTR pszDetail, IWSDXMLContext* pContext, WSD_SOAP_FAULT** ppFault) #uselib "wsdapi.dll" #cfunc global WSDGenerateFault "WSDGenerateFault" wstr, wstr, wstr, wstr, intptr, intptr ; res = WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, varptr(ppFault)) ; pszCode : LPCWSTR -> "wstr" ; pszSubCode : LPCWSTR optional -> "wstr" ; pszReason : LPCWSTR -> "wstr" ; pszDetail : LPCWSTR optional -> "wstr" ; pContext : IWSDXMLContext* -> "intptr" ; ppFault : WSD_SOAP_FAULT** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
procWSDGenerateFault = wsdapi.NewProc("WSDGenerateFault")
)
// pszCode (LPCWSTR), pszSubCode (LPCWSTR optional), pszReason (LPCWSTR), pszDetail (LPCWSTR optional), pContext (IWSDXMLContext*), ppFault (WSD_SOAP_FAULT** out)
r1, _, err := procWSDGenerateFault.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszCode))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszSubCode))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszReason))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszDetail))),
uintptr(pContext),
uintptr(ppFault),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WSDGenerateFault(
pszCode: PWideChar; // LPCWSTR
pszSubCode: PWideChar; // LPCWSTR optional
pszReason: PWideChar; // LPCWSTR
pszDetail: PWideChar; // LPCWSTR optional
pContext: Pointer; // IWSDXMLContext*
ppFault: Pointer // WSD_SOAP_FAULT** out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDGenerateFault';result := DllCall("wsdapi\WSDGenerateFault"
, "WStr", pszCode ; LPCWSTR
, "WStr", pszSubCode ; LPCWSTR optional
, "WStr", pszReason ; LPCWSTR
, "WStr", pszDetail ; LPCWSTR optional
, "Ptr", pContext ; IWSDXMLContext*
, "Ptr", ppFault ; WSD_SOAP_FAULT** out
, "Int") ; return: HRESULT●WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, ppFault) = DLL("wsdapi.dll", "int WSDGenerateFault(char*, char*, char*, char*, void*, void*)")
# 呼び出し: WSDGenerateFault(pszCode, pszSubCode, pszReason, pszDetail, pContext, ppFault)
# pszCode : LPCWSTR -> "char*"
# pszSubCode : LPCWSTR optional -> "char*"
# pszReason : LPCWSTR -> "char*"
# pszDetail : LPCWSTR optional -> "char*"
# pContext : IWSDXMLContext* -> "void*"
# ppFault : WSD_SOAP_FAULT** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。