ホーム › Networking.WindowsWebServices › WsCall
WsCall
関数サービスプロキシを介してサービス操作を呼び出す。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsCall(
WS_SERVICE_PROXY* serviceProxy,
const WS_OPERATION_DESCRIPTION* operation,
const void** arguments, // optional
WS_HEAP* heap,
const WS_CALL_PROPERTY* callProperties, // optional
DWORD callPropertyCount,
const WS_ASYNC_CONTEXT* asyncContext, // optional
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| serviceProxy | WS_SERVICE_PROXY* | in |
| operation | WS_OPERATION_DESCRIPTION* | in |
| arguments | void** | inoptional |
| heap | WS_HEAP* | in |
| callProperties | WS_CALL_PROPERTY* | inoptional |
| callPropertyCount | DWORD | in |
| asyncContext | WS_ASYNC_CONTEXT* | inoptional |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsCall(
WS_SERVICE_PROXY* serviceProxy,
const WS_OPERATION_DESCRIPTION* operation,
const void** arguments, // optional
WS_HEAP* heap,
const WS_CALL_PROPERTY* callProperties, // optional
DWORD callPropertyCount,
const WS_ASYNC_CONTEXT* asyncContext, // optional
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsCall(
ref IntPtr serviceProxy, // WS_SERVICE_PROXY*
IntPtr operation, // WS_OPERATION_DESCRIPTION*
IntPtr arguments, // void** optional
ref IntPtr heap, // WS_HEAP*
IntPtr callProperties, // WS_CALL_PROPERTY* optional
uint callPropertyCount, // DWORD
IntPtr asyncContext, // WS_ASYNC_CONTEXT* optional
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsCall(
ByRef serviceProxy As IntPtr, ' WS_SERVICE_PROXY*
operation As IntPtr, ' WS_OPERATION_DESCRIPTION*
arguments As IntPtr, ' void** optional
ByRef heap As IntPtr, ' WS_HEAP*
callProperties As IntPtr, ' WS_CALL_PROPERTY* optional
callPropertyCount As UInteger, ' DWORD
asyncContext As IntPtr, ' WS_ASYNC_CONTEXT* optional
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' serviceProxy : WS_SERVICE_PROXY*
' operation : WS_OPERATION_DESCRIPTION*
' arguments : void** optional
' heap : WS_HEAP*
' callProperties : WS_CALL_PROPERTY* optional
' callPropertyCount : DWORD
' asyncContext : WS_ASYNC_CONTEXT* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsCall Lib "webservices" ( _
ByRef serviceProxy As LongPtr, _
ByVal operation As LongPtr, _
ByVal arguments As LongPtr, _
ByRef heap As LongPtr, _
ByVal callProperties As LongPtr, _
ByVal callPropertyCount As Long, _
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
WsCall = ctypes.windll.webservices.WsCall
WsCall.restype = ctypes.c_int
WsCall.argtypes = [
ctypes.c_void_p, # serviceProxy : WS_SERVICE_PROXY*
ctypes.c_void_p, # operation : WS_OPERATION_DESCRIPTION*
ctypes.c_void_p, # arguments : void** optional
ctypes.c_void_p, # heap : WS_HEAP*
ctypes.c_void_p, # callProperties : WS_CALL_PROPERTY* optional
wintypes.DWORD, # callPropertyCount : DWORD
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')
WsCall = Fiddle::Function.new(
lib['WsCall'],
[
Fiddle::TYPE_VOIDP, # serviceProxy : WS_SERVICE_PROXY*
Fiddle::TYPE_VOIDP, # operation : WS_OPERATION_DESCRIPTION*
Fiddle::TYPE_VOIDP, # arguments : void** optional
Fiddle::TYPE_VOIDP, # heap : WS_HEAP*
Fiddle::TYPE_VOIDP, # callProperties : WS_CALL_PROPERTY* optional
-Fiddle::TYPE_INT, # callPropertyCount : DWORD
Fiddle::TYPE_VOIDP, # asyncContext : WS_ASYNC_CONTEXT* optional
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsCall(
serviceProxy: *mut isize, // WS_SERVICE_PROXY*
operation: *const WS_OPERATION_DESCRIPTION, // WS_OPERATION_DESCRIPTION*
arguments: *const *const (), // void** optional
heap: *mut isize, // WS_HEAP*
callProperties: *const WS_CALL_PROPERTY, // WS_CALL_PROPERTY* optional
callPropertyCount: u32, // DWORD
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 WsCall(ref IntPtr serviceProxy, IntPtr operation, IntPtr arguments, ref IntPtr heap, IntPtr callProperties, uint callPropertyCount, IntPtr asyncContext, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsCall' -Namespace Win32 -PassThru
# $api::WsCall(serviceProxy, operation, arguments, heap, callProperties, callPropertyCount, asyncContext, error)#uselib "webservices.dll"
#func global WsCall "WsCall" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WsCall serviceProxy, varptr(operation), arguments, heap, varptr(callProperties), callPropertyCount, varptr(asyncContext), error ; 戻り値は stat
; serviceProxy : WS_SERVICE_PROXY* -> "sptr"
; operation : WS_OPERATION_DESCRIPTION* -> "sptr"
; arguments : void** optional -> "sptr"
; heap : WS_HEAP* -> "sptr"
; callProperties : WS_CALL_PROPERTY* optional -> "sptr"
; callPropertyCount : DWORD -> "sptr"
; asyncContext : WS_ASYNC_CONTEXT* optional -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "webservices.dll" #cfunc global WsCall "WsCall" int, var, sptr, int, var, int, var, int ; res = WsCall(serviceProxy, operation, arguments, heap, callProperties, callPropertyCount, asyncContext, error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; operation : WS_OPERATION_DESCRIPTION* -> "var" ; arguments : void** optional -> "sptr" ; heap : WS_HEAP* -> "int" ; callProperties : WS_CALL_PROPERTY* optional -> "var" ; callPropertyCount : DWORD -> "int" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "webservices.dll" #cfunc global WsCall "WsCall" int, sptr, sptr, int, sptr, int, sptr, int ; res = WsCall(serviceProxy, varptr(operation), arguments, heap, varptr(callProperties), callPropertyCount, varptr(asyncContext), error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; operation : WS_OPERATION_DESCRIPTION* -> "sptr" ; arguments : void** optional -> "sptr" ; heap : WS_HEAP* -> "int" ; callProperties : WS_CALL_PROPERTY* optional -> "sptr" ; callPropertyCount : DWORD -> "int" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "sptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsCall(WS_SERVICE_PROXY* serviceProxy, WS_OPERATION_DESCRIPTION* operation, void** arguments, WS_HEAP* heap, WS_CALL_PROPERTY* callProperties, DWORD callPropertyCount, WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsCall "WsCall" int, var, intptr, int, var, int, var, int ; res = WsCall(serviceProxy, operation, arguments, heap, callProperties, callPropertyCount, asyncContext, error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; operation : WS_OPERATION_DESCRIPTION* -> "var" ; arguments : void** optional -> "intptr" ; heap : WS_HEAP* -> "int" ; callProperties : WS_CALL_PROPERTY* optional -> "var" ; callPropertyCount : DWORD -> "int" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsCall(WS_SERVICE_PROXY* serviceProxy, WS_OPERATION_DESCRIPTION* operation, void** arguments, WS_HEAP* heap, WS_CALL_PROPERTY* callProperties, DWORD callPropertyCount, WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsCall "WsCall" int, intptr, intptr, int, intptr, int, intptr, int ; res = WsCall(serviceProxy, varptr(operation), arguments, heap, varptr(callProperties), callPropertyCount, varptr(asyncContext), error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; operation : WS_OPERATION_DESCRIPTION* -> "intptr" ; arguments : void** optional -> "intptr" ; heap : WS_HEAP* -> "int" ; callProperties : WS_CALL_PROPERTY* optional -> "intptr" ; callPropertyCount : DWORD -> "int" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "intptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsCall = webservices.NewProc("WsCall")
)
// serviceProxy (WS_SERVICE_PROXY*), operation (WS_OPERATION_DESCRIPTION*), arguments (void** optional), heap (WS_HEAP*), callProperties (WS_CALL_PROPERTY* optional), callPropertyCount (DWORD), asyncContext (WS_ASYNC_CONTEXT* optional), error (WS_ERROR* optional)
r1, _, err := procWsCall.Call(
uintptr(serviceProxy),
uintptr(operation),
uintptr(arguments),
uintptr(heap),
uintptr(callProperties),
uintptr(callPropertyCount),
uintptr(asyncContext),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsCall(
serviceProxy: Pointer; // WS_SERVICE_PROXY*
operation: Pointer; // WS_OPERATION_DESCRIPTION*
arguments: Pointer; // void** optional
heap: Pointer; // WS_HEAP*
callProperties: Pointer; // WS_CALL_PROPERTY* optional
callPropertyCount: DWORD; // DWORD
asyncContext: Pointer; // WS_ASYNC_CONTEXT* optional
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsCall';result := DllCall("webservices\WsCall"
, "Ptr", serviceProxy ; WS_SERVICE_PROXY*
, "Ptr", operation ; WS_OPERATION_DESCRIPTION*
, "Ptr", arguments ; void** optional
, "Ptr", heap ; WS_HEAP*
, "Ptr", callProperties ; WS_CALL_PROPERTY* optional
, "UInt", callPropertyCount ; DWORD
, "Ptr", asyncContext ; WS_ASYNC_CONTEXT* optional
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsCall(serviceProxy, operation, arguments, heap, callProperties, callPropertyCount, asyncContext, error) = DLL("webservices.dll", "int WsCall(void*, void*, void*, void*, void*, dword, void*, void*)")
# 呼び出し: WsCall(serviceProxy, operation, arguments, heap, callProperties, callPropertyCount, asyncContext, error)
# serviceProxy : WS_SERVICE_PROXY* -> "void*"
# operation : WS_OPERATION_DESCRIPTION* -> "void*"
# arguments : void** optional -> "void*"
# heap : WS_HEAP* -> "void*"
# callProperties : WS_CALL_PROPERTY* optional -> "void*"
# callPropertyCount : DWORD -> "dword"
# asyncContext : WS_ASYNC_CONTEXT* optional -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。