Win32 API 日本語リファレンス
ホームSystem.DeploymentServices › WdsTransportClientInitializeSession

WdsTransportClientInitializeSession

関数
WDSトランスポートクライアントの転送セッションを初期化する。
DLLWDSTPTC.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// WDSTPTC.dll
#include <windows.h>

DWORD WdsTransportClientInitializeSession(
    WDS_TRANSPORTCLIENT_REQUEST* pSessionRequest,
    void* pCallerData,
    HANDLE* hSessionKey
);

パラメーター

名前方向
pSessionRequestWDS_TRANSPORTCLIENT_REQUEST*in
pCallerDatavoid*in
hSessionKeyHANDLE*out

戻り値の型: DWORD

各言語での呼び出し定義

// WDSTPTC.dll
#include <windows.h>

DWORD WdsTransportClientInitializeSession(
    WDS_TRANSPORTCLIENT_REQUEST* pSessionRequest,
    void* pCallerData,
    HANDLE* hSessionKey
);
[DllImport("WDSTPTC.dll", ExactSpelling = true)]
static extern uint WdsTransportClientInitializeSession(
    IntPtr pSessionRequest,   // WDS_TRANSPORTCLIENT_REQUEST*
    IntPtr pCallerData,   // void*
    IntPtr hSessionKey   // HANDLE* out
);
<DllImport("WDSTPTC.dll", ExactSpelling:=True)>
Public Shared Function WdsTransportClientInitializeSession(
    pSessionRequest As IntPtr,   ' WDS_TRANSPORTCLIENT_REQUEST*
    pCallerData As IntPtr,   ' void*
    hSessionKey As IntPtr   ' HANDLE* out
) As UInteger
End Function
' pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*
' pCallerData : void*
' hSessionKey : HANDLE* out
Declare PtrSafe Function WdsTransportClientInitializeSession Lib "wdstptc" ( _
    ByVal pSessionRequest As LongPtr, _
    ByVal pCallerData As LongPtr, _
    ByVal hSessionKey As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WdsTransportClientInitializeSession = ctypes.windll.wdstptc.WdsTransportClientInitializeSession
WdsTransportClientInitializeSession.restype = wintypes.DWORD
WdsTransportClientInitializeSession.argtypes = [
    ctypes.c_void_p,  # pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*
    ctypes.POINTER(None),  # pCallerData : void*
    ctypes.c_void_p,  # hSessionKey : HANDLE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WDSTPTC.dll')
WdsTransportClientInitializeSession = Fiddle::Function.new(
  lib['WdsTransportClientInitializeSession'],
  [
    Fiddle::TYPE_VOIDP,  # pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*
    Fiddle::TYPE_VOIDP,  # pCallerData : void*
    Fiddle::TYPE_VOIDP,  # hSessionKey : HANDLE* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wdstptc")]
extern "system" {
    fn WdsTransportClientInitializeSession(
        pSessionRequest: *mut WDS_TRANSPORTCLIENT_REQUEST,  // WDS_TRANSPORTCLIENT_REQUEST*
        pCallerData: *mut (),  // void*
        hSessionKey: *mut *mut core::ffi::c_void  // HANDLE* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WDSTPTC.dll")]
public static extern uint WdsTransportClientInitializeSession(IntPtr pSessionRequest, IntPtr pCallerData, IntPtr hSessionKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSTPTC_WdsTransportClientInitializeSession' -Namespace Win32 -PassThru
# $api::WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
#uselib "WDSTPTC.dll"
#func global WdsTransportClientInitializeSession "WdsTransportClientInitializeSession" sptr, sptr, sptr
; WdsTransportClientInitializeSession varptr(pSessionRequest), pCallerData, hSessionKey   ; 戻り値は stat
; pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> "sptr"
; pCallerData : void* -> "sptr"
; hSessionKey : HANDLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WDSTPTC.dll"
#cfunc global WdsTransportClientInitializeSession "WdsTransportClientInitializeSession" var, sptr, sptr
; res = WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
; pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> "var"
; pCallerData : void* -> "sptr"
; hSessionKey : HANDLE* out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD WdsTransportClientInitializeSession(WDS_TRANSPORTCLIENT_REQUEST* pSessionRequest, void* pCallerData, HANDLE* hSessionKey)
#uselib "WDSTPTC.dll"
#cfunc global WdsTransportClientInitializeSession "WdsTransportClientInitializeSession" var, intptr, intptr
; res = WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
; pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> "var"
; pCallerData : void* -> "intptr"
; hSessionKey : HANDLE* out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wdstptc = windows.NewLazySystemDLL("WDSTPTC.dll")
	procWdsTransportClientInitializeSession = wdstptc.NewProc("WdsTransportClientInitializeSession")
)

// pSessionRequest (WDS_TRANSPORTCLIENT_REQUEST*), pCallerData (void*), hSessionKey (HANDLE* out)
r1, _, err := procWdsTransportClientInitializeSession.Call(
	uintptr(pSessionRequest),
	uintptr(pCallerData),
	uintptr(hSessionKey),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WdsTransportClientInitializeSession(
  pSessionRequest: Pointer;   // WDS_TRANSPORTCLIENT_REQUEST*
  pCallerData: Pointer;   // void*
  hSessionKey: Pointer   // HANDLE* out
): DWORD; stdcall;
  external 'WDSTPTC.dll' name 'WdsTransportClientInitializeSession';
result := DllCall("WDSTPTC\WdsTransportClientInitializeSession"
    , "Ptr", pSessionRequest   ; WDS_TRANSPORTCLIENT_REQUEST*
    , "Ptr", pCallerData   ; void*
    , "Ptr", hSessionKey   ; HANDLE* out
    , "UInt")   ; return: DWORD
●WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey) = DLL("WDSTPTC.dll", "dword WdsTransportClientInitializeSession(void*, void*, void*)")
# 呼び出し: WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
# pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> "void*"
# pCallerData : void* -> "void*"
# hSessionKey : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。