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

CARD_DATA

構造体
サイズx64: 504 バイト / x86: 252 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0カードデータ構造体のバージョン番号。
pbAtrBYTE*8/4+8+4カードのATR(Answer To Reset)バイト列へのポインタ。
cbAtrDWORD4+16+8ATRのバイト長。
pwszCardNameLPWSTR8/4+24+12カード名を示すワイド文字列。
pfnCspAllocPFN_CSP_ALLOC8/4+32+16CSPメモリ確保コールバック関数ポインタ。
pfnCspReAllocPFN_CSP_REALLOC8/4+40+20CSPメモリ再確保コールバック関数ポインタ。
pfnCspFreePFN_CSP_FREE8/4+48+24CSPメモリ解放コールバック関数ポインタ。
pfnCspCacheAddFilePFN_CSP_CACHE_ADD_FILE8/4+56+28キャッシュへファイル追加するコールバック関数ポインタ。
pfnCspCacheLookupFilePFN_CSP_CACHE_LOOKUP_FILE8/4+64+32キャッシュからファイル検索するコールバック関数ポインタ。
pfnCspCacheDeleteFilePFN_CSP_CACHE_DELETE_FILE8/4+72+36キャッシュからファイル削除するコールバック関数ポインタ。
pvCacheContextvoid*8/4+80+40キャッシュ操作に渡すコンテキストポインタ。NULL可。
pfnCspPadDataPFN_CSP_PAD_DATA8/4+88+44データにパディングを付すコールバック関数ポインタ。
hSCardCtxUINT_PTR8/4+96+48スマートカードリソースマネージャのコンテキストハンドル。
hScardUINT_PTR8/4+104+52接続中のスマートカードのハンドル。
pvVendorSpecificvoid*8/4+112+56ベンダー固有データへのポインタ。NULL可。
pfnCardDeleteContextPFN_CARD_DELETE_CONTEXT8/4+120+60カードコンテキストを破棄する関数ポインタ。
pfnCardQueryCapabilitiesPFN_CARD_QUERY_CAPABILITIES8/4+128+64カード機能を問い合わせる関数ポインタ。
pfnCardDeleteContainerPFN_CARD_DELETE_CONTAINER8/4+136+68鍵コンテナを削除する関数ポインタ。
pfnCardCreateContainerPFN_CARD_CREATE_CONTAINER8/4+144+72鍵コンテナを作成する関数ポインタ。
pfnCardGetContainerInfoPFN_CARD_GET_CONTAINER_INFO8/4+152+76鍵コンテナ情報を取得する関数ポインタ。
pfnCardAuthenticatePinPFN_CARD_AUTHENTICATE_PIN8/4+160+80PIN認証を行う関数ポインタ。
pfnCardGetChallengePFN_CARD_GET_CHALLENGE8/4+168+84チャレンジ値を取得する関数ポインタ。
pfnCardAuthenticateChallengePFN_CARD_AUTHENTICATE_CHALLENGE8/4+176+88チャレンジ応答認証を行う関数ポインタ。
pfnCardUnblockPinPFN_CARD_UNBLOCK_PIN8/4+184+92PINブロックを解除する関数ポインタ。
pfnCardChangeAuthenticatorPFN_CARD_CHANGE_AUTHENTICATOR8/4+192+96認証子(PIN)を変更する関数ポインタ。
pfnCardDeauthenticatePFN_CARD_DEAUTHENTICATE8/4+200+100認証状態を解除する関数ポインタ。
pfnCardCreateDirectoryPFN_CARD_CREATE_DIRECTORY8/4+208+104カード上にディレクトリを作成する関数ポインタ。
pfnCardDeleteDirectoryPFN_CARD_DELETE_DIRECTORY8/4+216+108カード上のディレクトリを削除する関数ポインタ。
pvUnused3void*8/4+224+112未使用の予約ポインタ。
pvUnused4void*8/4+232+116未使用の予約ポインタ。
pfnCardCreateFilePFN_CARD_CREATE_FILE8/4+240+120カード上にファイルを作成する関数ポインタ。
pfnCardReadFilePFN_CARD_READ_FILE8/4+248+124カード上のファイルを読み取る関数ポインタ。
pfnCardWriteFilePFN_CARD_WRITE_FILE8/4+256+128カード上のファイルへ書き込む関数ポインタ。
pfnCardDeleteFilePFN_CARD_DELETE_FILE8/4+264+132カード上のファイルを削除する関数ポインタ。
pfnCardEnumFilesPFN_CARD_ENUM_FILES8/4+272+136カード上のファイルを列挙する関数ポインタ。
pfnCardGetFileInfoPFN_CARD_GET_FILE_INFO8/4+280+140ファイル情報を取得する関数ポインタ。
pfnCardQueryFreeSpacePFN_CARD_QUERY_FREE_SPACE8/4+288+144空き領域を問い合わせる関数ポインタ。
pfnCardQueryKeySizesPFN_CARD_QUERY_KEY_SIZES8/4+296+148対応鍵サイズを問い合わせる関数ポインタ。
pfnCardSignDataPFN_CARD_SIGN_DATA8/4+304+152データに署名する関数ポインタ。
pfnCardRSADecryptPFN_CARD_RSA_DECRYPT8/4+312+156RSA復号を行う関数ポインタ。
pfnCardConstructDHAgreementPFN_CARD_CONSTRUCT_DH_AGREEMENT8/4+320+160DH鍵共有を構築する関数ポインタ。
pfnCardDeriveKeyPFN_CARD_DERIVE_KEY8/4+328+164鍵導出を行う関数ポインタ。
pfnCardDestroyDHAgreementPFN_CARD_DESTROY_DH_AGREEMENT8/4+336+168DH鍵共有を破棄する関数ポインタ。
pfnCspGetDHAgreementPFN_CSP_GET_DH_AGREEMENT8/4+344+172CSP側のDH鍵共有を取得する関数ポインタ。
pfnCardGetChallengeExPFN_CARD_GET_CHALLENGE_EX8/4+352+176拡張版チャレンジ値を取得する関数ポインタ。
pfnCardAuthenticateExPFN_CARD_AUTHENTICATE_EX8/4+360+180拡張版認証を行う関数ポインタ。
pfnCardChangeAuthenticatorExPFN_CARD_CHANGE_AUTHENTICATOR_EX8/4+368+184拡張版認証子変更を行う関数ポインタ。
pfnCardDeauthenticateExPFN_CARD_DEAUTHENTICATE_EX8/4+376+188拡張版認証解除を行う関数ポインタ。
pfnCardGetContainerPropertyPFN_CARD_GET_CONTAINER_PROPERTY8/4+384+192コンテナプロパティを取得する関数ポインタ。
pfnCardSetContainerPropertyPFN_CARD_SET_CONTAINER_PROPERTY8/4+392+196コンテナプロパティを設定する関数ポインタ。
pfnCardGetPropertyPFN_CARD_GET_PROPERTY8/4+400+200カードプロパティを取得する関数ポインタ。
pfnCardSetPropertyPFN_CARD_SET_PROPERTY8/4+408+204カードプロパティを設定する関数ポインタ。
pfnCspUnpadDataPFN_CSP_UNPAD_DATA8/4+416+208データのパディングを除去する関数ポインタ。
pfnMDImportSessionKeyPFN_MD_IMPORT_SESSION_KEY8/4+424+212ミニドライバへセッション鍵をインポートする関数ポインタ。
pfnMDEncryptDataPFN_MD_ENCRYPT_DATA8/4+432+216ミニドライバでデータを暗号化する関数ポインタ。
pfnCardImportSessionKeyPFN_CARD_IMPORT_SESSION_KEY8/4+440+220カードへセッション鍵をインポートする関数ポインタ。
pfnCardGetSharedKeyHandlePFN_CARD_GET_SHARED_KEY_HANDLE8/4+448+224共有鍵ハンドルを取得する関数ポインタ。
pfnCardGetAlgorithmPropertyPFN_CARD_GET_ALGORITHM_PROPERTY8/4+456+228アルゴリズムプロパティを取得する関数ポインタ。
pfnCardGetKeyPropertyPFN_CARD_GET_KEY_PROPERTY8/4+464+232鍵プロパティを取得する関数ポインタ。
pfnCardSetKeyPropertyPFN_CARD_SET_KEY_PROPERTY8/4+472+236鍵プロパティを設定する関数ポインタ。
pfnCardDestroyKeyPFN_CARD_DESTROY_KEY8/4+480+240鍵を破棄する関数ポインタ。
pfnCardProcessEncryptedDataPFN_CARD_PROCESS_ENCRYPTED_DATA8/4+488+244暗号化データを処理する関数ポインタ。
pfnCardCreateContainerExPFN_CARD_CREATE_CONTAINER_EX8/4+496+248拡張版で鍵コンテナを作成する関数ポインタ。

