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