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)。
const std = @import("std");

extern "wdstptc" fn WdsTransportClientCancelSessionEx(
    hSessionKey: ?*anyopaque, // HANDLE
    dwErrorCode: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
proc WdsTransportClientCancelSessionEx(
    hSessionKey: pointer,  # HANDLE
    dwErrorCode: uint32  # DWORD
): uint32 {.importc: "WdsTransportClientCancelSessionEx", stdcall, dynlib: "WDSTPTC.dll".}
pragma(lib, "wdstptc");
extern(Windows)
uint WdsTransportClientCancelSessionEx(
    void* hSessionKey,   // HANDLE
    uint dwErrorCode   // DWORD
);
ccall((:WdsTransportClientCancelSessionEx, "WDSTPTC.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, UInt32),
      hSessionKey, dwErrorCode)
# hSessionKey : HANDLE -> Ptr{Cvoid}
# dwErrorCode : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t WdsTransportClientCancelSessionEx(
    void* hSessionKey,
    uint32_t dwErrorCode);
]]
local wdstptc = ffi.load("wdstptc")
-- wdstptc.WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
-- hSessionKey : HANDLE
-- dwErrorCode : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WDSTPTC.dll');
const WdsTransportClientCancelSessionEx = lib.func('__stdcall', 'WdsTransportClientCancelSessionEx', 'uint32_t', ['void *', 'uint32_t']);
// WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
// hSessionKey : HANDLE -> 'void *'
// dwErrorCode : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WDSTPTC.dll", {
  WdsTransportClientCancelSessionEx: { parameters: ["pointer", "u32"], result: "u32" },
});
// lib.symbols.WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode)
// hSessionKey : HANDLE -> "pointer"
// dwErrorCode : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t WdsTransportClientCancelSessionEx(
    void* hSessionKey,
    uint32_t dwErrorCode);
C, "WDSTPTC.dll");
// $ffi->WdsTransportClientCancelSessionEx(hSessionKey, dwErrorCode);
// hSessionKey : HANDLE
// dwErrorCode : DWORD
// 構造体/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 WdsTransportClientCancelSessionEx(
        Pointer hSessionKey,   // HANDLE
        int dwErrorCode   // DWORD
    );
}
@[Link("wdstptc")]
lib LibWDSTPTC
  fun WdsTransportClientCancelSessionEx = WdsTransportClientCancelSessionEx(
    hSessionKey : Void*,   # HANDLE
    dwErrorCode : UInt32   # DWORD
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

foreign import stdcall safe "WdsTransportClientCancelSessionEx"
  c_WdsTransportClientCancelSessionEx :: Ptr () -> Word32 -> IO Word32
-- hSessionKey : HANDLE -> Ptr ()
-- dwErrorCode : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

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

(cffi:defcfun ("WdsTransportClientCancelSessionEx" wds-transport-client-cancel-session-ex :convention :stdcall) :uint32
  (h-session-key :pointer)   ; HANDLE
  (dw-error-code :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WdsTransportClientCancelSessionEx = Win32::API::More->new('WDSTPTC',
    'DWORD WdsTransportClientCancelSessionEx(HANDLE hSessionKey, DWORD dwErrorCode)');
# my $ret = $WdsTransportClientCancelSessionEx->Call($hSessionKey, $dwErrorCode);
# hSessionKey : HANDLE -> HANDLE
# dwErrorCode : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API