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