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

WdsTransportClientCancelSessionEx

関数
エラーコード付きでWDS転送セッションを取り消す(拡張)。
DLLWDSTPTC.dll呼出規約winapi

シグネチャ

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

DWORD WdsTransportClientCancelSessionEx(
    HANDLE hSessionKey,
    DWORD dwErrorCode
);

パラメーター

名前方向
hSessionKeyHANDLEin
dwErrorCodeDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

WdsTransportClientCancelSessionEx = ctypes.windll.wdstptc.WdsTransportClientCancelSessionEx
WdsTransportClientCancelSessionEx.restype = wintypes.DWORD
WdsTransportClientCancelSessionEx.argtypes = [
    wintypes.HANDLE,  # hSessionKey : HANDLE
    wintypes.DWORD,  # dwErrorCode : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WDSTPTC.dll')
WdsTransportClientCancelSessionEx = Fiddle::Function.new(
  lib['WdsTransportClientCancelSessionEx'],
  [
    Fiddle::TYPE_VOIDP,  # hSessionKey : HANDLE
    -Fiddle::TYPE_INT,  # dwErrorCode : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wdstptc")]
extern "system" {
    fn WdsTransportClientCancelSessionEx(
        hSessionKey: *mut core::ffi::c_void,  // HANDLE
        dwErrorCode: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WDSTPTC.dll")]
public static extern uint WdsTransportClientCancelSessionEx(IntPtr hSessionKey, uint dwErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSTPTC_WdsTransportClientCancelSessionEx' -Namespace Win32 -PassThru
# $api::WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
#uselib "WDSTPTC.dll"
#func global WdsTransportClientCancelSessionEx "WdsTransportClientCancelSessionEx" sptr, sptr
; WdsTransportClientCancelSessionEx hSessionKey, dwErrorCode   ; 戻り値は stat
; hSessionKey : HANDLE -> "sptr"
; dwErrorCode : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WDSTPTC.dll"
#cfunc global WdsTransportClientCancelSessionEx "WdsTransportClientCancelSessionEx" sptr, int
; res = WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
; hSessionKey : HANDLE -> "sptr"
; dwErrorCode : DWORD -> "int"
; DWORD WdsTransportClientCancelSessionEx(HANDLE hSessionKey, DWORD dwErrorCode)
#uselib "WDSTPTC.dll"
#cfunc global WdsTransportClientCancelSessionEx "WdsTransportClientCancelSessionEx" intptr, int
; res = WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
; hSessionKey : HANDLE -> "intptr"
; dwErrorCode : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wdstptc = windows.NewLazySystemDLL("WDSTPTC.dll")
	procWdsTransportClientCancelSessionEx = wdstptc.NewProc("WdsTransportClientCancelSessionEx")
)

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