ホーム › Networking.WindowsWebServices › WsCreateError
WsCreateError
関数エラーオブジェクトを作成する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsCreateError(
const WS_ERROR_PROPERTY* properties, // optional
DWORD propertyCount,
WS_ERROR** error
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| properties | WS_ERROR_PROPERTY* | inoptional |
| propertyCount | DWORD | in |
| error | WS_ERROR** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsCreateError(
const WS_ERROR_PROPERTY* properties, // optional
DWORD propertyCount,
WS_ERROR** error
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsCreateError(
IntPtr properties, // WS_ERROR_PROPERTY* optional
uint propertyCount, // DWORD
IntPtr error // WS_ERROR** out
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsCreateError(
properties As IntPtr, ' WS_ERROR_PROPERTY* optional
propertyCount As UInteger, ' DWORD
[error] As IntPtr ' WS_ERROR** out
) As Integer
End Function' properties : WS_ERROR_PROPERTY* optional
' propertyCount : DWORD
' error : WS_ERROR** out
Declare PtrSafe Function WsCreateError Lib "webservices" ( _
ByVal properties As LongPtr, _
ByVal propertyCount As Long, _
ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WsCreateError = ctypes.windll.webservices.WsCreateError
WsCreateError.restype = ctypes.c_int
WsCreateError.argtypes = [
ctypes.c_void_p, # properties : WS_ERROR_PROPERTY* optional
wintypes.DWORD, # propertyCount : DWORD
ctypes.c_void_p, # error : WS_ERROR** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsCreateError = Fiddle::Function.new(
lib['WsCreateError'],
[
Fiddle::TYPE_VOIDP, # properties : WS_ERROR_PROPERTY* optional
-Fiddle::TYPE_INT, # propertyCount : DWORD
Fiddle::TYPE_VOIDP, # error : WS_ERROR** out
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsCreateError(
properties: *const WS_ERROR_PROPERTY, // WS_ERROR_PROPERTY* optional
propertyCount: u32, // DWORD
error: *mut *mut isize // WS_ERROR** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("webservices.dll")]
public static extern int WsCreateError(IntPtr properties, uint propertyCount, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsCreateError' -Namespace Win32 -PassThru
# $api::WsCreateError(properties, propertyCount, error)#uselib "webservices.dll"
#func global WsCreateError "WsCreateError" sptr, sptr, sptr
; WsCreateError varptr(properties), propertyCount, error ; 戻り値は stat
; properties : WS_ERROR_PROPERTY* optional -> "sptr"
; propertyCount : DWORD -> "sptr"
; error : WS_ERROR** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "webservices.dll" #cfunc global WsCreateError "WsCreateError" var, int, int ; res = WsCreateError(properties, propertyCount, error) ; properties : WS_ERROR_PROPERTY* optional -> "var" ; propertyCount : DWORD -> "int" ; error : WS_ERROR** out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "webservices.dll" #cfunc global WsCreateError "WsCreateError" sptr, int, int ; res = WsCreateError(varptr(properties), propertyCount, error) ; properties : WS_ERROR_PROPERTY* optional -> "sptr" ; propertyCount : DWORD -> "int" ; error : WS_ERROR** out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsCreateError(WS_ERROR_PROPERTY* properties, DWORD propertyCount, WS_ERROR** error) #uselib "webservices.dll" #cfunc global WsCreateError "WsCreateError" var, int, int ; res = WsCreateError(properties, propertyCount, error) ; properties : WS_ERROR_PROPERTY* optional -> "var" ; propertyCount : DWORD -> "int" ; error : WS_ERROR** out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsCreateError(WS_ERROR_PROPERTY* properties, DWORD propertyCount, WS_ERROR** error) #uselib "webservices.dll" #cfunc global WsCreateError "WsCreateError" intptr, int, int ; res = WsCreateError(varptr(properties), propertyCount, error) ; properties : WS_ERROR_PROPERTY* optional -> "intptr" ; propertyCount : DWORD -> "int" ; error : WS_ERROR** out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsCreateError = webservices.NewProc("WsCreateError")
)
// properties (WS_ERROR_PROPERTY* optional), propertyCount (DWORD), error (WS_ERROR** out)
r1, _, err := procWsCreateError.Call(
uintptr(properties),
uintptr(propertyCount),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsCreateError(
properties: Pointer; // WS_ERROR_PROPERTY* optional
propertyCount: DWORD; // DWORD
error: Pointer // WS_ERROR** out
): Integer; stdcall;
external 'webservices.dll' name 'WsCreateError';result := DllCall("webservices\WsCreateError"
, "Ptr", properties ; WS_ERROR_PROPERTY* optional
, "UInt", propertyCount ; DWORD
, "Ptr", error ; WS_ERROR** out
, "Int") ; return: HRESULT●WsCreateError(properties, propertyCount, error) = DLL("webservices.dll", "int WsCreateError(void*, dword, void*)")
# 呼び出し: WsCreateError(properties, propertyCount, error)
# properties : WS_ERROR_PROPERTY* optional -> "void*"
# propertyCount : DWORD -> "dword"
# error : WS_ERROR** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。