ホーム › Security.Credentials › SCardFreeMemory
SCardFreeMemory
関数スマートカードAPIが割り当てたメモリを解放する。
シグネチャ
// WinSCard.dll
#include <windows.h>
INT SCardFreeMemory(
UINT_PTR hContext,
const void* pvMem
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hContext | UINT_PTR | in |
| pvMem | void* | in |
戻り値の型: INT
各言語での呼び出し定義
// WinSCard.dll
#include <windows.h>
INT SCardFreeMemory(
UINT_PTR hContext,
const void* pvMem
);[DllImport("WinSCard.dll", ExactSpelling = true)]
static extern int SCardFreeMemory(
UIntPtr hContext, // UINT_PTR
IntPtr pvMem // void*
);<DllImport("WinSCard.dll", ExactSpelling:=True)>
Public Shared Function SCardFreeMemory(
hContext As UIntPtr, ' UINT_PTR
pvMem As IntPtr ' void*
) As Integer
End Function' hContext : UINT_PTR
' pvMem : void*
Declare PtrSafe Function SCardFreeMemory Lib "winscard" ( _
ByVal hContext As LongPtr, _
ByVal pvMem As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SCardFreeMemory = ctypes.windll.winscard.SCardFreeMemory
SCardFreeMemory.restype = ctypes.c_int
SCardFreeMemory.argtypes = [
ctypes.c_size_t, # hContext : UINT_PTR
ctypes.POINTER(None), # pvMem : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WinSCard.dll')
SCardFreeMemory = Fiddle::Function.new(
lib['SCardFreeMemory'],
[
Fiddle::TYPE_UINTPTR_T, # hContext : UINT_PTR
Fiddle::TYPE_VOIDP, # pvMem : void*
],
Fiddle::TYPE_INT)#[link(name = "winscard")]
extern "system" {
fn SCardFreeMemory(
hContext: usize, // UINT_PTR
pvMem: *const () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WinSCard.dll")]
public static extern int SCardFreeMemory(UIntPtr hContext, IntPtr pvMem);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinSCard_SCardFreeMemory' -Namespace Win32 -PassThru
# $api::SCardFreeMemory(hContext, pvMem)#uselib "WinSCard.dll"
#func global SCardFreeMemory "SCardFreeMemory" sptr, sptr
; SCardFreeMemory hContext, pvMem ; 戻り値は stat
; hContext : UINT_PTR -> "sptr"
; pvMem : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WinSCard.dll"
#cfunc global SCardFreeMemory "SCardFreeMemory" sptr, sptr
; res = SCardFreeMemory(hContext, pvMem)
; hContext : UINT_PTR -> "sptr"
; pvMem : void* -> "sptr"; INT SCardFreeMemory(UINT_PTR hContext, void* pvMem)
#uselib "WinSCard.dll"
#cfunc global SCardFreeMemory "SCardFreeMemory" intptr, intptr
; res = SCardFreeMemory(hContext, pvMem)
; hContext : UINT_PTR -> "intptr"
; pvMem : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winscard = windows.NewLazySystemDLL("WinSCard.dll")
procSCardFreeMemory = winscard.NewProc("SCardFreeMemory")
)
// hContext (UINT_PTR), pvMem (void*)
r1, _, err := procSCardFreeMemory.Call(
uintptr(hContext),
uintptr(pvMem),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SCardFreeMemory(
hContext: NativeUInt; // UINT_PTR
pvMem: Pointer // void*
): Integer; stdcall;
external 'WinSCard.dll' name 'SCardFreeMemory';result := DllCall("WinSCard\SCardFreeMemory"
, "UPtr", hContext ; UINT_PTR
, "Ptr", pvMem ; void*
, "Int") ; return: INT●SCardFreeMemory(hContext, pvMem) = DLL("WinSCard.dll", "int SCardFreeMemory(int, void*)")
# 呼び出し: SCardFreeMemory(hContext, pvMem)
# hContext : UINT_PTR -> "int"
# pvMem : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。