ホーム › Security.Credentials › SCardListInterfacesW
SCardListInterfacesW
関数指定カードがサポートするインターフェイスを列挙する。
シグネチャ
// WinSCard.dll (Unicode / -W)
#include <windows.h>
INT SCardListInterfacesW(
UINT_PTR hContext,
LPCWSTR szCard,
GUID* pguidInterfaces,
DWORD* pcguidInterfaces
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hContext | UINT_PTR | in |
| szCard | LPCWSTR | in |
| pguidInterfaces | GUID* | out |
| pcguidInterfaces | DWORD* | inout |
戻り値の型: INT
各言語での呼び出し定義
// WinSCard.dll (Unicode / -W)
#include <windows.h>
INT SCardListInterfacesW(
UINT_PTR hContext,
LPCWSTR szCard,
GUID* pguidInterfaces,
DWORD* pcguidInterfaces
);[DllImport("WinSCard.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int SCardListInterfacesW(
UIntPtr hContext, // UINT_PTR
[MarshalAs(UnmanagedType.LPWStr)] string szCard, // LPCWSTR
out Guid pguidInterfaces, // GUID* out
ref uint pcguidInterfaces // DWORD* in/out
);<DllImport("WinSCard.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SCardListInterfacesW(
hContext As UIntPtr, ' UINT_PTR
<MarshalAs(UnmanagedType.LPWStr)> szCard As String, ' LPCWSTR
<Out> ByRef pguidInterfaces As Guid, ' GUID* out
ByRef pcguidInterfaces As UInteger ' DWORD* in/out
) As Integer
End Function' hContext : UINT_PTR
' szCard : LPCWSTR
' pguidInterfaces : GUID* out
' pcguidInterfaces : DWORD* in/out
Declare PtrSafe Function SCardListInterfacesW Lib "winscard" ( _
ByVal hContext As LongPtr, _
ByVal szCard As LongPtr, _
ByVal pguidInterfaces As LongPtr, _
ByRef pcguidInterfaces As Long) 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
SCardListInterfacesW = ctypes.windll.winscard.SCardListInterfacesW
SCardListInterfacesW.restype = ctypes.c_int
SCardListInterfacesW.argtypes = [
ctypes.c_size_t, # hContext : UINT_PTR
wintypes.LPCWSTR, # szCard : LPCWSTR
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')
SCardListInterfacesW = Fiddle::Function.new(
lib['SCardListInterfacesW'],
[
Fiddle::TYPE_UINTPTR_T, # hContext : UINT_PTR
Fiddle::TYPE_VOIDP, # szCard : LPCWSTR
Fiddle::TYPE_VOIDP, # pguidInterfaces : GUID* out
Fiddle::TYPE_VOIDP, # pcguidInterfaces : DWORD* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "winscard")]
extern "system" {
fn SCardListInterfacesW(
hContext: usize, // UINT_PTR
szCard: *const u16, // LPCWSTR
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.Unicode)]
public static extern int SCardListInterfacesW(UIntPtr hContext, [MarshalAs(UnmanagedType.LPWStr)] string szCard, out Guid pguidInterfaces, ref uint pcguidInterfaces);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinSCard_SCardListInterfacesW' -Namespace Win32 -PassThru
# $api::SCardListInterfacesW(hContext, szCard, pguidInterfaces, pcguidInterfaces)#uselib "WinSCard.dll"
#func global SCardListInterfacesW "SCardListInterfacesW" wptr, wptr, wptr, wptr
; SCardListInterfacesW hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces) ; 戻り値は stat
; hContext : UINT_PTR -> "wptr"
; szCard : LPCWSTR -> "wptr"
; pguidInterfaces : GUID* out -> "wptr"
; pcguidInterfaces : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WinSCard.dll" #cfunc global SCardListInterfacesW "SCardListInterfacesW" sptr, wstr, var, var ; res = SCardListInterfacesW(hContext, szCard, pguidInterfaces, pcguidInterfaces) ; hContext : UINT_PTR -> "sptr" ; szCard : LPCWSTR -> "wstr" ; pguidInterfaces : GUID* out -> "var" ; pcguidInterfaces : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WinSCard.dll" #cfunc global SCardListInterfacesW "SCardListInterfacesW" sptr, wstr, sptr, sptr ; res = SCardListInterfacesW(hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces)) ; hContext : UINT_PTR -> "sptr" ; szCard : LPCWSTR -> "wstr" ; pguidInterfaces : GUID* out -> "sptr" ; pcguidInterfaces : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT SCardListInterfacesW(UINT_PTR hContext, LPCWSTR szCard, GUID* pguidInterfaces, DWORD* pcguidInterfaces) #uselib "WinSCard.dll" #cfunc global SCardListInterfacesW "SCardListInterfacesW" intptr, wstr, var, var ; res = SCardListInterfacesW(hContext, szCard, pguidInterfaces, pcguidInterfaces) ; hContext : UINT_PTR -> "intptr" ; szCard : LPCWSTR -> "wstr" ; pguidInterfaces : GUID* out -> "var" ; pcguidInterfaces : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT SCardListInterfacesW(UINT_PTR hContext, LPCWSTR szCard, GUID* pguidInterfaces, DWORD* pcguidInterfaces) #uselib "WinSCard.dll" #cfunc global SCardListInterfacesW "SCardListInterfacesW" intptr, wstr, intptr, intptr ; res = SCardListInterfacesW(hContext, szCard, varptr(pguidInterfaces), varptr(pcguidInterfaces)) ; hContext : UINT_PTR -> "intptr" ; szCard : LPCWSTR -> "wstr" ; 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")
procSCardListInterfacesW = winscard.NewProc("SCardListInterfacesW")
)
// hContext (UINT_PTR), szCard (LPCWSTR), pguidInterfaces (GUID* out), pcguidInterfaces (DWORD* in/out)
r1, _, err := procSCardListInterfacesW.Call(
uintptr(hContext),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szCard))),
uintptr(pguidInterfaces),
uintptr(pcguidInterfaces),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SCardListInterfacesW(
hContext: NativeUInt; // UINT_PTR
szCard: PWideChar; // LPCWSTR
pguidInterfaces: PGUID; // GUID* out
pcguidInterfaces: Pointer // DWORD* in/out
): Integer; stdcall;
external 'WinSCard.dll' name 'SCardListInterfacesW';result := DllCall("WinSCard\SCardListInterfacesW"
, "UPtr", hContext ; UINT_PTR
, "WStr", szCard ; LPCWSTR
, "Ptr", pguidInterfaces ; GUID* out
, "Ptr", pcguidInterfaces ; DWORD* in/out
, "Int") ; return: INT●SCardListInterfacesW(hContext, szCard, pguidInterfaces, pcguidInterfaces) = DLL("WinSCard.dll", "int SCardListInterfacesW(int, char*, void*, void*)")
# 呼び出し: SCardListInterfacesW(hContext, szCard, pguidInterfaces, pcguidInterfaces)
# hContext : UINT_PTR -> "int"
# szCard : LPCWSTR -> "char*"
# pguidInterfaces : GUID* out -> "void*"
# pcguidInterfaces : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。