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