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

SCardForgetCardTypeW

関数
登録済みのスマートカード種別を削除する。
DLLWinSCard.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows XP 以降

シグネチャ

// WinSCard.dll  (Unicode / -W)
#include <windows.h>

INT SCardForgetCardTypeW(
    UINT_PTR hContext,
    LPCWSTR szCardName
);

パラメーター

名前方向
hContextUINT_PTRin
szCardNameLPCWSTRin

戻り値の型: INT

各言語での呼び出し定義

// WinSCard.dll  (Unicode / -W)
#include <windows.h>

INT SCardForgetCardTypeW(
    UINT_PTR hContext,
    LPCWSTR szCardName
);
[DllImport("WinSCard.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int SCardForgetCardTypeW(
    UIntPtr hContext,   // UINT_PTR
    [MarshalAs(UnmanagedType.LPWStr)] string szCardName   // LPCWSTR
);
<DllImport("WinSCard.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SCardForgetCardTypeW(
    hContext As UIntPtr,   ' UINT_PTR
    <MarshalAs(UnmanagedType.LPWStr)> szCardName As String   ' LPCWSTR
) As Integer
End Function
' hContext : UINT_PTR
' szCardName : LPCWSTR
Declare PtrSafe Function SCardForgetCardTypeW Lib "winscard" ( _
    ByVal hContext As LongPtr, _
    ByVal szCardName As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

lib = Fiddle.dlopen('WinSCard.dll')
SCardForgetCardTypeW = Fiddle::Function.new(
  lib['SCardForgetCardTypeW'],
  [
    Fiddle::TYPE_UINTPTR_T,  # hContext : UINT_PTR
    Fiddle::TYPE_VOIDP,  # szCardName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "winscard")]
extern "system" {
    fn SCardForgetCardTypeW(
        hContext: usize,  // UINT_PTR
        szCardName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinSCard.dll", CharSet = CharSet.Unicode)]
public static extern int SCardForgetCardTypeW(UIntPtr hContext, [MarshalAs(UnmanagedType.LPWStr)] string szCardName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinSCard_SCardForgetCardTypeW' -Namespace Win32 -PassThru
# $api::SCardForgetCardTypeW(hContext, szCardName)
#uselib "WinSCard.dll"
#func global SCardForgetCardTypeW "SCardForgetCardTypeW" wptr, wptr
; SCardForgetCardTypeW hContext, szCardName   ; 戻り値は stat
; hContext : UINT_PTR -> "wptr"
; szCardName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinSCard.dll"
#cfunc global SCardForgetCardTypeW "SCardForgetCardTypeW" sptr, wstr
; res = SCardForgetCardTypeW(hContext, szCardName)
; hContext : UINT_PTR -> "sptr"
; szCardName : LPCWSTR -> "wstr"
; INT SCardForgetCardTypeW(UINT_PTR hContext, LPCWSTR szCardName)
#uselib "WinSCard.dll"
#cfunc global SCardForgetCardTypeW "SCardForgetCardTypeW" intptr, wstr
; res = SCardForgetCardTypeW(hContext, szCardName)
; hContext : UINT_PTR -> "intptr"
; szCardName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winscard = windows.NewLazySystemDLL("WinSCard.dll")
	procSCardForgetCardTypeW = winscard.NewProc("SCardForgetCardTypeW")
)

// hContext (UINT_PTR), szCardName (LPCWSTR)
r1, _, err := procSCardForgetCardTypeW.Call(
	uintptr(hContext),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szCardName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function SCardForgetCardTypeW(
  hContext: NativeUInt;   // UINT_PTR
  szCardName: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'WinSCard.dll' name 'SCardForgetCardTypeW';
result := DllCall("WinSCard\SCardForgetCardTypeW"
    , "UPtr", hContext   ; UINT_PTR
    , "WStr", szCardName   ; LPCWSTR
    , "Int")   ; return: INT
●SCardForgetCardTypeW(hContext, szCardName) = DLL("WinSCard.dll", "int SCardForgetCardTypeW(int, char*)")
# 呼び出し: SCardForgetCardTypeW(hContext, szCardName)
# hContext : UINT_PTR -> "int"
# szCardName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。