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

WsCopyError

関数
エラーオブジェクトを別のエラーへコピーする。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsCopyError(
    WS_ERROR* source,
    WS_ERROR* destination
);

パラメーター

名前方向
sourceWS_ERROR*in
destinationWS_ERROR*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsCopyError(
    WS_ERROR* source,
    WS_ERROR* destination
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsCopyError(
    ref IntPtr source,   // WS_ERROR*
    ref IntPtr destination   // WS_ERROR*
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsCopyError(
    ByRef source As IntPtr,   ' WS_ERROR*
    ByRef destination As IntPtr   ' WS_ERROR*
) As Integer
End Function
' source : WS_ERROR*
' destination : WS_ERROR*
Declare PtrSafe Function WsCopyError Lib "webservices" ( _
    ByRef source As LongPtr, _
    ByRef destination As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsCopyError = ctypes.windll.webservices.WsCopyError
WsCopyError.restype = ctypes.c_int
WsCopyError.argtypes = [
    ctypes.c_void_p,  # source : WS_ERROR*
    ctypes.c_void_p,  # destination : WS_ERROR*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsCopyError = Fiddle::Function.new(
  lib['WsCopyError'],
  [
    Fiddle::TYPE_VOIDP,  # source : WS_ERROR*
    Fiddle::TYPE_VOIDP,  # destination : WS_ERROR*
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsCopyError(
        source: *mut isize,  // WS_ERROR*
        destination: *mut isize  // WS_ERROR*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("webservices.dll")]
public static extern int WsCopyError(ref IntPtr source, ref IntPtr destination);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsCopyError' -Namespace Win32 -PassThru
# $api::WsCopyError(source, destination)
#uselib "webservices.dll"
#func global WsCopyError "WsCopyError" sptr, sptr
; WsCopyError source, destination   ; 戻り値は stat
; source : WS_ERROR* -> "sptr"
; destination : WS_ERROR* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "webservices.dll"
#cfunc global WsCopyError "WsCopyError" int, int
; res = WsCopyError(source, destination)
; source : WS_ERROR* -> "int"
; destination : WS_ERROR* -> "int"
; HRESULT WsCopyError(WS_ERROR* source, WS_ERROR* destination)
#uselib "webservices.dll"
#cfunc global WsCopyError "WsCopyError" int, int
; res = WsCopyError(source, destination)
; source : WS_ERROR* -> "int"
; destination : WS_ERROR* -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsCopyError = webservices.NewProc("WsCopyError")
)

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