各言語での定義

#include <windows.h>

// CARD_DATA  (x64 504 / x86 252 バイト)
typedef struct CARD_DATA {
    DWORD dwVersion;
    BYTE* pbAtr;
    DWORD cbAtr;
    LPWSTR pwszCardName;
    PFN_CSP_ALLOC pfnCspAlloc;
    PFN_CSP_REALLOC pfnCspReAlloc;
    PFN_CSP_FREE pfnCspFree;
    PFN_CSP_CACHE_ADD_FILE pfnCspCacheAddFile;
    PFN_CSP_CACHE_LOOKUP_FILE pfnCspCacheLookupFile;
    PFN_CSP_CACHE_DELETE_FILE pfnCspCacheDeleteFile;
    void* pvCacheContext;
    PFN_CSP_PAD_DATA pfnCspPadData;
    UINT_PTR hSCardCtx;
    UINT_PTR hScard;
    void* pvVendorSpecific;
    PFN_CARD_DELETE_CONTEXT pfnCardDeleteContext;
    PFN_CARD_QUERY_CAPABILITIES pfnCardQueryCapabilities;
    PFN_CARD_DELETE_CONTAINER pfnCardDeleteContainer;
    PFN_CARD_CREATE_CONTAINER pfnCardCreateContainer;
    PFN_CARD_GET_CONTAINER_INFO pfnCardGetContainerInfo;
    PFN_CARD_AUTHENTICATE_PIN pfnCardAuthenticatePin;
    PFN_CARD_GET_CHALLENGE pfnCardGetChallenge;
    PFN_CARD_AUTHENTICATE_CHALLENGE pfnCardAuthenticateChallenge;
    PFN_CARD_UNBLOCK_PIN pfnCardUnblockPin;
    PFN_CARD_CHANGE_AUTHENTICATOR pfnCardChangeAuthenticator;
    PFN_CARD_DEAUTHENTICATE pfnCardDeauthenticate;
    PFN_CARD_CREATE_DIRECTORY pfnCardCreateDirectory;
    PFN_CARD_DELETE_DIRECTORY pfnCardDeleteDirectory;
    void* pvUnused3;
    void* pvUnused4;
    PFN_CARD_CREATE_FILE pfnCardCreateFile;
    PFN_CARD_READ_FILE pfnCardReadFile;
    PFN_CARD_WRITE_FILE pfnCardWriteFile;
    PFN_CARD_DELETE_FILE pfnCardDeleteFile;
    PFN_CARD_ENUM_FILES pfnCardEnumFiles;
    PFN_CARD_GET_FILE_INFO pfnCardGetFileInfo;
    PFN_CARD_QUERY_FREE_SPACE pfnCardQueryFreeSpace;
    PFN_CARD_QUERY_KEY_SIZES pfnCardQueryKeySizes;
    PFN_CARD_SIGN_DATA pfnCardSignData;
    PFN_CARD_RSA_DECRYPT pfnCardRSADecrypt;
    PFN_CARD_CONSTRUCT_DH_AGREEMENT pfnCardConstructDHAgreement;
    PFN_CARD_DERIVE_KEY pfnCardDeriveKey;
    PFN_CARD_DESTROY_DH_AGREEMENT pfnCardDestroyDHAgreement;
    PFN_CSP_GET_DH_AGREEMENT pfnCspGetDHAgreement;
    PFN_CARD_GET_CHALLENGE_EX pfnCardGetChallengeEx;
    PFN_CARD_AUTHENTICATE_EX pfnCardAuthenticateEx;
    PFN_CARD_CHANGE_AUTHENTICATOR_EX pfnCardChangeAuthenticatorEx;
    PFN_CARD_DEAUTHENTICATE_EX pfnCardDeauthenticateEx;
    PFN_CARD_GET_CONTAINER_PROPERTY pfnCardGetContainerProperty;
    PFN_CARD_SET_CONTAINER_PROPERTY pfnCardSetContainerProperty;
    PFN_CARD_GET_PROPERTY pfnCardGetProperty;
    PFN_CARD_SET_PROPERTY pfnCardSetProperty;
    PFN_CSP_UNPAD_DATA pfnCspUnpadData;
    PFN_MD_IMPORT_SESSION_KEY pfnMDImportSessionKey;
    PFN_MD_ENCRYPT_DATA pfnMDEncryptData;
    PFN_CARD_IMPORT_SESSION_KEY pfnCardImportSessionKey;
    PFN_CARD_GET_SHARED_KEY_HANDLE pfnCardGetSharedKeyHandle;
    PFN_CARD_GET_ALGORITHM_PROPERTY pfnCardGetAlgorithmProperty;
    PFN_CARD_GET_KEY_PROPERTY pfnCardGetKeyProperty;
    PFN_CARD_SET_KEY_PROPERTY pfnCardSetKeyProperty;
    PFN_CARD_DESTROY_KEY pfnCardDestroyKey;
    PFN_CARD_PROCESS_ENCRYPTED_DATA pfnCardProcessEncryptedData;
    PFN_CARD_CREATE_CONTAINER_EX pfnCardCreateContainerEx;
} CARD_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CARD_DATA
{
    public uint dwVersion;
    public IntPtr pbAtr;
    public uint cbAtr;
    public IntPtr pwszCardName;
    public IntPtr pfnCspAlloc;
    public IntPtr pfnCspReAlloc;
    public IntPtr pfnCspFree;
    public IntPtr pfnCspCacheAddFile;
    public IntPtr pfnCspCacheLookupFile;
    public IntPtr pfnCspCacheDeleteFile;
    public IntPtr pvCacheContext;
    public IntPtr pfnCspPadData;
    public UIntPtr hSCardCtx;
    public UIntPtr hScard;
    public IntPtr pvVendorSpecific;
    public IntPtr pfnCardDeleteContext;
    public IntPtr pfnCardQueryCapabilities;
    public IntPtr pfnCardDeleteContainer;
    public IntPtr pfnCardCreateContainer;
    public IntPtr pfnCardGetContainerInfo;
    public IntPtr pfnCardAuthenticatePin;
    public IntPtr pfnCardGetChallenge;
    public IntPtr pfnCardAuthenticateChallenge;
    public IntPtr pfnCardUnblockPin;
    public IntPtr pfnCardChangeAuthenticator;
    public IntPtr pfnCardDeauthenticate;
    public IntPtr pfnCardCreateDirectory;
    public IntPtr pfnCardDeleteDirectory;
    public IntPtr pvUnused3;
    public IntPtr pvUnused4;
    public IntPtr pfnCardCreateFile;
    public IntPtr pfnCardReadFile;
    public IntPtr pfnCardWriteFile;
    public IntPtr pfnCardDeleteFile;
    public IntPtr pfnCardEnumFiles;
    public IntPtr pfnCardGetFileInfo;
    public IntPtr pfnCardQueryFreeSpace;
    public IntPtr pfnCardQueryKeySizes;
    public IntPtr pfnCardSignData;
    public IntPtr pfnCardRSADecrypt;
    public IntPtr pfnCardConstructDHAgreement;
    public IntPtr pfnCardDeriveKey;
    public IntPtr pfnCardDestroyDHAgreement;
    public IntPtr pfnCspGetDHAgreement;
    public IntPtr pfnCardGetChallengeEx;
    public IntPtr pfnCardAuthenticateEx;
    public IntPtr pfnCardChangeAuthenticatorEx;
    public IntPtr pfnCardDeauthenticateEx;
    public IntPtr pfnCardGetContainerProperty;
    public IntPtr pfnCardSetContainerProperty;
    public IntPtr pfnCardGetProperty;
    public IntPtr pfnCardSetProperty;
    public IntPtr pfnCspUnpadData;
    public IntPtr pfnMDImportSessionKey;
    public IntPtr pfnMDEncryptData;
    public IntPtr pfnCardImportSessionKey;
    public IntPtr pfnCardGetSharedKeyHandle;
    public IntPtr pfnCardGetAlgorithmProperty;
    public IntPtr pfnCardGetKeyProperty;
    public IntPtr pfnCardSetKeyProperty;
    public IntPtr pfnCardDestroyKey;
    public IntPtr pfnCardProcessEncryptedData;
    public IntPtr pfnCardCreateContainerEx;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CARD_DATA
    Public dwVersion As UInteger
    Public pbAtr As IntPtr
    Public cbAtr As UInteger
    Public pwszCardName As IntPtr
    Public pfnCspAlloc As IntPtr
    Public pfnCspReAlloc As IntPtr
    Public pfnCspFree As IntPtr
    Public pfnCspCacheAddFile As IntPtr
    Public pfnCspCacheLookupFile As IntPtr
    Public pfnCspCacheDeleteFile As IntPtr
    Public pvCacheContext As IntPtr
    Public pfnCspPadData As IntPtr
    Public hSCardCtx As UIntPtr
    Public hScard As UIntPtr
    Public pvVendorSpecific As IntPtr
    Public pfnCardDeleteContext As IntPtr
    Public pfnCardQueryCapabilities As IntPtr
    Public pfnCardDeleteContainer As IntPtr
    Public pfnCardCreateContainer As IntPtr
    Public pfnCardGetContainerInfo As IntPtr
    Public pfnCardAuthenticatePin As IntPtr
    Public pfnCardGetChallenge As IntPtr
    Public pfnCardAuthenticateChallenge As IntPtr
    Public pfnCardUnblockPin As IntPtr
    Public pfnCardChangeAuthenticator As IntPtr
    Public pfnCardDeauthenticate As IntPtr
    Public pfnCardCreateDirectory As IntPtr
    Public pfnCardDeleteDirectory As IntPtr
    Public pvUnused3 As IntPtr
    Public pvUnused4 As IntPtr
    Public pfnCardCreateFile As IntPtr
    Public pfnCardReadFile As IntPtr
    Public pfnCardWriteFile As IntPtr
    Public pfnCardDeleteFile As IntPtr
    Public pfnCardEnumFiles As IntPtr
    Public pfnCardGetFileInfo As IntPtr
    Public pfnCardQueryFreeSpace As IntPtr
    Public pfnCardQueryKeySizes As IntPtr
    Public pfnCardSignData As IntPtr
    Public pfnCardRSADecrypt As IntPtr
    Public pfnCardConstructDHAgreement As IntPtr
    Public pfnCardDeriveKey As IntPtr
    Public pfnCardDestroyDHAgreement As IntPtr
    Public pfnCspGetDHAgreement As IntPtr
    Public pfnCardGetChallengeEx As IntPtr
    Public pfnCardAuthenticateEx As IntPtr
    Public pfnCardChangeAuthenticatorEx As IntPtr
    Public pfnCardDeauthenticateEx As IntPtr
    Public pfnCardGetContainerProperty As IntPtr
    Public pfnCardSetContainerProperty As IntPtr
    Public pfnCardGetProperty As IntPtr
    Public pfnCardSetProperty As IntPtr
    Public pfnCspUnpadData As IntPtr
    Public pfnMDImportSessionKey As IntPtr
    Public pfnMDEncryptData As IntPtr
    Public pfnCardImportSessionKey As IntPtr
    Public pfnCardGetSharedKeyHandle As IntPtr
    Public pfnCardGetAlgorithmProperty As IntPtr
    Public pfnCardGetKeyProperty As IntPtr
    Public pfnCardSetKeyProperty As IntPtr
    Public pfnCardDestroyKey As IntPtr
    Public pfnCardProcessEncryptedData As IntPtr
    Public pfnCardCreateContainerEx As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CARD_DATA(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("pbAtr", ctypes.c_void_p),
        ("cbAtr", wintypes.DWORD),
        ("pwszCardName", ctypes.c_void_p),
        ("pfnCspAlloc", ctypes.c_void_p),
        ("pfnCspReAlloc", ctypes.c_void_p),
        ("pfnCspFree", ctypes.c_void_p),
        ("pfnCspCacheAddFile", ctypes.c_void_p),
        ("pfnCspCacheLookupFile", ctypes.c_void_p),
        ("pfnCspCacheDeleteFile", ctypes.c_void_p),
        ("pvCacheContext", ctypes.c_void_p),
        ("pfnCspPadData", ctypes.c_void_p),
        ("hSCardCtx", ctypes.c_size_t),
        ("hScard", ctypes.c_size_t),
        ("pvVendorSpecific", ctypes.c_void_p),
        ("pfnCardDeleteContext", ctypes.c_void_p),
        ("pfnCardQueryCapabilities", ctypes.c_void_p),
        ("pfnCardDeleteContainer", ctypes.c_void_p),
        ("pfnCardCreateContainer", ctypes.c_void_p),
        ("pfnCardGetContainerInfo", ctypes.c_void_p),
        ("pfnCardAuthenticatePin", ctypes.c_void_p),
        ("pfnCardGetChallenge", ctypes.c_void_p),
        ("pfnCardAuthenticateChallenge", ctypes.c_void_p),
        ("pfnCardUnblockPin", ctypes.c_void_p),
        ("pfnCardChangeAuthenticator", ctypes.c_void_p),
        ("pfnCardDeauthenticate", ctypes.c_void_p),
        ("pfnCardCreateDirectory", ctypes.c_void_p),
        ("pfnCardDeleteDirectory", ctypes.c_void_p),
        ("pvUnused3", ctypes.c_void_p),
        ("pvUnused4", ctypes.c_void_p),
        ("pfnCardCreateFile", ctypes.c_void_p),
        ("pfnCardReadFile", ctypes.c_void_p),
        ("pfnCardWriteFile", ctypes.c_void_p),
        ("pfnCardDeleteFile", ctypes.c_void_p),
        ("pfnCardEnumFiles", ctypes.c_void_p),
        ("pfnCardGetFileInfo", ctypes.c_void_p),
        ("pfnCardQueryFreeSpace", ctypes.c_void_p),
        ("pfnCardQueryKeySizes", ctypes.c_void_p),
        ("pfnCardSignData", ctypes.c_void_p),
        ("pfnCardRSADecrypt", ctypes.c_void_p),
        ("pfnCardConstructDHAgreement", ctypes.c_void_p),
        ("pfnCardDeriveKey", ctypes.c_void_p),
        ("pfnCardDestroyDHAgreement", ctypes.c_void_p),
        ("pfnCspGetDHAgreement", ctypes.c_void_p),
        ("pfnCardGetChallengeEx", ctypes.c_void_p),
        ("pfnCardAuthenticateEx", ctypes.c_void_p),
        ("pfnCardChangeAuthenticatorEx", ctypes.c_void_p),
        ("pfnCardDeauthenticateEx", ctypes.c_void_p),
        ("pfnCardGetContainerProperty", ctypes.c_void_p),
        ("pfnCardSetContainerProperty", ctypes.c_void_p),
        ("pfnCardGetProperty", ctypes.c_void_p),
        ("pfnCardSetProperty", ctypes.c_void_p),
        ("pfnCspUnpadData", ctypes.c_void_p),
        ("pfnMDImportSessionKey", ctypes.c_void_p),
        ("pfnMDEncryptData", ctypes.c_void_p),
        ("pfnCardImportSessionKey", ctypes.c_void_p),
        ("pfnCardGetSharedKeyHandle", ctypes.c_void_p),
        ("pfnCardGetAlgorithmProperty", ctypes.c_void_p),
        ("pfnCardGetKeyProperty", ctypes.c_void_p),
        ("pfnCardSetKeyProperty", ctypes.c_void_p),
        ("pfnCardDestroyKey", ctypes.c_void_p),
        ("pfnCardProcessEncryptedData", ctypes.c_void_p),
        ("pfnCardCreateContainerEx", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CARD_DATA {
    pub dwVersion: u32,
    pub pbAtr: *mut core::ffi::c_void,
    pub cbAtr: u32,
    pub pwszCardName: *mut core::ffi::c_void,
    pub pfnCspAlloc: *mut core::ffi::c_void,
    pub pfnCspReAlloc: *mut core::ffi::c_void,
    pub pfnCspFree: *mut core::ffi::c_void,
    pub pfnCspCacheAddFile: *mut core::ffi::c_void,
    pub pfnCspCacheLookupFile: *mut core::ffi::c_void,
    pub pfnCspCacheDeleteFile: *mut core::ffi::c_void,
    pub pvCacheContext: *mut core::ffi::c_void,
    pub pfnCspPadData: *mut core::ffi::c_void,
    pub hSCardCtx: usize,
    pub hScard: usize,
    pub pvVendorSpecific: *mut core::ffi::c_void,
    pub pfnCardDeleteContext: *mut core::ffi::c_void,
    pub pfnCardQueryCapabilities: *mut core::ffi::c_void,
    pub pfnCardDeleteContainer: *mut core::ffi::c_void,
    pub pfnCardCreateContainer: *mut core::ffi::c_void,
    pub pfnCardGetContainerInfo: *mut core::ffi::c_void,
    pub pfnCardAuthenticatePin: *mut core::ffi::c_void,
    pub pfnCardGetChallenge: *mut core::ffi::c_void,
    pub pfnCardAuthenticateChallenge: *mut core::ffi::c_void,
    pub pfnCardUnblockPin: *mut core::ffi::c_void,
    pub pfnCardChangeAuthenticator: *mut core::ffi::c_void,
    pub pfnCardDeauthenticate: *mut core::ffi::c_void,
    pub pfnCardCreateDirectory: *mut core::ffi::c_void,
    pub pfnCardDeleteDirectory: *mut core::ffi::c_void,
    pub pvUnused3: *mut core::ffi::c_void,
    pub pvUnused4: *mut core::ffi::c_void,
    pub pfnCardCreateFile: *mut core::ffi::c_void,
    pub pfnCardReadFile: *mut core::ffi::c_void,
    pub pfnCardWriteFile: *mut core::ffi::c_void,
    pub pfnCardDeleteFile: *mut core::ffi::c_void,
    pub pfnCardEnumFiles: *mut core::ffi::c_void,
    pub pfnCardGetFileInfo: *mut core::ffi::c_void,
    pub pfnCardQueryFreeSpace: *mut core::ffi::c_void,
    pub pfnCardQueryKeySizes: *mut core::ffi::c_void,
    pub pfnCardSignData: *mut core::ffi::c_void,
    pub pfnCardRSADecrypt: *mut core::ffi::c_void,
    pub pfnCardConstructDHAgreement: *mut core::ffi::c_void,
    pub pfnCardDeriveKey: *mut core::ffi::c_void,
    pub pfnCardDestroyDHAgreement: *mut core::ffi::c_void,
    pub pfnCspGetDHAgreement: *mut core::ffi::c_void,
    pub pfnCardGetChallengeEx: *mut core::ffi::c_void,
    pub pfnCardAuthenticateEx: *mut core::ffi::c_void,
    pub pfnCardChangeAuthenticatorEx: *mut core::ffi::c_void,
    pub pfnCardDeauthenticateEx: *mut core::ffi::c_void,
    pub pfnCardGetContainerProperty: *mut core::ffi::c_void,
    pub pfnCardSetContainerProperty: *mut core::ffi::c_void,
    pub pfnCardGetProperty: *mut core::ffi::c_void,
    pub pfnCardSetProperty: *mut core::ffi::c_void,
    pub pfnCspUnpadData: *mut core::ffi::c_void,
    pub pfnMDImportSessionKey: *mut core::ffi::c_void,
    pub pfnMDEncryptData: *mut core::ffi::c_void,
    pub pfnCardImportSessionKey: *mut core::ffi::c_void,
    pub pfnCardGetSharedKeyHandle: *mut core::ffi::c_void,
    pub pfnCardGetAlgorithmProperty: *mut core::ffi::c_void,
    pub pfnCardGetKeyProperty: *mut core::ffi::c_void,
    pub pfnCardSetKeyProperty: *mut core::ffi::c_void,
    pub pfnCardDestroyKey: *mut core::ffi::c_void,
    pub pfnCardProcessEncryptedData: *mut core::ffi::c_void,
    pub pfnCardCreateContainerEx: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CARD_DATA struct {
	dwVersion uint32
	pbAtr uintptr
	cbAtr uint32
	pwszCardName uintptr
	pfnCspAlloc uintptr
	pfnCspReAlloc uintptr
	pfnCspFree uintptr
	pfnCspCacheAddFile uintptr
	pfnCspCacheLookupFile uintptr
	pfnCspCacheDeleteFile uintptr
	pvCacheContext uintptr
	pfnCspPadData uintptr
	hSCardCtx uintptr
	hScard uintptr
	pvVendorSpecific uintptr
	pfnCardDeleteContext uintptr
	pfnCardQueryCapabilities uintptr
	pfnCardDeleteContainer uintptr
	pfnCardCreateContainer uintptr
	pfnCardGetContainerInfo uintptr
	pfnCardAuthenticatePin uintptr
	pfnCardGetChallenge uintptr
	pfnCardAuthenticateChallenge uintptr
	pfnCardUnblockPin uintptr
	pfnCardChangeAuthenticator uintptr
	pfnCardDeauthenticate uintptr
	pfnCardCreateDirectory uintptr
	pfnCardDeleteDirectory uintptr
	pvUnused3 uintptr
	pvUnused4 uintptr
	pfnCardCreateFile uintptr
	pfnCardReadFile uintptr
	pfnCardWriteFile uintptr
	pfnCardDeleteFile uintptr
	pfnCardEnumFiles uintptr
	pfnCardGetFileInfo uintptr
	pfnCardQueryFreeSpace uintptr
	pfnCardQueryKeySizes uintptr
	pfnCardSignData uintptr
	pfnCardRSADecrypt uintptr
	pfnCardConstructDHAgreement uintptr
	pfnCardDeriveKey uintptr
	pfnCardDestroyDHAgreement uintptr
	pfnCspGetDHAgreement uintptr
	pfnCardGetChallengeEx uintptr
	pfnCardAuthenticateEx uintptr
	pfnCardChangeAuthenticatorEx uintptr
	pfnCardDeauthenticateEx uintptr
	pfnCardGetContainerProperty uintptr
	pfnCardSetContainerProperty uintptr
	pfnCardGetProperty uintptr
	pfnCardSetProperty uintptr
	pfnCspUnpadData uintptr
	pfnMDImportSessionKey uintptr
	pfnMDEncryptData uintptr
	pfnCardImportSessionKey uintptr
	pfnCardGetSharedKeyHandle uintptr
	pfnCardGetAlgorithmProperty uintptr
	pfnCardGetKeyProperty uintptr
	pfnCardSetKeyProperty uintptr
	pfnCardDestroyKey uintptr
	pfnCardProcessEncryptedData uintptr
	pfnCardCreateContainerEx uintptr
}
type
  CARD_DATA = record
    dwVersion: DWORD;
    pbAtr: Pointer;
    cbAtr: DWORD;
    pwszCardName: Pointer;
    pfnCspAlloc: Pointer;
    pfnCspReAlloc: Pointer;
    pfnCspFree: Pointer;
    pfnCspCacheAddFile: Pointer;
    pfnCspCacheLookupFile: Pointer;
    pfnCspCacheDeleteFile: Pointer;
    pvCacheContext: Pointer;
    pfnCspPadData: Pointer;
    hSCardCtx: NativeUInt;
    hScard: NativeUInt;
    pvVendorSpecific: Pointer;
    pfnCardDeleteContext: Pointer;
    pfnCardQueryCapabilities: Pointer;
    pfnCardDeleteContainer: Pointer;
    pfnCardCreateContainer: Pointer;
    pfnCardGetContainerInfo: Pointer;
    pfnCardAuthenticatePin: Pointer;
    pfnCardGetChallenge: Pointer;
    pfnCardAuthenticateChallenge: Pointer;
    pfnCardUnblockPin: Pointer;
    pfnCardChangeAuthenticator: Pointer;
    pfnCardDeauthenticate: Pointer;
    pfnCardCreateDirectory: Pointer;
    pfnCardDeleteDirectory: Pointer;
    pvUnused3: Pointer;
    pvUnused4: Pointer;
    pfnCardCreateFile: Pointer;
    pfnCardReadFile: Pointer;
    pfnCardWriteFile: Pointer;
    pfnCardDeleteFile: Pointer;
    pfnCardEnumFiles: Pointer;
    pfnCardGetFileInfo: Pointer;
    pfnCardQueryFreeSpace: Pointer;
    pfnCardQueryKeySizes: Pointer;
    pfnCardSignData: Pointer;
    pfnCardRSADecrypt: Pointer;
    pfnCardConstructDHAgreement: Pointer;
    pfnCardDeriveKey: Pointer;
    pfnCardDestroyDHAgreement: Pointer;
    pfnCspGetDHAgreement: Pointer;
    pfnCardGetChallengeEx: Pointer;
    pfnCardAuthenticateEx: Pointer;
    pfnCardChangeAuthenticatorEx: Pointer;
    pfnCardDeauthenticateEx: Pointer;
    pfnCardGetContainerProperty: Pointer;
    pfnCardSetContainerProperty: Pointer;
    pfnCardGetProperty: Pointer;
    pfnCardSetProperty: Pointer;
    pfnCspUnpadData: Pointer;
    pfnMDImportSessionKey: Pointer;
    pfnMDEncryptData: Pointer;
    pfnCardImportSessionKey: Pointer;
    pfnCardGetSharedKeyHandle: Pointer;
    pfnCardGetAlgorithmProperty: Pointer;
    pfnCardGetKeyProperty: Pointer;
    pfnCardSetKeyProperty: Pointer;
    pfnCardDestroyKey: Pointer;
    pfnCardProcessEncryptedData: Pointer;
    pfnCardCreateContainerEx: Pointer;
  end;
const CARD_DATA = extern struct {
    dwVersion: u32,
    pbAtr: ?*anyopaque,
    cbAtr: u32,
    pwszCardName: ?*anyopaque,
    pfnCspAlloc: ?*anyopaque,
    pfnCspReAlloc: ?*anyopaque,
    pfnCspFree: ?*anyopaque,
    pfnCspCacheAddFile: ?*anyopaque,
    pfnCspCacheLookupFile: ?*anyopaque,
    pfnCspCacheDeleteFile: ?*anyopaque,
    pvCacheContext: ?*anyopaque,
    pfnCspPadData: ?*anyopaque,
    hSCardCtx: usize,
    hScard: usize,
    pvVendorSpecific: ?*anyopaque,
    pfnCardDeleteContext: ?*anyopaque,
    pfnCardQueryCapabilities: ?*anyopaque,
    pfnCardDeleteContainer: ?*anyopaque,
    pfnCardCreateContainer: ?*anyopaque,
    pfnCardGetContainerInfo: ?*anyopaque,
    pfnCardAuthenticatePin: ?*anyopaque,
    pfnCardGetChallenge: ?*anyopaque,
    pfnCardAuthenticateChallenge: ?*anyopaque,
    pfnCardUnblockPin: ?*anyopaque,
    pfnCardChangeAuthenticator: ?*anyopaque,
    pfnCardDeauthenticate: ?*anyopaque,
    pfnCardCreateDirectory: ?*anyopaque,
    pfnCardDeleteDirectory: ?*anyopaque,
    pvUnused3: ?*anyopaque,
    pvUnused4: ?*anyopaque,
    pfnCardCreateFile: ?*anyopaque,
    pfnCardReadFile: ?*anyopaque,
    pfnCardWriteFile: ?*anyopaque,
    pfnCardDeleteFile: ?*anyopaque,
    pfnCardEnumFiles: ?*anyopaque,
    pfnCardGetFileInfo: ?*anyopaque,
    pfnCardQueryFreeSpace: ?*anyopaque,
    pfnCardQueryKeySizes: ?*anyopaque,
    pfnCardSignData: ?*anyopaque,
    pfnCardRSADecrypt: ?*anyopaque,
    pfnCardConstructDHAgreement: ?*anyopaque,
    pfnCardDeriveKey: ?*anyopaque,
    pfnCardDestroyDHAgreement: ?*anyopaque,
    pfnCspGetDHAgreement: ?*anyopaque,
    pfnCardGetChallengeEx: ?*anyopaque,
    pfnCardAuthenticateEx: ?*anyopaque,
    pfnCardChangeAuthenticatorEx: ?*anyopaque,
    pfnCardDeauthenticateEx: ?*anyopaque,
    pfnCardGetContainerProperty: ?*anyopaque,
    pfnCardSetContainerProperty: ?*anyopaque,
    pfnCardGetProperty: ?*anyopaque,
    pfnCardSetProperty: ?*anyopaque,
    pfnCspUnpadData: ?*anyopaque,
    pfnMDImportSessionKey: ?*anyopaque,
    pfnMDEncryptData: ?*anyopaque,
    pfnCardImportSessionKey: ?*anyopaque,
    pfnCardGetSharedKeyHandle: ?*anyopaque,
    pfnCardGetAlgorithmProperty: ?*anyopaque,
    pfnCardGetKeyProperty: ?*anyopaque,
    pfnCardSetKeyProperty: ?*anyopaque,
    pfnCardDestroyKey: ?*anyopaque,
    pfnCardProcessEncryptedData: ?*anyopaque,
    pfnCardCreateContainerEx: ?*anyopaque,
};
type
  CARD_DATA {.bycopy.} = object
    dwVersion: uint32
    pbAtr: pointer
    cbAtr: uint32
    pwszCardName: pointer
    pfnCspAlloc: pointer
    pfnCspReAlloc: pointer
    pfnCspFree: pointer
    pfnCspCacheAddFile: pointer
    pfnCspCacheLookupFile: pointer
    pfnCspCacheDeleteFile: pointer
    pvCacheContext: pointer
    pfnCspPadData: pointer
    hSCardCtx: uint
    hScard: uint
    pvVendorSpecific: pointer
    pfnCardDeleteContext: pointer
    pfnCardQueryCapabilities: pointer
    pfnCardDeleteContainer: pointer
    pfnCardCreateContainer: pointer
    pfnCardGetContainerInfo: pointer
    pfnCardAuthenticatePin: pointer
    pfnCardGetChallenge: pointer
    pfnCardAuthenticateChallenge: pointer
    pfnCardUnblockPin: pointer
    pfnCardChangeAuthenticator: pointer
    pfnCardDeauthenticate: pointer
    pfnCardCreateDirectory: pointer
    pfnCardDeleteDirectory: pointer
    pvUnused3: pointer
    pvUnused4: pointer
    pfnCardCreateFile: pointer
    pfnCardReadFile: pointer
    pfnCardWriteFile: pointer
    pfnCardDeleteFile: pointer
    pfnCardEnumFiles: pointer
    pfnCardGetFileInfo: pointer
    pfnCardQueryFreeSpace: pointer
    pfnCardQueryKeySizes: pointer
    pfnCardSignData: pointer
    pfnCardRSADecrypt: pointer
    pfnCardConstructDHAgreement: pointer
    pfnCardDeriveKey: pointer
    pfnCardDestroyDHAgreement: pointer
    pfnCspGetDHAgreement: pointer
    pfnCardGetChallengeEx: pointer
    pfnCardAuthenticateEx: pointer
    pfnCardChangeAuthenticatorEx: pointer
    pfnCardDeauthenticateEx: pointer
    pfnCardGetContainerProperty: pointer
    pfnCardSetContainerProperty: pointer
    pfnCardGetProperty: pointer
    pfnCardSetProperty: pointer
    pfnCspUnpadData: pointer
    pfnMDImportSessionKey: pointer
    pfnMDEncryptData: pointer
    pfnCardImportSessionKey: pointer
    pfnCardGetSharedKeyHandle: pointer
    pfnCardGetAlgorithmProperty: pointer
    pfnCardGetKeyProperty: pointer
    pfnCardSetKeyProperty: pointer
    pfnCardDestroyKey: pointer
    pfnCardProcessEncryptedData: pointer
    pfnCardCreateContainerEx: pointer
struct CARD_DATA
{
    uint dwVersion;
    void* pbAtr;
    uint cbAtr;
    void* pwszCardName;
    void* pfnCspAlloc;
    void* pfnCspReAlloc;
    void* pfnCspFree;
    void* pfnCspCacheAddFile;
    void* pfnCspCacheLookupFile;
    void* pfnCspCacheDeleteFile;
    void* pvCacheContext;
    void* pfnCspPadData;
    size_t hSCardCtx;
    size_t hScard;
    void* pvVendorSpecific;
    void* pfnCardDeleteContext;
    void* pfnCardQueryCapabilities;
    void* pfnCardDeleteContainer;
    void* pfnCardCreateContainer;
    void* pfnCardGetContainerInfo;
    void* pfnCardAuthenticatePin;
    void* pfnCardGetChallenge;
    void* pfnCardAuthenticateChallenge;
    void* pfnCardUnblockPin;
    void* pfnCardChangeAuthenticator;
    void* pfnCardDeauthenticate;
    void* pfnCardCreateDirectory;
    void* pfnCardDeleteDirectory;
    void* pvUnused3;
    void* pvUnused4;
    void* pfnCardCreateFile;
    void* pfnCardReadFile;
    void* pfnCardWriteFile;
    void* pfnCardDeleteFile;
    void* pfnCardEnumFiles;
    void* pfnCardGetFileInfo;
    void* pfnCardQueryFreeSpace;
    void* pfnCardQueryKeySizes;
    void* pfnCardSignData;
    void* pfnCardRSADecrypt;
    void* pfnCardConstructDHAgreement;
    void* pfnCardDeriveKey;
    void* pfnCardDestroyDHAgreement;
    void* pfnCspGetDHAgreement;
    void* pfnCardGetChallengeEx;
    void* pfnCardAuthenticateEx;
    void* pfnCardChangeAuthenticatorEx;
    void* pfnCardDeauthenticateEx;
    void* pfnCardGetContainerProperty;
    void* pfnCardSetContainerProperty;
    void* pfnCardGetProperty;
    void* pfnCardSetProperty;
    void* pfnCspUnpadData;
    void* pfnMDImportSessionKey;
    void* pfnMDEncryptData;
    void* pfnCardImportSessionKey;
    void* pfnCardGetSharedKeyHandle;
    void* pfnCardGetAlgorithmProperty;
    void* pfnCardGetKeyProperty;
    void* pfnCardSetKeyProperty;
    void* pfnCardDestroyKey;
    void* pfnCardProcessEncryptedData;
    void* pfnCardCreateContainerEx;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CARD_DATA サイズ: 252 バイト(x86)
dim st, 63    ; 4byte整数×63(構造体サイズ 252 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pbAtr : BYTE* (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cbAtr : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pwszCardName : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pfnCspAlloc : PFN_CSP_ALLOC (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pfnCspReAlloc : PFN_CSP_REALLOC (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; pfnCspFree : PFN_CSP_FREE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; pfnCspCacheAddFile : PFN_CSP_CACHE_ADD_FILE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; pfnCspCacheLookupFile : PFN_CSP_CACHE_LOOKUP_FILE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; pfnCspCacheDeleteFile : PFN_CSP_CACHE_DELETE_FILE (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; pvCacheContext : void* (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; pfnCspPadData : PFN_CSP_PAD_DATA (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; hSCardCtx : UINT_PTR (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; hScard : UINT_PTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pvVendorSpecific : void* (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; pfnCardDeleteContext : PFN_CARD_DELETE_CONTEXT (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; pfnCardQueryCapabilities : PFN_CARD_QUERY_CAPABILITIES (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; pfnCardDeleteContainer : PFN_CARD_DELETE_CONTAINER (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; pfnCardCreateContainer : PFN_CARD_CREATE_CONTAINER (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; pfnCardGetContainerInfo : PFN_CARD_GET_CONTAINER_INFO (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; pfnCardAuthenticatePin : PFN_CARD_AUTHENTICATE_PIN (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; pfnCardGetChallenge : PFN_CARD_GET_CHALLENGE (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; pfnCardAuthenticateChallenge : PFN_CARD_AUTHENTICATE_CHALLENGE (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; pfnCardUnblockPin : PFN_CARD_UNBLOCK_PIN (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; pfnCardChangeAuthenticator : PFN_CARD_CHANGE_AUTHENTICATOR (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; pfnCardDeauthenticate : PFN_CARD_DEAUTHENTICATE (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; pfnCardCreateDirectory : PFN_CARD_CREATE_DIRECTORY (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; pfnCardDeleteDirectory : PFN_CARD_DELETE_DIRECTORY (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; pvUnused3 : void* (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; pvUnused4 : void* (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; pfnCardCreateFile : PFN_CARD_CREATE_FILE (+120, 4byte)  st.30 = 値  /  値 = st.30   (lpoke/lpeek も可)
; pfnCardReadFile : PFN_CARD_READ_FILE (+124, 4byte)  st.31 = 値  /  値 = st.31   (lpoke/lpeek も可)
; pfnCardWriteFile : PFN_CARD_WRITE_FILE (+128, 4byte)  st.32 = 値  /  値 = st.32   (lpoke/lpeek も可)
; pfnCardDeleteFile : PFN_CARD_DELETE_FILE (+132, 4byte)  st.33 = 値  /  値 = st.33   (lpoke/lpeek も可)
; pfnCardEnumFiles : PFN_CARD_ENUM_FILES (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; pfnCardGetFileInfo : PFN_CARD_GET_FILE_INFO (+140, 4byte)  st.35 = 値  /  値 = st.35   (lpoke/lpeek も可)
; pfnCardQueryFreeSpace : PFN_CARD_QUERY_FREE_SPACE (+144, 4byte)  st.36 = 値  /  値 = st.36   (lpoke/lpeek も可)
; pfnCardQueryKeySizes : PFN_CARD_QUERY_KEY_SIZES (+148, 4byte)  st.37 = 値  /  値 = st.37   (lpoke/lpeek も可)
; pfnCardSignData : PFN_CARD_SIGN_DATA (+152, 4byte)  st.38 = 値  /  値 = st.38   (lpoke/lpeek も可)
; pfnCardRSADecrypt : PFN_CARD_RSA_DECRYPT (+156, 4byte)  st.39 = 値  /  値 = st.39   (lpoke/lpeek も可)
; pfnCardConstructDHAgreement : PFN_CARD_CONSTRUCT_DH_AGREEMENT (+160, 4byte)  st.40 = 値  /  値 = st.40   (lpoke/lpeek も可)
; pfnCardDeriveKey : PFN_CARD_DERIVE_KEY (+164, 4byte)  st.41 = 値  /  値 = st.41   (lpoke/lpeek も可)
; pfnCardDestroyDHAgreement : PFN_CARD_DESTROY_DH_AGREEMENT (+168, 4byte)  st.42 = 値  /  値 = st.42   (lpoke/lpeek も可)
; pfnCspGetDHAgreement : PFN_CSP_GET_DH_AGREEMENT (+172, 4byte)  st.43 = 値  /  値 = st.43   (lpoke/lpeek も可)
; pfnCardGetChallengeEx : PFN_CARD_GET_CHALLENGE_EX (+176, 4byte)  st.44 = 値  /  値 = st.44   (lpoke/lpeek も可)
; pfnCardAuthenticateEx : PFN_CARD_AUTHENTICATE_EX (+180, 4byte)  st.45 = 値  /  値 = st.45   (lpoke/lpeek も可)
; pfnCardChangeAuthenticatorEx : PFN_CARD_CHANGE_AUTHENTICATOR_EX (+184, 4byte)  st.46 = 値  /  値 = st.46   (lpoke/lpeek も可)
; pfnCardDeauthenticateEx : PFN_CARD_DEAUTHENTICATE_EX (+188, 4byte)  st.47 = 値  /  値 = st.47   (lpoke/lpeek も可)
; pfnCardGetContainerProperty : PFN_CARD_GET_CONTAINER_PROPERTY (+192, 4byte)  st.48 = 値  /  値 = st.48   (lpoke/lpeek も可)
; pfnCardSetContainerProperty : PFN_CARD_SET_CONTAINER_PROPERTY (+196, 4byte)  st.49 = 値  /  値 = st.49   (lpoke/lpeek も可)
; pfnCardGetProperty : PFN_CARD_GET_PROPERTY (+200, 4byte)  st.50 = 値  /  値 = st.50   (lpoke/lpeek も可)
; pfnCardSetProperty : PFN_CARD_SET_PROPERTY (+204, 4byte)  st.51 = 値  /  値 = st.51   (lpoke/lpeek も可)
; pfnCspUnpadData : PFN_CSP_UNPAD_DATA (+208, 4byte)  st.52 = 値  /  値 = st.52   (lpoke/lpeek も可)
; pfnMDImportSessionKey : PFN_MD_IMPORT_SESSION_KEY (+212, 4byte)  st.53 = 値  /  値 = st.53   (lpoke/lpeek も可)
; pfnMDEncryptData : PFN_MD_ENCRYPT_DATA (+216, 4byte)  st.54 = 値  /  値 = st.54   (lpoke/lpeek も可)
; pfnCardImportSessionKey : PFN_CARD_IMPORT_SESSION_KEY (+220, 4byte)  st.55 = 値  /  値 = st.55   (lpoke/lpeek も可)
; pfnCardGetSharedKeyHandle : PFN_CARD_GET_SHARED_KEY_HANDLE (+224, 4byte)  st.56 = 値  /  値 = st.56   (lpoke/lpeek も可)
; pfnCardGetAlgorithmProperty : PFN_CARD_GET_ALGORITHM_PROPERTY (+228, 4byte)  st.57 = 値  /  値 = st.57   (lpoke/lpeek も可)
; pfnCardGetKeyProperty : PFN_CARD_GET_KEY_PROPERTY (+232, 4byte)  st.58 = 値  /  値 = st.58   (lpoke/lpeek も可)
; pfnCardSetKeyProperty : PFN_CARD_SET_KEY_PROPERTY (+236, 4byte)  st.59 = 値  /  値 = st.59   (lpoke/lpeek も可)
; pfnCardDestroyKey : PFN_CARD_DESTROY_KEY (+240, 4byte)  st.60 = 値  /  値 = st.60   (lpoke/lpeek も可)
; pfnCardProcessEncryptedData : PFN_CARD_PROCESS_ENCRYPTED_DATA (+244, 4byte)  st.61 = 値  /  値 = st.61   (lpoke/lpeek も可)
; pfnCardCreateContainerEx : PFN_CARD_CREATE_CONTAINER_EX (+248, 4byte)  st.62 = 値  /  値 = st.62   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CARD_DATA サイズ: 504 バイト(x64)
dim st, 126    ; 4byte整数×126(構造体サイズ 504 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pbAtr : BYTE* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbAtr : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pwszCardName : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pfnCspAlloc : PFN_CSP_ALLOC (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pfnCspReAlloc : PFN_CSP_REALLOC (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pfnCspFree : PFN_CSP_FREE (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pfnCspCacheAddFile : PFN_CSP_CACHE_ADD_FILE (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; pfnCspCacheLookupFile : PFN_CSP_CACHE_LOOKUP_FILE (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; pfnCspCacheDeleteFile : PFN_CSP_CACHE_DELETE_FILE (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; pvCacheContext : void* (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; pfnCspPadData : PFN_CSP_PAD_DATA (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; hSCardCtx : UINT_PTR (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; hScard : UINT_PTR (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; pvVendorSpecific : void* (+112, 8byte)  qpoke st,112,値 / qpeek(st,112)  ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; pfnCardDeleteContext : PFN_CARD_DELETE_CONTEXT (+120, 8byte)  qpoke st,120,値 / qpeek(st,120)  ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; pfnCardQueryCapabilities : PFN_CARD_QUERY_CAPABILITIES (+128, 8byte)  qpoke st,128,値 / qpeek(st,128)  ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; pfnCardDeleteContainer : PFN_CARD_DELETE_CONTAINER (+136, 8byte)  qpoke st,136,値 / qpeek(st,136)  ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; pfnCardCreateContainer : PFN_CARD_CREATE_CONTAINER (+144, 8byte)  qpoke st,144,値 / qpeek(st,144)  ※IronHSPのみ。3.7/3.8は lpoke st,144,下位 : lpoke st,148,上位
; pfnCardGetContainerInfo : PFN_CARD_GET_CONTAINER_INFO (+152, 8byte)  qpoke st,152,値 / qpeek(st,152)  ※IronHSPのみ。3.7/3.8は lpoke st,152,下位 : lpoke st,156,上位
; pfnCardAuthenticatePin : PFN_CARD_AUTHENTICATE_PIN (+160, 8byte)  qpoke st,160,値 / qpeek(st,160)  ※IronHSPのみ。3.7/3.8は lpoke st,160,下位 : lpoke st,164,上位
; pfnCardGetChallenge : PFN_CARD_GET_CHALLENGE (+168, 8byte)  qpoke st,168,値 / qpeek(st,168)  ※IronHSPのみ。3.7/3.8は lpoke st,168,下位 : lpoke st,172,上位
; pfnCardAuthenticateChallenge : PFN_CARD_AUTHENTICATE_CHALLENGE (+176, 8byte)  qpoke st,176,値 / qpeek(st,176)  ※IronHSPのみ。3.7/3.8は lpoke st,176,下位 : lpoke st,180,上位
; pfnCardUnblockPin : PFN_CARD_UNBLOCK_PIN (+184, 8byte)  qpoke st,184,値 / qpeek(st,184)  ※IronHSPのみ。3.7/3.8は lpoke st,184,下位 : lpoke st,188,上位
; pfnCardChangeAuthenticator : PFN_CARD_CHANGE_AUTHENTICATOR (+192, 8byte)  qpoke st,192,値 / qpeek(st,192)  ※IronHSPのみ。3.7/3.8は lpoke st,192,下位 : lpoke st,196,上位
; pfnCardDeauthenticate : PFN_CARD_DEAUTHENTICATE (+200, 8byte)  qpoke st,200,値 / qpeek(st,200)  ※IronHSPのみ。3.7/3.8は lpoke st,200,下位 : lpoke st,204,上位
; pfnCardCreateDirectory : PFN_CARD_CREATE_DIRECTORY (+208, 8byte)  qpoke st,208,値 / qpeek(st,208)  ※IronHSPのみ。3.7/3.8は lpoke st,208,下位 : lpoke st,212,上位
; pfnCardDeleteDirectory : PFN_CARD_DELETE_DIRECTORY (+216, 8byte)  qpoke st,216,値 / qpeek(st,216)  ※IronHSPのみ。3.7/3.8は lpoke st,216,下位 : lpoke st,220,上位
; pvUnused3 : void* (+224, 8byte)  qpoke st,224,値 / qpeek(st,224)  ※IronHSPのみ。3.7/3.8は lpoke st,224,下位 : lpoke st,228,上位
; pvUnused4 : void* (+232, 8byte)  qpoke st,232,値 / qpeek(st,232)  ※IronHSPのみ。3.7/3.8は lpoke st,232,下位 : lpoke st,236,上位
; pfnCardCreateFile : PFN_CARD_CREATE_FILE (+240, 8byte)  qpoke st,240,値 / qpeek(st,240)  ※IronHSPのみ。3.7/3.8は lpoke st,240,下位 : lpoke st,244,上位
; pfnCardReadFile : PFN_CARD_READ_FILE (+248, 8byte)  qpoke st,248,値 / qpeek(st,248)  ※IronHSPのみ。3.7/3.8は lpoke st,248,下位 : lpoke st,252,上位
; pfnCardWriteFile : PFN_CARD_WRITE_FILE (+256, 8byte)  qpoke st,256,値 / qpeek(st,256)  ※IronHSPのみ。3.7/3.8は lpoke st,256,下位 : lpoke st,260,上位
; pfnCardDeleteFile : PFN_CARD_DELETE_FILE (+264, 8byte)  qpoke st,264,値 / qpeek(st,264)  ※IronHSPのみ。3.7/3.8は lpoke st,264,下位 : lpoke st,268,上位
; pfnCardEnumFiles : PFN_CARD_ENUM_FILES (+272, 8byte)  qpoke st,272,値 / qpeek(st,272)  ※IronHSPのみ。3.7/3.8は lpoke st,272,下位 : lpoke st,276,上位
; pfnCardGetFileInfo : PFN_CARD_GET_FILE_INFO (+280, 8byte)  qpoke st,280,値 / qpeek(st,280)  ※IronHSPのみ。3.7/3.8は lpoke st,280,下位 : lpoke st,284,上位
; pfnCardQueryFreeSpace : PFN_CARD_QUERY_FREE_SPACE (+288, 8byte)  qpoke st,288,値 / qpeek(st,288)  ※IronHSPのみ。3.7/3.8は lpoke st,288,下位 : lpoke st,292,上位
; pfnCardQueryKeySizes : PFN_CARD_QUERY_KEY_SIZES (+296, 8byte)  qpoke st,296,値 / qpeek(st,296)  ※IronHSPのみ。3.7/3.8は lpoke st,296,下位 : lpoke st,300,上位
; pfnCardSignData : PFN_CARD_SIGN_DATA (+304, 8byte)  qpoke st,304,値 / qpeek(st,304)  ※IronHSPのみ。3.7/3.8は lpoke st,304,下位 : lpoke st,308,上位
; pfnCardRSADecrypt : PFN_CARD_RSA_DECRYPT (+312, 8byte)  qpoke st,312,値 / qpeek(st,312)  ※IronHSPのみ。3.7/3.8は lpoke st,312,下位 : lpoke st,316,上位
; pfnCardConstructDHAgreement : PFN_CARD_CONSTRUCT_DH_AGREEMENT (+320, 8byte)  qpoke st,320,値 / qpeek(st,320)  ※IronHSPのみ。3.7/3.8は lpoke st,320,下位 : lpoke st,324,上位
; pfnCardDeriveKey : PFN_CARD_DERIVE_KEY (+328, 8byte)  qpoke st,328,値 / qpeek(st,328)  ※IronHSPのみ。3.7/3.8は lpoke st,328,下位 : lpoke st,332,上位
; pfnCardDestroyDHAgreement : PFN_CARD_DESTROY_DH_AGREEMENT (+336, 8byte)  qpoke st,336,値 / qpeek(st,336)  ※IronHSPのみ。3.7/3.8は lpoke st,336,下位 : lpoke st,340,上位
; pfnCspGetDHAgreement : PFN_CSP_GET_DH_AGREEMENT (+344, 8byte)  qpoke st,344,値 / qpeek(st,344)  ※IronHSPのみ。3.7/3.8は lpoke st,344,下位 : lpoke st,348,上位
; pfnCardGetChallengeEx : PFN_CARD_GET_CHALLENGE_EX (+352, 8byte)  qpoke st,352,値 / qpeek(st,352)  ※IronHSPのみ。3.7/3.8は lpoke st,352,下位 : lpoke st,356,上位
; pfnCardAuthenticateEx : PFN_CARD_AUTHENTICATE_EX (+360, 8byte)  qpoke st,360,値 / qpeek(st,360)  ※IronHSPのみ。3.7/3.8は lpoke st,360,下位 : lpoke st,364,上位
; pfnCardChangeAuthenticatorEx : PFN_CARD_CHANGE_AUTHENTICATOR_EX (+368, 8byte)  qpoke st,368,値 / qpeek(st,368)  ※IronHSPのみ。3.7/3.8は lpoke st,368,下位 : lpoke st,372,上位
; pfnCardDeauthenticateEx : PFN_CARD_DEAUTHENTICATE_EX (+376, 8byte)  qpoke st,376,値 / qpeek(st,376)  ※IronHSPのみ。3.7/3.8は lpoke st,376,下位 : lpoke st,380,上位
; pfnCardGetContainerProperty : PFN_CARD_GET_CONTAINER_PROPERTY (+384, 8byte)  qpoke st,384,値 / qpeek(st,384)  ※IronHSPのみ。3.7/3.8は lpoke st,384,下位 : lpoke st,388,上位
; pfnCardSetContainerProperty : PFN_CARD_SET_CONTAINER_PROPERTY (+392, 8byte)  qpoke st,392,値 / qpeek(st,392)  ※IronHSPのみ。3.7/3.8は lpoke st,392,下位 : lpoke st,396,上位
; pfnCardGetProperty : PFN_CARD_GET_PROPERTY (+400, 8byte)  qpoke st,400,値 / qpeek(st,400)  ※IronHSPのみ。3.7/3.8は lpoke st,400,下位 : lpoke st,404,上位
; pfnCardSetProperty : PFN_CARD_SET_PROPERTY (+408, 8byte)  qpoke st,408,値 / qpeek(st,408)  ※IronHSPのみ。3.7/3.8は lpoke st,408,下位 : lpoke st,412,上位
; pfnCspUnpadData : PFN_CSP_UNPAD_DATA (+416, 8byte)  qpoke st,416,値 / qpeek(st,416)  ※IronHSPのみ。3.7/3.8は lpoke st,416,下位 : lpoke st,420,上位
; pfnMDImportSessionKey : PFN_MD_IMPORT_SESSION_KEY (+424, 8byte)  qpoke st,424,値 / qpeek(st,424)  ※IronHSPのみ。3.7/3.8は lpoke st,424,下位 : lpoke st,428,上位
; pfnMDEncryptData : PFN_MD_ENCRYPT_DATA (+432, 8byte)  qpoke st,432,値 / qpeek(st,432)  ※IronHSPのみ。3.7/3.8は lpoke st,432,下位 : lpoke st,436,上位
; pfnCardImportSessionKey : PFN_CARD_IMPORT_SESSION_KEY (+440, 8byte)  qpoke st,440,値 / qpeek(st,440)  ※IronHSPのみ。3.7/3.8は lpoke st,440,下位 : lpoke st,444,上位
; pfnCardGetSharedKeyHandle : PFN_CARD_GET_SHARED_KEY_HANDLE (+448, 8byte)  qpoke st,448,値 / qpeek(st,448)  ※IronHSPのみ。3.7/3.8は lpoke st,448,下位 : lpoke st,452,上位
; pfnCardGetAlgorithmProperty : PFN_CARD_GET_ALGORITHM_PROPERTY (+456, 8byte)  qpoke st,456,値 / qpeek(st,456)  ※IronHSPのみ。3.7/3.8は lpoke st,456,下位 : lpoke st,460,上位
; pfnCardGetKeyProperty : PFN_CARD_GET_KEY_PROPERTY (+464, 8byte)  qpoke st,464,値 / qpeek(st,464)  ※IronHSPのみ。3.7/3.8は lpoke st,464,下位 : lpoke st,468,上位
; pfnCardSetKeyProperty : PFN_CARD_SET_KEY_PROPERTY (+472, 8byte)  qpoke st,472,値 / qpeek(st,472)  ※IronHSPのみ。3.7/3.8は lpoke st,472,下位 : lpoke st,476,上位
; pfnCardDestroyKey : PFN_CARD_DESTROY_KEY (+480, 8byte)  qpoke st,480,値 / qpeek(st,480)  ※IronHSPのみ。3.7/3.8は lpoke st,480,下位 : lpoke st,484,上位
; pfnCardProcessEncryptedData : PFN_CARD_PROCESS_ENCRYPTED_DATA (+488, 8byte)  qpoke st,488,値 / qpeek(st,488)  ※IronHSPのみ。3.7/3.8は lpoke st,488,下位 : lpoke st,492,上位
; pfnCardCreateContainerEx : PFN_CARD_CREATE_CONTAINER_EX (+496, 8byte)  qpoke st,496,値 / qpeek(st,496)  ※IronHSPのみ。3.7/3.8は lpoke st,496,下位 : lpoke st,500,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CARD_DATA
    #field int dwVersion
    #field intptr pbAtr
    #field int cbAtr
    #field intptr pwszCardName
    #field intptr pfnCspAlloc
    #field intptr pfnCspReAlloc
    #field intptr pfnCspFree
    #field intptr pfnCspCacheAddFile
    #field intptr pfnCspCacheLookupFile
    #field intptr pfnCspCacheDeleteFile
    #field intptr pvCacheContext
    #field intptr pfnCspPadData
    #field intptr hSCardCtx
    #field intptr hScard
    #field intptr pvVendorSpecific
    #field intptr pfnCardDeleteContext
    #field intptr pfnCardQueryCapabilities
    #field intptr pfnCardDeleteContainer
    #field intptr pfnCardCreateContainer
    #field intptr pfnCardGetContainerInfo
    #field intptr pfnCardAuthenticatePin
    #field intptr pfnCardGetChallenge
    #field intptr pfnCardAuthenticateChallenge
    #field intptr pfnCardUnblockPin
    #field intptr pfnCardChangeAuthenticator
    #field intptr pfnCardDeauthenticate
    #field intptr pfnCardCreateDirectory
    #field intptr pfnCardDeleteDirectory
    #field intptr pvUnused3
    #field intptr pvUnused4
    #field intptr pfnCardCreateFile
    #field intptr pfnCardReadFile
    #field intptr pfnCardWriteFile
    #field intptr pfnCardDeleteFile
    #field intptr pfnCardEnumFiles
    #field intptr pfnCardGetFileInfo
    #field intptr pfnCardQueryFreeSpace
    #field intptr pfnCardQueryKeySizes
    #field intptr pfnCardSignData
    #field intptr pfnCardRSADecrypt
    #field intptr pfnCardConstructDHAgreement
    #field intptr pfnCardDeriveKey
    #field intptr pfnCardDestroyDHAgreement
    #field intptr pfnCspGetDHAgreement
    #field intptr pfnCardGetChallengeEx
    #field intptr pfnCardAuthenticateEx
    #field intptr pfnCardChangeAuthenticatorEx
    #field intptr pfnCardDeauthenticateEx
    #field intptr pfnCardGetContainerProperty
    #field intptr pfnCardSetContainerProperty
    #field intptr pfnCardGetProperty
    #field intptr pfnCardSetProperty
    #field intptr pfnCspUnpadData
    #field intptr pfnMDImportSessionKey
    #field intptr pfnMDEncryptData
    #field intptr pfnCardImportSessionKey
    #field intptr pfnCardGetSharedKeyHandle
    #field intptr pfnCardGetAlgorithmProperty
    #field intptr pfnCardGetKeyProperty
    #field intptr pfnCardSetKeyProperty
    #field intptr pfnCardDestroyKey
    #field intptr pfnCardProcessEncryptedData
    #field intptr pfnCardCreateContainerEx
#endstruct

stdim st, CARD_DATA        ; NSTRUCT 変数を確保
st->dwVersion = 100
mes "dwVersion=" + st->dwVersion