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

📄 tm95.bas

📁 这是一个银行IC卡门禁系统软件
💻 BAS
字号:
Attribute VB_Name = "tm95"

Option Explicit


'Global SHandle As Long
'Global state_buffer() As Byte
'Global Debounce(100) As Integer
'Global SelectROM(8) As Integer
'Global SelectFile(6) As Byte
'Global DirBuf(256) As Byte
'Global SaveEditData As String
'Global SetupDone As Integer
'Global MaxDbnc As Integer
'
'Declare Function RegOpenKeyExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszSubKey As String, ByVal dwReserved As Long, ByVal samDesired As Long, phkResult As Long) As Long
'Declare Function RegQueryValueExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal lpdwReserved As Any, lpdwType As Long, lpbData As Byte, lpcbData As Long) As Long
'Declare Function RegCloseKey Lib "Advapi32.DLL" (ByVal hKey As Long) As Long
'Public Const KEY_READ As Long = &H120019
'Public Const HKEY_LOCAL_MACHINE As Long = &H80000002
'Public Const ERROR_SUCCESS As Long = &H0
'Public Const REG_SZ As Long = &H1
'
Public Function writetm95(ptemp As String)
    
    Dim ta1 As Byte
    Dim ta2 As Byte
    Dim es As Byte
    Dim temp(6) As Byte
    Dim stemp(6) As Byte
    Dim flag As Integer
    Dim i As Integer
    Dim recs As String
    
    For i = 0 To 5

        temp(i) = Val("&H" + Mid(ptemp, 2 * i + 1, 2))

    Next i
    
    For i = 1 To 4

        PortNum = i
        PortType = 5
        SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)

        If SHandle > 0 Then

            Exit For

        End If

    Next i

    If (SHandle > 0) Then

        If (TMSetup(SHandle) = 1) Then

            If (TMSetup(SHandle) = 1) Then

                If TMFamilySearchSetup(SHandle, state_buffer(0), &HA) >= 1 Then

                    If (TMNext(SHandle, state_buffer(0)) = 1) Then

                        flag = TMRom(SHandle, state_buffer(0), SelectROM(0))

                        If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
                            
                            flag = TMTouchByte(SHandle, &HF)
                            flag = TMTouchByte(SHandle, &H0)
                            flag = TMTouchByte(SHandle, &H0)
                            
                            For i = 0 To 5

                                flag = TMTouchByte(SHandle, temp(i))

                            Next i
                            
                            If TMTouchReset(SHandle) = 1 Then

                                If (TMSetup(SHandle) = 1) Then

                                    If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then

                                        flag = TMTouchByte(SHandle, &HAA)
                                        ta1 = TMTouchByte(SHandle, &HFF)
                                        ta2 = TMTouchByte(SHandle, &HFF)
                                        es = TMTouchByte(SHandle, &HFF)

                                        For i = 0 To 5

                                            stemp(i) = TMTouchByte(SHandle, &HFF)

                                        Next i

                                        For i = 0 To 5

                                            If temp(i) <> stemp(i) Then

                                                writetm95 = False
                                                SHandle = TMEndSession(SHandle)
                                                Exit Function

                                            End If

                                        Next i

                                        If TMTouchReset(SHandle) = 1 Then

                                            If (TMSetup(SHandle) = 1) Then

                                                If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
                                                    
                                                    flag = TMTouchByte(SHandle, &H55)
                                                    flag = TMTouchByte(SHandle, ta1)
                                                    flag = TMTouchByte(SHandle, ta2)
                                                    flag = TMTouchByte(SHandle, es)
                                                    
                                                    If TMTouchReset(SHandle) = 1 Then

                                                        TMEndSession (SHandle)
                                                        writetm95 = True
                                                        Exit Function

                                                    End If

                                                End If

                                            End If

                                        End If

                                    End If

                                End If

                            End If

                        End If

                    End If

                End If

            End If

        End If

    End If

    If TMTouchReset(SHandle) = 1 Then

        SHandle = TMEndSession(SHandle)
        writetm95 = False

    End If
    
End Function

Public Function readtm95()
    
    Dim temp(2048) As Byte
    Dim flag As Integer
    Dim i As Integer
    Dim recs As String
    
    For i = 1 To 4

        PortNum = i
        PortType = 5
        SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)

        If SHandle > 0 Then

            Exit For

        End If

    Next i

    If (SHandle > 0) Then

        If (TMSetup(SHandle) = 1) Then

            If (TMSetup(SHandle) = 1) Then

                If TMFamilySearchSetup(SHandle, state_buffer(0), &HA) >= 1 Then

                    If (TMNext(SHandle, state_buffer(0)) = 1) Then

                        flag = TMRom(SHandle, state_buffer(0), SelectROM(0))

                        If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then

                            flag = TMTouchByte(SHandle, &HF0)
                            flag = TMTouchByte(SHandle, &H0)
                            flag = TMTouchByte(SHandle, &H0)

                            For i = 0 To 2047

                                temp(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            recs = ""

                            For i = 0 To 2047
                                
                                If (temp(i) <= 15) Then

                                    recs = recs + "0" + Hex(temp(i))

                                Else

                                    recs = recs + Hex(temp(i))

                                End If

                            Next i
                            
                            If TMTouchReset(SHandle) = 1 Then

                                TMEndSession (SHandle)
                                readtm95 = recs
                                Exit Function

                            End If

                        End If

                    End If

                End If

            End If

        End If

    End If

    If TMTouchReset(SHandle) = 1 Then

        SHandle = TMEndSession(SHandle)
        readtm95 = ""

    End If

End Function

⌨️ 快捷键说明

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