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