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

SCardReleaseContext

関数
スマートカードのリソースマネージャーコンテキストを解放する。
DLLWinSCard.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

INT SCardReleaseContext(
    UINT_PTR hContext
);

パラメーター

名前方向
hContextUINT_PTRin

戻り値の型: INT

各言語での呼び出し定義

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

INT SCardReleaseContext(
    UINT_PTR hContext
);
[DllImport("WinSCard.dll", ExactSpelling = true)]
static extern int SCardReleaseContext(
    UIntPtr hContext   // UINT_PTR
);
<DllImport("WinSCard.dll", ExactSpelling:=True)>
Public Shared Function SCardReleaseContext(
    hContext As UIntPtr   ' UINT_PTR
) As Integer
End Function
' hContext : UINT_PTR
Declare PtrSafe Function SCardReleaseContext 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

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

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

var (
	winscard = windows.NewLazySystemDLL("WinSCard.dll")
	procSCardReleaseContext = winscard.NewProc("SCardReleaseContext")
)

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