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セッション設定を指定するWDS_TRANSPORTCLIENT_REQUEST構造体。
pCallerDatavoid*inコールバックに渡される任意の呼び出し側データ。NULL可。
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)。
const std = @import("std");

extern "wdstptc" fn WdsTransportClientInitializeSession(
    pSessionRequest: [*c]WDS_TRANSPORTCLIENT_REQUEST, // WDS_TRANSPORTCLIENT_REQUEST*
    pCallerData: ?*anyopaque, // void*
    hSessionKey: ?*anyopaque // HANDLE* out
) callconv(std.os.windows.WINAPI) u32;
proc WdsTransportClientInitializeSession(
    pSessionRequest: ptr WDS_TRANSPORTCLIENT_REQUEST,  # WDS_TRANSPORTCLIENT_REQUEST*
    pCallerData: pointer,  # void*
    hSessionKey: pointer  # HANDLE* out
): uint32 {.importc: "WdsTransportClientInitializeSession", stdcall, dynlib: "WDSTPTC.dll".}
pragma(lib, "wdstptc");
extern(Windows)
uint WdsTransportClientInitializeSession(
    WDS_TRANSPORTCLIENT_REQUEST* pSessionRequest,   // WDS_TRANSPORTCLIENT_REQUEST*
    void* pCallerData,   // void*
    void* hSessionKey   // HANDLE* out
);
ccall((:WdsTransportClientInitializeSession, "WDSTPTC.dll"), stdcall, UInt32,
      (Ptr{WDS_TRANSPORTCLIENT_REQUEST}, Ptr{Cvoid}, Ptr{Cvoid}),
      pSessionRequest, pCallerData, hSessionKey)
# pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> Ptr{WDS_TRANSPORTCLIENT_REQUEST}
# pCallerData : void* -> Ptr{Cvoid}
# hSessionKey : HANDLE* out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t WdsTransportClientInitializeSession(
    void* pSessionRequest,
    void* pCallerData,
    void* hSessionKey);
]]
local wdstptc = ffi.load("wdstptc")
-- wdstptc.WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
-- pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*
-- pCallerData : void*
-- hSessionKey : HANDLE* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WDSTPTC.dll');
const WdsTransportClientInitializeSession = lib.func('__stdcall', 'WdsTransportClientInitializeSession', 'uint32_t', ['void *', 'void *', 'void *']);
// WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
// pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> 'void *'
// pCallerData : void* -> 'void *'
// hSessionKey : HANDLE* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WDSTPTC.dll", {
  WdsTransportClientInitializeSession: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey)
// pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> "pointer"
// pCallerData : void* -> "pointer"
// hSessionKey : HANDLE* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t WdsTransportClientInitializeSession(
    void* pSessionRequest,
    void* pCallerData,
    void* hSessionKey);
C, "WDSTPTC.dll");
// $ffi->WdsTransportClientInitializeSession(pSessionRequest, pCallerData, hSessionKey);
// pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*
// pCallerData : void*
// hSessionKey : HANDLE* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wdstptc extends StdCallLibrary {
    Wdstptc INSTANCE = Native.load("wdstptc", Wdstptc.class);
    int WdsTransportClientInitializeSession(
        Pointer pSessionRequest,   // WDS_TRANSPORTCLIENT_REQUEST*
        Pointer pCallerData,   // void*
        Pointer hSessionKey   // HANDLE* out
    );
}
@[Link("wdstptc")]
lib LibWDSTPTC
  fun WdsTransportClientInitializeSession = WdsTransportClientInitializeSession(
    pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST*,   # WDS_TRANSPORTCLIENT_REQUEST*
    pCallerData : Void*,   # void*
    hSessionKey : Void*   # HANDLE* out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WdsTransportClientInitializeSessionNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef WdsTransportClientInitializeSessionDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final WdsTransportClientInitializeSession = DynamicLibrary.open('WDSTPTC.dll')
    .lookupFunction<WdsTransportClientInitializeSessionNative, WdsTransportClientInitializeSessionDart>('WdsTransportClientInitializeSession');
// pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> Pointer<Void>
// pCallerData : void* -> Pointer<Void>
// hSessionKey : HANDLE* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WdsTransportClientInitializeSession(
  pSessionRequest: Pointer;   // WDS_TRANSPORTCLIENT_REQUEST*
  pCallerData: Pointer;   // void*
  hSessionKey: Pointer   // HANDLE* out
): DWORD; stdcall;
  external 'WDSTPTC.dll' name 'WdsTransportClientInitializeSession';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WdsTransportClientInitializeSession"
  c_WdsTransportClientInitializeSession :: Ptr () -> Ptr () -> Ptr () -> IO Word32
-- pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> Ptr ()
-- pCallerData : void* -> Ptr ()
-- hSessionKey : HANDLE* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wdstransportclientinitializesession =
  foreign "WdsTransportClientInitializeSession"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> (ptr void) *)
(* pCallerData : void* -> (ptr void) *)
(* hSessionKey : HANDLE* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wdstptc (t "WDSTPTC.dll"))
(cffi:use-foreign-library wdstptc)

(cffi:defcfun ("WdsTransportClientInitializeSession" wds-transport-client-initialize-session :convention :stdcall) :uint32
  (p-session-request :pointer)   ; WDS_TRANSPORTCLIENT_REQUEST*
  (p-caller-data :pointer)   ; void*
  (h-session-key :pointer))   ; HANDLE* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WdsTransportClientInitializeSession = Win32::API::More->new('WDSTPTC',
    'DWORD WdsTransportClientInitializeSession(LPVOID pSessionRequest, LPVOID pCallerData, HANDLE hSessionKey)');
# my $ret = $WdsTransportClientInitializeSession->Call($pSessionRequest, $pCallerData, $hSessionKey);
# pSessionRequest : WDS_TRANSPORTCLIENT_REQUEST* -> LPVOID
# pCallerData : void* -> LPVOID
# hSessionKey : HANDLE* out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型