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