ホーム › Networking.WindowsWebServices › WsPullBytes
WsPullBytes
関数コールバック経由でXMLにバイト列をプル書き込みする。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsPullBytes(
WS_XML_WRITER* writer,
WS_PULL_BYTES_CALLBACK callback,
void* callbackState, // optional
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| writer | WS_XML_WRITER* | in |
| callback | WS_PULL_BYTES_CALLBACK | in |
| callbackState | void* | inoptional |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsPullBytes(
WS_XML_WRITER* writer,
WS_PULL_BYTES_CALLBACK callback,
void* callbackState, // optional
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsPullBytes(
ref IntPtr writer, // WS_XML_WRITER*
IntPtr callback, // WS_PULL_BYTES_CALLBACK
IntPtr callbackState, // void* optional
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsPullBytes(
ByRef writer As IntPtr, ' WS_XML_WRITER*
callback As IntPtr, ' WS_PULL_BYTES_CALLBACK
callbackState As IntPtr, ' void* optional
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' writer : WS_XML_WRITER*
' callback : WS_PULL_BYTES_CALLBACK
' callbackState : void* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsPullBytes Lib "webservices" ( _
ByRef writer As LongPtr, _
ByVal callback As LongPtr, _
ByVal callbackState 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
WsPullBytes = ctypes.windll.webservices.WsPullBytes
WsPullBytes.restype = ctypes.c_int
WsPullBytes.argtypes = [
ctypes.c_void_p, # writer : WS_XML_WRITER*
ctypes.c_void_p, # callback : WS_PULL_BYTES_CALLBACK
ctypes.POINTER(None), # callbackState : void* optional
ctypes.c_void_p, # error : WS_ERROR* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsPullBytes = Fiddle::Function.new(
lib['WsPullBytes'],
[
Fiddle::TYPE_VOIDP, # writer : WS_XML_WRITER*
Fiddle::TYPE_VOIDP, # callback : WS_PULL_BYTES_CALLBACK
Fiddle::TYPE_VOIDP, # callbackState : void* optional
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsPullBytes(
writer: *mut isize, // WS_XML_WRITER*
callback: *const core::ffi::c_void, // WS_PULL_BYTES_CALLBACK
callbackState: *mut (), // void* 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 WsPullBytes(ref IntPtr writer, IntPtr callback, IntPtr callbackState, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsPullBytes' -Namespace Win32 -PassThru
# $api::WsPullBytes(writer, callback, callbackState, error)#uselib "webservices.dll"
#func global WsPullBytes "WsPullBytes" sptr, sptr, sptr, sptr
; WsPullBytes writer, callback, callbackState, error ; 戻り値は stat
; writer : WS_XML_WRITER* -> "sptr"
; callback : WS_PULL_BYTES_CALLBACK -> "sptr"
; callbackState : void* optional -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "webservices.dll"
#cfunc global WsPullBytes "WsPullBytes" int, sptr, sptr, int
; res = WsPullBytes(writer, callback, callbackState, error)
; writer : WS_XML_WRITER* -> "int"
; callback : WS_PULL_BYTES_CALLBACK -> "sptr"
; callbackState : void* optional -> "sptr"
; error : WS_ERROR* optional -> "int"; HRESULT WsPullBytes(WS_XML_WRITER* writer, WS_PULL_BYTES_CALLBACK callback, void* callbackState, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsPullBytes "WsPullBytes" int, intptr, intptr, int
; res = WsPullBytes(writer, callback, callbackState, error)
; writer : WS_XML_WRITER* -> "int"
; callback : WS_PULL_BYTES_CALLBACK -> "intptr"
; callbackState : void* optional -> "intptr"
; error : WS_ERROR* optional -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsPullBytes = webservices.NewProc("WsPullBytes")
)
// writer (WS_XML_WRITER*), callback (WS_PULL_BYTES_CALLBACK), callbackState (void* optional), error (WS_ERROR* optional)
r1, _, err := procWsPullBytes.Call(
uintptr(writer),
uintptr(callback),
uintptr(callbackState),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsPullBytes(
writer: Pointer; // WS_XML_WRITER*
callback: Pointer; // WS_PULL_BYTES_CALLBACK
callbackState: Pointer; // void* optional
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsPullBytes';result := DllCall("webservices\WsPullBytes"
, "Ptr", writer ; WS_XML_WRITER*
, "Ptr", callback ; WS_PULL_BYTES_CALLBACK
, "Ptr", callbackState ; void* optional
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsPullBytes(writer, callback, callbackState, error) = DLL("webservices.dll", "int WsPullBytes(void*, void*, void*, void*)")
# 呼び出し: WsPullBytes(writer, callback, callbackState, error)
# writer : WS_XML_WRITER* -> "void*"
# callback : WS_PULL_BYTES_CALLBACK -> "void*"
# callbackState : void* optional -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。