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