ホーム › Security.Credentials › OPENCARDNAMEA
OPENCARDNAMEA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwStructSize | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| hwndOwner | HWND | 8/4 | +8 | +4 | 選択ダイアログの親ウィンドウハンドル。NULL可。 |
| hSCardContext | UINT_PTR | 8/4 | +16 | +8 | 確立済みのリソースマネージャーコンテキストハンドル。 |
| lpstrGroupNames | LPSTR | 8/4 | +24 | +12 | 検索対象リーダーグループ名(NUL区切り)(ANSI)。 |
| nMaxGroupNames | DWORD | 4 | +32 | +16 | lpstrGroupNamesバッファの文字数。 |
| lpstrCardNames | LPSTR | 8/4 | +40 | +20 | 検索対象カード名(NUL区切り)(ANSI)。 |
| nMaxCardNames | DWORD | 4 | +48 | +24 | lpstrCardNamesバッファの文字数。 |
| rgguidInterfaces | GUID* | 8/4 | +56 | +28 | カードが備えるべきインターフェイスGUIDの配列。 |
| cguidInterfaces | DWORD | 4 | +64 | +32 | rgguidInterfaces配列の要素数。 |
| lpstrRdr | LPSTR | 8/4 | +72 | +36 | 選択されたリーダー名を受け取るバッファ(ANSI)。 |
| nMaxRdr | DWORD | 4 | +80 | +40 | lpstrRdrバッファの文字数。 |
| lpstrCard | LPSTR | 8/4 | +88 | +44 | 選択されたカード名を受け取るバッファ(ANSI)。 |
| nMaxCard | DWORD | 4 | +96 | +48 | lpstrCardバッファの文字数。 |
| lpstrTitle | LPSTR | 8/4 | +104 | +52 | 選択ダイアログのタイトル文字列(ANSI)。NULL可。 |
| dwFlags | DWORD | 4 | +112 | +56 | ダイアログの動作を制御するフラグ。 |
| pvUserData | void* | 8/4 | +120 | +60 | コールバックに渡すユーザーデータへのポインタ。 |
| dwShareMode | DWORD | 4 | +128 | +64 | カードへの共有アクセスモード。 |
| dwPreferredProtocols | DWORD | 4 | +132 | +68 | 優先する通信プロトコルのビットマスク。 |
| dwActiveProtocol | DWORD | 4 | +136 | +72 | 接続後に有効となったプロトコルを受け取る。 |
| lpfnConnect | LPOCNCONNPROCA | 8/4 | +144 | +76 | カードへ接続するコールバック関数(ANSI)。NULL可。 |
| lpfnCheck | LPOCNCHKPROC | 8/4 | +152 | +80 | カードが条件を満たすか確認するコールバック関数。NULL可。 |
| lpfnDisconnect | LPOCNDSCPROC | 8/4 | +160 | +84 | カードを切断するコールバック関数。NULL可。 |
| hCardHandle | UINT_PTR | 8/4 | +168 | +88 | 接続済みカードのハンドルを受け取る。 |
各言語での定義
#include <windows.h>
// OPENCARDNAMEA (x64 176 / x86 92 バイト)
typedef struct OPENCARDNAMEA {
DWORD dwStructSize;
HWND hwndOwner;
UINT_PTR hSCardContext;
LPSTR lpstrGroupNames;
DWORD nMaxGroupNames;
LPSTR lpstrCardNames;
DWORD nMaxCardNames;
GUID* rgguidInterfaces;
DWORD cguidInterfaces;
LPSTR lpstrRdr;
DWORD nMaxRdr;
LPSTR lpstrCard;
DWORD nMaxCard;
LPSTR lpstrTitle;
DWORD dwFlags;
void* pvUserData;
DWORD dwShareMode;
DWORD dwPreferredProtocols;
DWORD dwActiveProtocol;
LPOCNCONNPROCA lpfnConnect;
LPOCNCHKPROC lpfnCheck;
LPOCNDSCPROC lpfnDisconnect;
UINT_PTR hCardHandle;
} OPENCARDNAMEA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OPENCARDNAMEA
{
public uint dwStructSize;
public IntPtr hwndOwner;
public UIntPtr hSCardContext;
public IntPtr lpstrGroupNames;
public uint nMaxGroupNames;
public IntPtr lpstrCardNames;
public uint nMaxCardNames;
public IntPtr rgguidInterfaces;
public uint cguidInterfaces;
public IntPtr lpstrRdr;
public uint nMaxRdr;
public IntPtr lpstrCard;
public uint nMaxCard;
public IntPtr lpstrTitle;
public uint dwFlags;
public IntPtr pvUserData;
public uint dwShareMode;
public uint dwPreferredProtocols;
public uint dwActiveProtocol;
public IntPtr lpfnConnect;
public IntPtr lpfnCheck;
public IntPtr lpfnDisconnect;
public UIntPtr hCardHandle;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OPENCARDNAMEA
Public dwStructSize As UInteger
Public hwndOwner As IntPtr
Public hSCardContext As UIntPtr
Public lpstrGroupNames As IntPtr
Public nMaxGroupNames As UInteger
Public lpstrCardNames As IntPtr
Public nMaxCardNames As UInteger
Public rgguidInterfaces As IntPtr
Public cguidInterfaces As UInteger
Public lpstrRdr As IntPtr
Public nMaxRdr As UInteger
Public lpstrCard As IntPtr
Public nMaxCard As UInteger
Public lpstrTitle As IntPtr
Public dwFlags As UInteger
Public pvUserData As IntPtr
Public dwShareMode As UInteger
Public dwPreferredProtocols As UInteger
Public dwActiveProtocol As UInteger
Public lpfnConnect As IntPtr
Public lpfnCheck As IntPtr
Public lpfnDisconnect As IntPtr
Public hCardHandle As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class OPENCARDNAMEA(ctypes.Structure):
_fields_ = [
("dwStructSize", wintypes.DWORD),
("hwndOwner", ctypes.c_void_p),
("hSCardContext", ctypes.c_size_t),
("lpstrGroupNames", ctypes.c_void_p),
("nMaxGroupNames", wintypes.DWORD),
("lpstrCardNames", ctypes.c_void_p),
("nMaxCardNames", wintypes.DWORD),
("rgguidInterfaces", ctypes.c_void_p),
("cguidInterfaces", wintypes.DWORD),
("lpstrRdr", ctypes.c_void_p),
("nMaxRdr", wintypes.DWORD),
("lpstrCard", ctypes.c_void_p),
("nMaxCard", wintypes.DWORD),
("lpstrTitle", ctypes.c_void_p),
("dwFlags", wintypes.DWORD),
("pvUserData", ctypes.c_void_p),
("dwShareMode", wintypes.DWORD),
("dwPreferredProtocols", wintypes.DWORD),
("dwActiveProtocol", wintypes.DWORD),
("lpfnConnect", ctypes.c_void_p),
("lpfnCheck", ctypes.c_void_p),
("lpfnDisconnect", ctypes.c_void_p),
("hCardHandle", ctypes.c_size_t),
]#[repr(C)]
pub struct OPENCARDNAMEA {
pub dwStructSize: u32,
pub hwndOwner: *mut core::ffi::c_void,
pub hSCardContext: usize,
pub lpstrGroupNames: *mut core::ffi::c_void,
pub nMaxGroupNames: u32,
pub lpstrCardNames: *mut core::ffi::c_void,
pub nMaxCardNames: u32,
pub rgguidInterfaces: *mut core::ffi::c_void,
pub cguidInterfaces: u32,
pub lpstrRdr: *mut core::ffi::c_void,
pub nMaxRdr: u32,
pub lpstrCard: *mut core::ffi::c_void,
pub nMaxCard: u32,
pub lpstrTitle: *mut core::ffi::c_void,
pub dwFlags: u32,
pub pvUserData: *mut core::ffi::c_void,
pub dwShareMode: u32,
pub dwPreferredProtocols: u32,
pub dwActiveProtocol: u32,
pub lpfnConnect: *mut core::ffi::c_void,
pub lpfnCheck: *mut core::ffi::c_void,
pub lpfnDisconnect: *mut core::ffi::c_void,
pub hCardHandle: usize,
}import "golang.org/x/sys/windows"
type OPENCARDNAMEA struct {
dwStructSize uint32
hwndOwner uintptr
hSCardContext uintptr
lpstrGroupNames uintptr
nMaxGroupNames uint32
lpstrCardNames uintptr
nMaxCardNames uint32
rgguidInterfaces uintptr
cguidInterfaces uint32
lpstrRdr uintptr
nMaxRdr uint32
lpstrCard uintptr
nMaxCard uint32
lpstrTitle uintptr
dwFlags uint32
pvUserData uintptr
dwShareMode uint32
dwPreferredProtocols uint32
dwActiveProtocol uint32
lpfnConnect uintptr
lpfnCheck uintptr
lpfnDisconnect uintptr
hCardHandle uintptr
}type
OPENCARDNAMEA = record
dwStructSize: DWORD;
hwndOwner: Pointer;
hSCardContext: NativeUInt;
lpstrGroupNames: Pointer;
nMaxGroupNames: DWORD;
lpstrCardNames: Pointer;
nMaxCardNames: DWORD;
rgguidInterfaces: Pointer;
cguidInterfaces: DWORD;
lpstrRdr: Pointer;
nMaxRdr: DWORD;
lpstrCard: Pointer;
nMaxCard: DWORD;
lpstrTitle: Pointer;
dwFlags: DWORD;
pvUserData: Pointer;
dwShareMode: DWORD;
dwPreferredProtocols: DWORD;
dwActiveProtocol: DWORD;
lpfnConnect: Pointer;
lpfnCheck: Pointer;
lpfnDisconnect: Pointer;
hCardHandle: NativeUInt;
end;const OPENCARDNAMEA = extern struct {
dwStructSize: u32,
hwndOwner: ?*anyopaque,
hSCardContext: usize,
lpstrGroupNames: ?*anyopaque,
nMaxGroupNames: u32,
lpstrCardNames: ?*anyopaque,
nMaxCardNames: u32,
rgguidInterfaces: ?*anyopaque,
cguidInterfaces: u32,
lpstrRdr: ?*anyopaque,
nMaxRdr: u32,
lpstrCard: ?*anyopaque,
nMaxCard: u32,
lpstrTitle: ?*anyopaque,
dwFlags: u32,
pvUserData: ?*anyopaque,
dwShareMode: u32,
dwPreferredProtocols: u32,
dwActiveProtocol: u32,
lpfnConnect: ?*anyopaque,
lpfnCheck: ?*anyopaque,
lpfnDisconnect: ?*anyopaque,
hCardHandle: usize,
};type
OPENCARDNAMEA {.bycopy.} = object
dwStructSize: uint32
hwndOwner: pointer
hSCardContext: uint
lpstrGroupNames: pointer
nMaxGroupNames: uint32
lpstrCardNames: pointer
nMaxCardNames: uint32
rgguidInterfaces: pointer
cguidInterfaces: uint32
lpstrRdr: pointer
nMaxRdr: uint32
lpstrCard: pointer
nMaxCard: uint32
lpstrTitle: pointer
dwFlags: uint32
pvUserData: pointer
dwShareMode: uint32
dwPreferredProtocols: uint32
dwActiveProtocol: uint32
lpfnConnect: pointer
lpfnCheck: pointer
lpfnDisconnect: pointer
hCardHandle: uintstruct OPENCARDNAMEA
{
uint dwStructSize;
void* hwndOwner;
size_t hSCardContext;
void* lpstrGroupNames;
uint nMaxGroupNames;
void* lpstrCardNames;
uint nMaxCardNames;
void* rgguidInterfaces;
uint cguidInterfaces;
void* lpstrRdr;
uint nMaxRdr;
void* lpstrCard;
uint nMaxCard;
void* lpstrTitle;
uint dwFlags;
void* pvUserData;
uint dwShareMode;
uint dwPreferredProtocols;
uint dwActiveProtocol;
void* lpfnConnect;
void* lpfnCheck;
void* lpfnDisconnect;
size_t hCardHandle;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OPENCARDNAMEA サイズ: 92 バイト(x86)
dim st, 23 ; 4byte整数×23(構造体サイズ 92 / 4 切り上げ)
; dwStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hSCardContext : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lpstrGroupNames : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; nMaxGroupNames : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lpstrCardNames : LPSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; nMaxCardNames : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; rgguidInterfaces : GUID* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; cguidInterfaces : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpstrRdr : LPSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; nMaxRdr : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lpstrCard : LPSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; nMaxCard : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; lpstrTitle : LPSTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; dwFlags : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; pvUserData : void* (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; dwShareMode : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwPreferredProtocols : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; dwActiveProtocol : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; lpfnConnect : LPOCNCONNPROCA (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; lpfnCheck : LPOCNCHKPROC (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; lpfnDisconnect : LPOCNDSCPROC (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; hCardHandle : UINT_PTR (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPENCARDNAMEA サイズ: 176 バイト(x64)
dim st, 44 ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; dwStructSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hwndOwner : HWND (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hSCardContext : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpstrGroupNames : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; nMaxGroupNames : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpstrCardNames : LPSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; nMaxCardNames : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; rgguidInterfaces : GUID* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; cguidInterfaces : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; lpstrRdr : LPSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; nMaxRdr : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; lpstrCard : LPSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; nMaxCard : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; lpstrTitle : LPSTR (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; dwFlags : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; pvUserData : void* (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; dwShareMode : DWORD (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; dwPreferredProtocols : DWORD (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; dwActiveProtocol : DWORD (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; lpfnConnect : LPOCNCONNPROCA (+144, 8byte) qpoke st,144,値 / qpeek(st,144) ※IronHSPのみ。3.7/3.8は lpoke st,144,下位 : lpoke st,148,上位
; lpfnCheck : LPOCNCHKPROC (+152, 8byte) qpoke st,152,値 / qpeek(st,152) ※IronHSPのみ。3.7/3.8は lpoke st,152,下位 : lpoke st,156,上位
; lpfnDisconnect : LPOCNDSCPROC (+160, 8byte) qpoke st,160,値 / qpeek(st,160) ※IronHSPのみ。3.7/3.8は lpoke st,160,下位 : lpoke st,164,上位
; hCardHandle : UINT_PTR (+168, 8byte) qpoke st,168,値 / qpeek(st,168) ※IronHSPのみ。3.7/3.8は lpoke st,168,下位 : lpoke st,172,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OPENCARDNAMEA
#field int dwStructSize
#field intptr hwndOwner
#field intptr hSCardContext
#field intptr lpstrGroupNames
#field int nMaxGroupNames
#field intptr lpstrCardNames
#field int nMaxCardNames
#field intptr rgguidInterfaces
#field int cguidInterfaces
#field intptr lpstrRdr
#field int nMaxRdr
#field intptr lpstrCard
#field int nMaxCard
#field intptr lpstrTitle
#field int dwFlags
#field intptr pvUserData
#field int dwShareMode
#field int dwPreferredProtocols
#field int dwActiveProtocol
#field intptr lpfnConnect
#field intptr lpfnCheck
#field intptr lpfnDisconnect
#field intptr hCardHandle
#endstruct
stdim st, OPENCARDNAMEA ; NSTRUCT 変数を確保
st->dwStructSize = 100
mes "dwStructSize=" + st->dwStructSize