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