ホーム › Security.Credentials › SCardListInterfacesA
SCardListInterfacesA
関数指定カードがサポートするインターフェイスを列挙する。
シグネチャ
// WinSCard.dll (ANSI / -A)
#include <windows.h>
INT SCardListInterfacesA(
UINT_PTR hContext,
LPCSTR szCard,
GUID* pguidInterfaces,
DWORD* pcguidInterfaces
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hContext | UINT_PTR | in |
| szCard | LPCSTR | in |
| pguidInterfaces | GUID* | out |
| pcguidInterfaces | DWORD* | inout |
戻り値の型: INT
各言語での呼び出し定義
// WinSCard.dll (ANSI / -A)
#include <windows.h>
INT SCardListInterfacesA(
UINT_PTR hContext,
LPCSTR szCard,
GUID* pguidInterfaces,
DWORD* pcguidInterfaces
);[DllImport("WinSCard.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int SCardListInterfacesA(
UIntPtr hContext, // UINT_PTR
[MarshalAs(UnmanagedType.LPStr)] string szCard, // LPCSTR
out Guid pguidInterfaces, // GUID* out
ref uint pcguidInterfaces // DWORD* in/out
);<DllImport("WinSCard.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SCardListInterfacesA(
hContext As UIntPtr, ' UINT_PTR
<MarshalAs(UnmanagedType.LPStr)> szCard As String, ' LPCSTR
<Out> ByRef pguidInterfaces As Guid, ' GUID* out
ByRef pcguidInterfaces As UInteger ' DWORD* in/out
) As Integer
End Function' hContext : UINT_PTR
' szCard : LPCSTR
' pguidInterfaces : GUID* out
' pcguidInterfaces : DWORD* in/out
Declare PtrSafe Function SCardListInterfacesA Lib "winscard" ( _
ByVal hContext As LongPtr, _
ByVal szCard As String, _
ByVal pguidInterfaces As LongPtr, _
ByRef pcguidInterfaces As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SCardListInterfacesA = ctypes.windll.winscard.SCardListInterfacesA
SCardListInterfacesA.restype = ctypes.c_int
SCardListInterfacesA.argtypes = [
ctypes.c_size_t, # hContext : UINT_PTR
wintypes.LPCSTR, # szCard : LPCSTR
ctypes.c_void_p, # pguidInterfaces : GUID* out
ctypes.POINTER(wintypes.DWORD), # pcguidInterfaces : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WinSCard.dll')
SCardListInterfacesA = Fiddle::Function.new(
lib['SCardListInterfacesA'],
[
Fiddle::TYPE_UINTPTR_T, # hContext : UINT_PTR
Fiddle::TYPE_VOIDP, # szCard : LPCSTR
Fiddle::TYPE_VOIDP, # pguidInterfaces : GUID* out
Fiddle::TYPE_VOIDP, # pcguidInterfaces : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "winscard")]
extern "system" {
fn SCardListInterfacesA(
hContext: usize, // UINT_PTR
szCard: *const u8, // LPCSTR
pguidInterfaces: *mut GUID, // GUID* out
pcguidInterfaces: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WinSCard.dll", CharSet = CharSet.Ansi)]
public static extern int SCardListInterfacesA(UIntPtr hContext, [MarshalAs(UnmanagedType.LPStr)] string szCard, out Guid pguidInterfaces, ref uint pcguidInterfaces);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinSCard_SCardListInterfacesA' -Namespace Win32 -PassThru
# $api::SCardListInterfacesA(hContext, szCard, pguidInterfaces, pcguidInterfaces)#uselib "WinSCard.dll"
#func global SCardListInterfacesA "SCardListInterfacesA" sptr, sptr, sptr, sptr
; SCardListInterfacesA hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces) ; 戻り値は stat
; hContext : UINT_PTR -> "sptr"
; szCard : LPCSTR -> "sptr"
; pguidInterfaces : GUID* out -> "sptr"
; pcguidInterfaces : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WinSCard.dll" #cfunc global SCardListInterfacesA "SCardListInterfacesA" sptr, str, var, var ; res = SCardListInterfacesA(hContext, szCard, pguidInterfaces, pcguidInterfaces) ; hContext : UINT_PTR -> "sptr" ; szCard : LPCSTR -> "str" ; pguidInterfaces : GUID* out -> "var" ; pcguidInterfaces : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WinSCard.dll" #cfunc global SCardListInterfacesA "SCardListInterfacesA" sptr, str, sptr, sptr ; res = SCardListInterfacesA(hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces)) ; hContext : UINT_PTR -> "sptr" ; szCard : LPCSTR -> "str" ; pguidInterfaces : GUID* out -> "sptr" ; pcguidInterfaces : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT SCardListInterfacesA(UINT_PTR hContext, LPCSTR szCard, GUID* pguidInterfaces, DWORD* pcguidInterfaces) #uselib "WinSCard.dll" #cfunc global SCardListInterfacesA "SCardListInterfacesA" intptr, str, var, var ; res = SCardListInterfacesA(hContext, szCard, pguidInterfaces, pcguidInterfaces) ; hContext : UINT_PTR -> "intptr" ; szCard : LPCSTR -> "str" ; pguidInterfaces : GUID* out -> "var" ; pcguidInterfaces : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT SCardListInterfacesA(UINT_PTR hContext, LPCSTR szCard, GUID* pguidInterfaces, DWORD* pcguidInterfaces) #uselib "WinSCard.dll" #cfunc global SCardListInterfacesA "SCardListInterfacesA" intptr, str, intptr, intptr ; res = SCardListInterfacesA(hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces)) ; hContext : UINT_PTR -> "intptr" ; szCard : LPCSTR -> "str" ; pguidInterfaces : GUID* out -> "intptr" ; pcguidInterfaces : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winscard = windows.NewLazySystemDLL("WinSCard.dll")
procSCardListInterfacesA = winscard.NewProc("SCardListInterfacesA")
)
// hContext (UINT_PTR), szCard (LPCSTR), pguidInterfaces (GUID* out), pcguidInterfaces (DWORD* in/out)
r1, _, err := procSCardListInterfacesA.Call(
uintptr(hContext),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szCard))),
uintptr(pguidInterfaces),
uintptr(pcguidInterfaces),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SCardListInterfacesA(
hContext: NativeUInt; // UINT_PTR
szCard: PAnsiChar; // LPCSTR
pguidInterfaces: PGUID; // GUID* out
pcguidInterfaces: Pointer // DWORD* in/out
): Integer; stdcall;
external 'WinSCard.dll' name 'SCardListInterfacesA';result := DllCall("WinSCard\SCardListInterfacesA"
, "UPtr", hContext ; UINT_PTR
, "AStr", szCard ; LPCSTR
, "Ptr", pguidInterfaces ; GUID* out
, "Ptr", pcguidInterfaces ; DWORD* in/out
, "Int") ; return: INT●SCardListInterfacesA(hContext, szCard, pguidInterfaces, pcguidInterfaces) = DLL("WinSCard.dll", "int SCardListInterfacesA(int, char*, void*, void*)")
# 呼び出し: SCardListInterfacesA(hContext, szCard, pguidInterfaces, pcguidInterfaces)
# hContext : UINT_PTR -> "int"
# szCard : LPCSTR -> "char*"
# pguidInterfaces : GUID* out -> "void*"
# pcguidInterfaces : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。