⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scard.bas

📁 omnikey support and soure for mifare
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "Scard"

' *******************************************************
' Common SCard functions
' *******************************************************

'
' Establish a context to resource manager
' Parameters:
'       dwScope         = Scope (see Scopes)
'       pvReserved1     = Reserved for further use
'       pvReserved2     = Reserved for further use
'       phContext       = Pointer to Context
'
Public Declare Function SCardEstablishContext Lib "WINSCARD" _
    (ByVal dwScope As Long, _
     ByVal pvReserved1 As Long, _
     ByVal pvReserved2 As Long, _
     ByRef phContext As Long) As Long

'
' Release current Context
' Parameters:
'       hContext        = current Context
'
Public Declare Function SCardReleaseContext Lib "WINSCARD" _
    (ByVal hContext As Long) As Long

'
' List all availiable Readers
' Parameters:
'       hContext        = current Context
'       mszGroups       = multistring, containing groupnames
'                          if mszGroups is not null only Readers which are
'                          in specified groups are listed
'       mszReaders      = multistring, containing all availiable Readers
'       pcchReaders     = Length of mszReaders in Bytes
'
Public Declare Function SCardListReaders Lib "WINSCARD" Alias "SCardListReadersA" _
    (ByVal hContext As Long, _
     ByVal mszGroups As Byte, _
     ByRef mszReaders As Byte, _
     ByRef pcchReaders As Long) As Long

'
' Connect to one specific Reader
' Parameters:
'       hContext                = current Context
'       szReaders               = name of a Reader
'       dwShareMode             = Share Mode (see ShareModes)
'       dwPreferredProtocols    = Preferred Protocol (see Protocols)
'       hCard                   = Handle to Card
'       dwActiveProtocol        = Returned Protocol
'
Public Declare Function SCardConnect Lib "WINSCARD" Alias "SCardConnectA" _
    (ByVal hContext As Long, _
     ByVal szReader As String, _
     ByVal dwShareMode As Long, _
     ByVal dwPreferredProtocols As Long, _
     ByRef hCard As Long, _
     ByRef dwActiveProtocol As Long) As Long
     
     
 Public Declare Function SCardGetAttrib Lib "WINSCARD" _
    (ByVal hCard As Long, _
     ByVal dwAttrId As Long, _
     ByRef pbAttr As Byte, _
     ByRef pcbAttrLen As Long) As Long
     
    
     
'
' Disconnect from Card
' Parameters:
'       hCard           = Handle to Card
'       dwDisposition   = Action to do with Card (see Dispositions)
'
Public Declare Function SCardDisconnect Lib "WINSCARD" _
    (ByVal hCard As Long, _
     ByVal dwDisposition As Long) As Long

' *******************************************************
' Constants
' *******************************************************

'
' Scopes
'
Public Const SCARD_SCOPE_USER       As Long = 0 'The context is a user context, and any
                                                ' database operations are performed within the
                                                ' domain of the user.
Public Const SCARD_SCOPE_TERMINAL   As Long = 1 'The context is that of the current terminal,
                                                ' and any database operations are performed
                                                ' within the domain of that terminal.  (The
                                                ' calling application must have appropriate
                                                ' access permissions for any database actions.)
Public Const SCARD_SCOPE_SYSTEM     As Long = 2 'The context is the system context, and any
                                                ' database operations are performed within the
                                                ' domain of the system.  (The calling
                                                ' application must have appropriate access
                                                ' permissions for any database actions.)

'
' Share Modes
'
Public Const SCARD_SHARE_EXCLUSIVE  As Long = 1 ' This application is not willing to share this
                                                ' card with other applications.
Public Const SCARD_SHARE_SHARED     As Long = 2 ' This application is willing to share this
                                                ' card with other applications.
Public Const SCARD_SHARE_DIRECT     As Long = 3 ' This application demands direct control of
                                                ' the reader, so it is not available to other
                                                ' applications.
Public Const SCARD_ATTR_ATR_STRING As Long = 590595

'
' Protocols
'
Public Const SCARD_PROTOCOL_UNDEFINED   As Long = &H0       ' There is no active protocol.
Public Const SCARD_PROTOCOL_T0          As Long = &H1       ' T=0 is the active protocol.
Public Const SCARD_PROTOCOL_T1          As Long = &H2       ' T=1 is the active protocol.
Public Const SCARD_PROTOCOL_RAW         As Long = &H10000   ' Raw is the active protocol.


'
' Dispositions (after disconnecting)
'
Public Const SCARD_LEAVE_CARD   As Long = 0   ' Don't do anything special on close
Public Const SCARD_RESET_CARD   As Long = 1   ' Reset the card on close
Public Const SCARD_UNPOWER_CARD As Long = 2   ' Power down the card on close
Public Const SCARD_EJECT_CARD   As Long = 3   ' Eject the card on close

'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -