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

SCardIntroduceReaderGroupA

関数
新しいリーダーグループをシステムに登録する。
DLLWinSCard.dll文字セットANSI (-A)呼出規約winapi対応OSWindows XP 以降

シグネチャ

// WinSCard.dll  (ANSI / -A)
#include <windows.h>

INT SCardIntroduceReaderGroupA(
    UINT_PTR hContext,
    LPCSTR szGroupName
);

パラメーター

名前方向
hContextUINT_PTRin
szGroupNameLPCSTRin

戻り値の型: INT

各言語での呼び出し定義

// WinSCard.dll  (ANSI / -A)
#include <windows.h>

INT SCardIntroduceReaderGroupA(
    UINT_PTR hContext,
    LPCSTR szGroupName
);
[DllImport("WinSCard.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int SCardIntroduceReaderGroupA(
    UIntPtr hContext,   // UINT_PTR
    [MarshalAs(UnmanagedType.LPStr)] string szGroupName   // LPCSTR
);
<DllImport("WinSCard.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SCardIntroduceReaderGroupA(
    hContext As UIntPtr,   ' UINT_PTR
    <MarshalAs(UnmanagedType.LPStr)> szGroupName As String   ' LPCSTR
) As Integer
End Function
' hContext : UINT_PTR
' szGroupName : LPCSTR
Declare PtrSafe Function SCardIntroduceReaderGroupA Lib "winscard" ( _
    ByVal hContext As LongPtr, _
    ByVal szGroupName As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	winscard = windows.NewLazySystemDLL("WinSCard.dll")
	procSCardIntroduceReaderGroupA = winscard.NewProc("SCardIntroduceReaderGroupA")
)

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