Win32 API 日本語リファレンス
ホームSecurity.Credentials › SCardCancel

SCardCancel

関数
未完了のスマートカード状態変化待機を取り消す。
DLLWinSCard.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

INT SCardCancel(
    UINT_PTR hContext
);

パラメーター

名前方向
hContextUINT_PTRin

戻り値の型: INT

各言語での呼び出し定義

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

INT SCardCancel(
    UINT_PTR hContext
);
[DllImport("WinSCard.dll", ExactSpelling = true)]
static extern int SCardCancel(
    UIntPtr hContext   // UINT_PTR
);
<DllImport("WinSCard.dll", ExactSpelling:=True)>
Public Shared Function SCardCancel(
    hContext As UIntPtr   ' UINT_PTR
) As Integer
End Function
' hContext : UINT_PTR
Declare PtrSafe Function SCardCancel Lib "winscard" ( _
    ByVal hContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SCardCancel = ctypes.windll.winscard.SCardCancel
SCardCancel.restype = ctypes.c_int
SCardCancel.argtypes = [
    ctypes.c_size_t,  # hContext : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinSCard.dll')
SCardCancel = Fiddle::Function.new(
  lib['SCardCancel'],
  [
    Fiddle::TYPE_UINTPTR_T,  # hContext : UINT_PTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "winscard")]
extern "system" {
    fn SCardCancel(
        hContext: usize  // UINT_PTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinSCard.dll")]
public static extern int SCardCancel(UIntPtr hContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinSCard_SCardCancel' -Namespace Win32 -PassThru
# $api::SCardCancel(hContext)
#uselib "WinSCard.dll"
#func global SCardCancel "SCardCancel" sptr
; SCardCancel hContext   ; 戻り値は stat
; hContext : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinSCard.dll"
#cfunc global SCardCancel "SCardCancel" sptr
; res = SCardCancel(hContext)
; hContext : UINT_PTR -> "sptr"
; INT SCardCancel(UINT_PTR hContext)
#uselib "WinSCard.dll"
#cfunc global SCardCancel "SCardCancel" intptr
; res = SCardCancel(hContext)
; hContext : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winscard = windows.NewLazySystemDLL("WinSCard.dll")
	procSCardCancel = winscard.NewProc("SCardCancel")
)

// hContext (UINT_PTR)
r1, _, err := procSCardCancel.Call(
	uintptr(hContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function SCardCancel(
  hContext: NativeUInt   // UINT_PTR
): Integer; stdcall;
  external 'WinSCard.dll' name 'SCardCancel';
result := DllCall("WinSCard\SCardCancel"
    , "UPtr", hContext   ; UINT_PTR
    , "Int")   ; return: INT
●SCardCancel(hContext) = DLL("WinSCard.dll", "int SCardCancel(int)")
# 呼び出し: SCardCancel(hContext)
# hContext : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。