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