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

WsWriteType

関数
指定型の値をシリアライズしXMLライターに書き込む。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsWriteType(
    WS_XML_WRITER* writer,
    WS_TYPE_MAPPING typeMapping,
    WS_TYPE type,
    const void* typeDescription,   // optional
    WS_WRITE_OPTION writeOption,
    const void* value,   // optional
    DWORD valueSize,
    WS_ERROR* error   // optional
);

パラメーター

名前方向
writerWS_XML_WRITER*in
typeMappingWS_TYPE_MAPPINGin
typeWS_TYPEin
typeDescriptionvoid*inoptional
writeOptionWS_WRITE_OPTIONin
valuevoid*inoptional
valueSizeDWORDin
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsWriteType(
    WS_XML_WRITER* writer,
    WS_TYPE_MAPPING typeMapping,
    WS_TYPE type,
    const void* typeDescription,   // optional
    WS_WRITE_OPTION writeOption,
    const void* value,   // optional
    DWORD valueSize,
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsWriteType(
    ref IntPtr writer,   // WS_XML_WRITER*
    int typeMapping,   // WS_TYPE_MAPPING
    int type,   // WS_TYPE
    IntPtr typeDescription,   // void* optional
    int writeOption,   // WS_WRITE_OPTION
    IntPtr value,   // void* optional
    uint valueSize,   // DWORD
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsWriteType(
    ByRef writer As IntPtr,   ' WS_XML_WRITER*
    typeMapping As Integer,   ' WS_TYPE_MAPPING
    type As Integer,   ' WS_TYPE
    typeDescription As IntPtr,   ' void* optional
    writeOption As Integer,   ' WS_WRITE_OPTION
    value As IntPtr,   ' void* optional
    valueSize As UInteger,   ' DWORD
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' writer : WS_XML_WRITER*
' typeMapping : WS_TYPE_MAPPING
' type : WS_TYPE
' typeDescription : void* optional
' writeOption : WS_WRITE_OPTION
' value : void* optional
' valueSize : DWORD
' error : WS_ERROR* optional
Declare PtrSafe Function WsWriteType Lib "webservices" ( _
    ByRef writer As LongPtr, _
    ByVal typeMapping As Long, _
    ByVal type As Long, _
    ByVal typeDescription As LongPtr, _
    ByVal writeOption As Long, _
    ByVal value As LongPtr, _
    ByVal valueSize 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

WsWriteType = ctypes.windll.webservices.WsWriteType
WsWriteType.restype = ctypes.c_int
WsWriteType.argtypes = [
    ctypes.c_void_p,  # writer : WS_XML_WRITER*
    ctypes.c_int,  # typeMapping : WS_TYPE_MAPPING
    ctypes.c_int,  # type : WS_TYPE
    ctypes.POINTER(None),  # typeDescription : void* optional
    ctypes.c_int,  # writeOption : WS_WRITE_OPTION
    ctypes.POINTER(None),  # value : void* optional
    wintypes.DWORD,  # valueSize : DWORD
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsWriteType = Fiddle::Function.new(
  lib['WsWriteType'],
  [
    Fiddle::TYPE_VOIDP,  # writer : WS_XML_WRITER*
    Fiddle::TYPE_INT,  # typeMapping : WS_TYPE_MAPPING
    Fiddle::TYPE_INT,  # type : WS_TYPE
    Fiddle::TYPE_VOIDP,  # typeDescription : void* optional
    Fiddle::TYPE_INT,  # writeOption : WS_WRITE_OPTION
    Fiddle::TYPE_VOIDP,  # value : void* optional
    -Fiddle::TYPE_INT,  # valueSize : DWORD
    Fiddle::TYPE_VOIDP,  # error : WS_ERROR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsWriteType(
        writer: *mut isize,  // WS_XML_WRITER*
        typeMapping: i32,  // WS_TYPE_MAPPING
        type: i32,  // WS_TYPE
        typeDescription: *const (),  // void* optional
        writeOption: i32,  // WS_WRITE_OPTION
        value: *const (),  // void* optional
        valueSize: 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 WsWriteType(ref IntPtr writer, int typeMapping, int type, IntPtr typeDescription, int writeOption, IntPtr value, uint valueSize, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsWriteType' -Namespace Win32 -PassThru
# $api::WsWriteType(writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error)
#uselib "webservices.dll"
#func global WsWriteType "WsWriteType" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WsWriteType writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error   ; 戻り値は stat
; writer : WS_XML_WRITER* -> "sptr"
; typeMapping : WS_TYPE_MAPPING -> "sptr"
; type : WS_TYPE -> "sptr"
; typeDescription : void* optional -> "sptr"
; writeOption : WS_WRITE_OPTION -> "sptr"
; value : void* optional -> "sptr"
; valueSize : DWORD -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "webservices.dll"
#cfunc global WsWriteType "WsWriteType" int, int, int, sptr, int, sptr, int, int
; res = WsWriteType(writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error)
; writer : WS_XML_WRITER* -> "int"
; typeMapping : WS_TYPE_MAPPING -> "int"
; type : WS_TYPE -> "int"
; typeDescription : void* optional -> "sptr"
; writeOption : WS_WRITE_OPTION -> "int"
; value : void* optional -> "sptr"
; valueSize : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
; HRESULT WsWriteType(WS_XML_WRITER* writer, WS_TYPE_MAPPING typeMapping, WS_TYPE type, void* typeDescription, WS_WRITE_OPTION writeOption, void* value, DWORD valueSize, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsWriteType "WsWriteType" int, int, int, intptr, int, intptr, int, int
; res = WsWriteType(writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error)
; writer : WS_XML_WRITER* -> "int"
; typeMapping : WS_TYPE_MAPPING -> "int"
; type : WS_TYPE -> "int"
; typeDescription : void* optional -> "intptr"
; writeOption : WS_WRITE_OPTION -> "int"
; value : void* optional -> "intptr"
; valueSize : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsWriteType = webservices.NewProc("WsWriteType")
)

// writer (WS_XML_WRITER*), typeMapping (WS_TYPE_MAPPING), type (WS_TYPE), typeDescription (void* optional), writeOption (WS_WRITE_OPTION), value (void* optional), valueSize (DWORD), error (WS_ERROR* optional)
r1, _, err := procWsWriteType.Call(
	uintptr(writer),
	uintptr(typeMapping),
	uintptr(type),
	uintptr(typeDescription),
	uintptr(writeOption),
	uintptr(value),
	uintptr(valueSize),
	uintptr(error),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WsWriteType(
  writer: Pointer;   // WS_XML_WRITER*
  typeMapping: Integer;   // WS_TYPE_MAPPING
  type: Integer;   // WS_TYPE
  typeDescription: Pointer;   // void* optional
  writeOption: Integer;   // WS_WRITE_OPTION
  value: Pointer;   // void* optional
  valueSize: DWORD;   // DWORD
  error: Pointer   // WS_ERROR* optional
): Integer; stdcall;
  external 'webservices.dll' name 'WsWriteType';
result := DllCall("webservices\WsWriteType"
    , "Ptr", writer   ; WS_XML_WRITER*
    , "Int", typeMapping   ; WS_TYPE_MAPPING
    , "Int", type   ; WS_TYPE
    , "Ptr", typeDescription   ; void* optional
    , "Int", writeOption   ; WS_WRITE_OPTION
    , "Ptr", value   ; void* optional
    , "UInt", valueSize   ; DWORD
    , "Ptr", error   ; WS_ERROR* optional
    , "Int")   ; return: HRESULT
●WsWriteType(writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error) = DLL("webservices.dll", "int WsWriteType(void*, int, int, void*, int, void*, dword, void*)")
# 呼び出し: WsWriteType(writer, typeMapping, type, typeDescription, writeOption, value, valueSize, error)
# writer : WS_XML_WRITER* -> "void*"
# typeMapping : WS_TYPE_MAPPING -> "int"
# type : WS_TYPE -> "int"
# typeDescription : void* optional -> "void*"
# writeOption : WS_WRITE_OPTION -> "int"
# value : void* optional -> "void*"
# valueSize : DWORD -> "dword"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。