ホーム › Networking.WindowsWebServices › WsGetSecurityTokenProperty
WsGetSecurityTokenProperty
関数セキュリティトークンの指定したプロパティ値を取得する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsGetSecurityTokenProperty(
WS_SECURITY_TOKEN* securityToken,
WS_SECURITY_TOKEN_PROPERTY_ID id,
void* value,
DWORD valueSize,
WS_HEAP* heap, // optional
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| securityToken | WS_SECURITY_TOKEN* | in |
| id | WS_SECURITY_TOKEN_PROPERTY_ID | in |
| value | void* | out |
| valueSize | DWORD | in |
| heap | WS_HEAP* | inoptional |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsGetSecurityTokenProperty(
WS_SECURITY_TOKEN* securityToken,
WS_SECURITY_TOKEN_PROPERTY_ID id,
void* value,
DWORD valueSize,
WS_HEAP* heap, // optional
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsGetSecurityTokenProperty(
ref IntPtr securityToken, // WS_SECURITY_TOKEN*
int id, // WS_SECURITY_TOKEN_PROPERTY_ID
IntPtr value, // void* out
uint valueSize, // DWORD
IntPtr heap, // WS_HEAP* optional
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsGetSecurityTokenProperty(
ByRef securityToken As IntPtr, ' WS_SECURITY_TOKEN*
id As Integer, ' WS_SECURITY_TOKEN_PROPERTY_ID
value As IntPtr, ' void* out
valueSize As UInteger, ' DWORD
heap As IntPtr, ' WS_HEAP* optional
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' securityToken : WS_SECURITY_TOKEN*
' id : WS_SECURITY_TOKEN_PROPERTY_ID
' value : void* out
' valueSize : DWORD
' heap : WS_HEAP* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsGetSecurityTokenProperty Lib "webservices" ( _
ByRef securityToken As LongPtr, _
ByVal id As Long, _
ByVal value As LongPtr, _
ByVal valueSize As Long, _
ByVal heap 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
WsGetSecurityTokenProperty = ctypes.windll.webservices.WsGetSecurityTokenProperty
WsGetSecurityTokenProperty.restype = ctypes.c_int
WsGetSecurityTokenProperty.argtypes = [
ctypes.c_void_p, # securityToken : WS_SECURITY_TOKEN*
ctypes.c_int, # id : WS_SECURITY_TOKEN_PROPERTY_ID
ctypes.POINTER(None), # value : void* out
wintypes.DWORD, # valueSize : DWORD
ctypes.c_void_p, # heap : WS_HEAP* optional
ctypes.c_void_p, # error : WS_ERROR* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsGetSecurityTokenProperty = Fiddle::Function.new(
lib['WsGetSecurityTokenProperty'],
[
Fiddle::TYPE_VOIDP, # securityToken : WS_SECURITY_TOKEN*
Fiddle::TYPE_INT, # id : WS_SECURITY_TOKEN_PROPERTY_ID
Fiddle::TYPE_VOIDP, # value : void* out
-Fiddle::TYPE_INT, # valueSize : DWORD
Fiddle::TYPE_VOIDP, # heap : WS_HEAP* optional
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsGetSecurityTokenProperty(
securityToken: *mut isize, // WS_SECURITY_TOKEN*
id: i32, // WS_SECURITY_TOKEN_PROPERTY_ID
value: *mut (), // void* out
valueSize: u32, // DWORD
heap: *mut isize, // WS_HEAP* 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 WsGetSecurityTokenProperty(ref IntPtr securityToken, int id, IntPtr value, uint valueSize, IntPtr heap, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsGetSecurityTokenProperty' -Namespace Win32 -PassThru
# $api::WsGetSecurityTokenProperty(securityToken, id, value, valueSize, heap, error)#uselib "webservices.dll"
#func global WsGetSecurityTokenProperty "WsGetSecurityTokenProperty" sptr, sptr, sptr, sptr, sptr, sptr
; WsGetSecurityTokenProperty securityToken, id, value, valueSize, heap, error ; 戻り値は stat
; securityToken : WS_SECURITY_TOKEN* -> "sptr"
; id : WS_SECURITY_TOKEN_PROPERTY_ID -> "sptr"
; value : void* out -> "sptr"
; valueSize : DWORD -> "sptr"
; heap : WS_HEAP* optional -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "webservices.dll"
#cfunc global WsGetSecurityTokenProperty "WsGetSecurityTokenProperty" int, int, sptr, int, int, int
; res = WsGetSecurityTokenProperty(securityToken, id, value, valueSize, heap, error)
; securityToken : WS_SECURITY_TOKEN* -> "int"
; id : WS_SECURITY_TOKEN_PROPERTY_ID -> "int"
; value : void* out -> "sptr"
; valueSize : DWORD -> "int"
; heap : WS_HEAP* optional -> "int"
; error : WS_ERROR* optional -> "int"; HRESULT WsGetSecurityTokenProperty(WS_SECURITY_TOKEN* securityToken, WS_SECURITY_TOKEN_PROPERTY_ID id, void* value, DWORD valueSize, WS_HEAP* heap, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsGetSecurityTokenProperty "WsGetSecurityTokenProperty" int, int, intptr, int, int, int
; res = WsGetSecurityTokenProperty(securityToken, id, value, valueSize, heap, error)
; securityToken : WS_SECURITY_TOKEN* -> "int"
; id : WS_SECURITY_TOKEN_PROPERTY_ID -> "int"
; value : void* out -> "intptr"
; valueSize : DWORD -> "int"
; heap : WS_HEAP* optional -> "int"
; error : WS_ERROR* optional -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsGetSecurityTokenProperty = webservices.NewProc("WsGetSecurityTokenProperty")
)
// securityToken (WS_SECURITY_TOKEN*), id (WS_SECURITY_TOKEN_PROPERTY_ID), value (void* out), valueSize (DWORD), heap (WS_HEAP* optional), error (WS_ERROR* optional)
r1, _, err := procWsGetSecurityTokenProperty.Call(
uintptr(securityToken),
uintptr(id),
uintptr(value),
uintptr(valueSize),
uintptr(heap),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsGetSecurityTokenProperty(
securityToken: Pointer; // WS_SECURITY_TOKEN*
id: Integer; // WS_SECURITY_TOKEN_PROPERTY_ID
value: Pointer; // void* out
valueSize: DWORD; // DWORD
heap: Pointer; // WS_HEAP* optional
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsGetSecurityTokenProperty';result := DllCall("webservices\WsGetSecurityTokenProperty"
, "Ptr", securityToken ; WS_SECURITY_TOKEN*
, "Int", id ; WS_SECURITY_TOKEN_PROPERTY_ID
, "Ptr", value ; void* out
, "UInt", valueSize ; DWORD
, "Ptr", heap ; WS_HEAP* optional
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsGetSecurityTokenProperty(securityToken, id, value, valueSize, heap, error) = DLL("webservices.dll", "int WsGetSecurityTokenProperty(void*, int, void*, dword, void*, void*)")
# 呼び出し: WsGetSecurityTokenProperty(securityToken, id, value, valueSize, heap, error)
# securityToken : WS_SECURITY_TOKEN* -> "void*"
# id : WS_SECURITY_TOKEN_PROPERTY_ID -> "int"
# value : void* out -> "void*"
# valueSize : DWORD -> "dword"
# heap : WS_HEAP* optional -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。