幽冥大陆(十三)新中新身份证DKQ-A16D SDK CPP——东方仙盟筑基期

B站影视 欧美电影 2025-10-11 01:37 1

摘要:// P0.cpp : 实现文件//#include "stdafx.h"#include "Test.h"#include "M1Test.h"#include "afxdialogex.h"#include "TestDlg.h"#include "Syn

// P0.cpp : 实现文件//#include "stdafx.h"#include "Test.h"#include "M1Test.h"#include "afxdialogex.h"#include "TestDlg.h"#include "SynPublic.h"unsigned char cTouchar1(unsigned char cCard[2],unsigned char mode);// CM1Test 对话框IMPLEMENT_DYNAMIC(CM1Test, Cdialog)CM1Test::CM1Test(CWnd* pParent /*=NULL*/) : CDialog(CM1Test::IDD, pParent){#ifndef _WIN32_WCE EnableActiveAccessibility;#endif}BOOL CM1Test::OnInitDialog{ CDialog::OnInitDialog; GetDlgItem(IDC_EDIT_SECNO)->SetWindowText("0"); GetDlgItem(IDC_EDIT_BLOCKNO)->SetWindowText("1"); GetDlgItem(IDC_EDIT_OLDPASS0)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS1)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS2)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS3)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS4)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS5)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS1)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS2)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS3)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS4)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS5)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA1)->SetWindowText("11"); GetDlgItem(IDC_EDIT_DATA2)->SetWindowText("22"); GetDlgItem(IDC_EDIT_DATA3)->SetWindowText("33"); GetDlgItem(IDC_EDIT_DATA4)->SetWindowText("44"); GetDlgItem(IDC_EDIT_DATA5)->SetWindowText("55"); GetDlgItem(IDC_EDIT_DATA6)->SetWindowText("66"); GetDlgItem(IDC_EDIT_DATA7)->SetWindowText("77"); GetDlgItem(IDC_EDIT_DATA8)->SetWindowText("88"); GetDlgItem(IDC_EDIT_DATA9)->SetWindowText("99"); GetDlgItem(IDC_EDIT_DATA10)->SetWindowText("AA"); GetDlgItem(IDC_EDIT_DATA11)->SetWindowText("BB"); GetDlgItem(IDC_EDIT_DATA12)->SetWindowText("CC"); GetDlgItem(IDC_EDIT_DATA13)->SetWindowText("DD"); GetDlgItem(IDC_EDIT_DATA14)->SetWindowText("EE"); GetDlgItem(IDC_EDIT_DATA15)->SetWindowText("FF"); return TRUE;}CM1Test::~CM1Test{}void CM1Test::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX);}BEGIN_MESSAGE_MAP(CM1Test, CDialog) ON_BN_CLICKED(IDC_M1RESET, &CM1Test::OnBnClickedM1reset) ON_BN_CLICKED(IDC_BUTTON_AUTHENA, &CM1Test::OnBnClickedButtonAuthena) ON_BN_CLICKED(IDC_BUTTON_AUTHENB, &CM1Test::OnBnClickedButtonAuthenb) ON_BN_CLICKED(IDC_BUTTON_CHANGA, &CM1Test::OnBnClickedButtonChanga) ON_BN_CLICKED(IDC_BUTTON_CHANGB, &CM1Test::OnBnClickedButtonChangb) ON_BN_CLICKED(IDC_BUTTON3, &CM1Test::OnBnClickedButton3) ON_BN_CLICKED(IDC_BUTTON5, &CM1Test::OnBnClickedButton5) ON_BN_CLICKED(IDC_BUTTON4, &CM1Test::OnBnClickedButton4) ON_BN_CLICKED(IDC_BUTTON6, &CM1Test::OnBnClickedButton6) ON_BN_CLICKED(IDC_BUTTON7, &CM1Test::OnBnClickedButton7) ON_BN_CLICKED(IDC_BUTTON11, &CM1Test::OnBnClickedButton11) ON_BN_CLICKED(IDC_BUTTON12, &CM1Test::OnBnClickedButton12) ON_BN_CLICKED(IDC_BUTTON10, &CM1Test::OnBnClickedButton10) ON_BN_CLICKED(IDC_BUTTON9, &CM1Test::OnBnClickedButton9) ON_BN_CLICKED(IDC_BUTTON_READ, &CM1Test::OnBnClickedButtonRead) ON_BN_CLICKED(IDC_BUTTON_WRITE, &CM1Test::OnBnClickedButtonWrite) ON_BN_CLICKED(IDC_M1HALT, &CM1Test::OnBnClickedM1halt) ON_BN_CLICKED(IDC_BUTTON13, &CM1Test::OnBnClickedButton13) ON_BN_CLICKED(IDC_BUTTON14, &CM1Test::OnBnClickedButton14) ON_BN_CLICKED(IDC_BUTTON17, &CM1Test::OnBnClickedButton17) ON_BN_CLICKED(IDC_BUTTON15, &CM1Test::OnBnClickedButton15) ON_BN_CLICKED(IDC_BUTTON16, &CM1Test::OnBnClickedButton16) ON_BN_CLICKED(IDC_BUTTON18, &CM1Test::OnBnClickedButton18) ON_BN_CLICKED(IDC_BUTTON19, &CM1Test::OnBnClickedButton19) ON_BN_CLICKED(IDC_BUTTON21, &CM1Test::OnBnClickedButton21) ON_BN_CLICKED(IDC_BUTTON23, &CM1Test::OnBnClickedButton23) ON_BN_CLICKED(IDC_BUTTON20, &CM1Test::OnBnClickedButton20) ON_BN_CLICKED(IDC_BUTTON22, &CM1Test::OnBnClickedButton22) ON_BN_CLICKED(IDC_BUTTON24, &CM1Test::OnBnClickedButton24) ON_WM_TIMEREND_MESSAGE_MAP// CM1Test 消息处理程序void CM1Test::SetParentDialog(CDialog *dialog){ this->dialog=dialog;}void CM1Test::SetPort(int port,int baud){ m_CurrBaud=baud;; m_iPort=port;}void CM1Test::OnBnClickedButton5{ GetDlgItem(IDC_EDIT_OLDPASS0)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS1)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS2)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS3)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS4)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_OLDPASS5)->SetWindowText("FF");}void CM1Test::OnBnClickedButton3{ GetDlgItem(IDC_EDIT_OLDPASS0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_OLDPASS1)->SetWindowText("00"); GetDlgItem(IDC_EDIT_OLDPASS2)->SetWindowText("00"); GetDlgItem(IDC_EDIT_OLDPASS3)->SetWindowText("00"); GetDlgItem(IDC_EDIT_OLDPASS4)->SetWindowText("00"); GetDlgItem(IDC_EDIT_OLDPASS5)->SetWindowText("00");}void CM1Test::OnBnClickedButton4{ GetDlgItem(IDC_EDIT_NEWPASS0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS1)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS2)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS3)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS4)->SetWindowText("00"); GetDlgItem(IDC_EDIT_NEWPASS5)->SetWindowText("00");}void CM1Test::OnBnClickedButton6{ GetDlgItem(IDC_EDIT_NEWPASS0)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS1)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS2)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS3)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS4)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_NEWPASS5)->SetWindowText("FF");}void CM1Test::OnBnClickedButton7{ CString sMsg,sMsg2; GetDlgItem(IDC_EDIT_OLDPASS0)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS0)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS0)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS0)->SetWindowText(sMsg2); GetDlgItem(IDC_EDIT_OLDPASS1)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS1)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS1)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS1)->SetWindowText(sMsg2); GetDlgItem(IDC_EDIT_OLDPASS2)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS2)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS2)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS2)->SetWindowText(sMsg2); GetDlgItem(IDC_EDIT_OLDPASS3)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS3)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS3)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS3)->SetWindowText(sMsg2); GetDlgItem(IDC_EDIT_OLDPASS4)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS4)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS4)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS4)->SetWindowText(sMsg2); GetDlgItem(IDC_EDIT_OLDPASS5)->GetWindowText(sMsg); GetDlgItem(IDC_EDIT_NEWPASS5)->GetWindowText(sMsg2); GetDlgItem(IDC_EDIT_NEWPASS5)->SetWindowText(sMsg); GetDlgItem(IDC_EDIT_OLDPASS5)->SetWindowText(sMsg2);}void CM1Test::OnBnClickedButton9{ GetDlgItem(IDC_EDIT_DATA0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA1)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA2)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA3)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA4)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA5)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA6)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA7)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA8)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA9)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA10)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA11)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA12)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA13)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA14)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA15)->SetWindowText("00");}void CM1Test::OnBnClickedButton10{ GetDlgItem(IDC_EDIT_DATA0)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA1)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA2)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA3)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA4)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA5)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA6)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA7)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA8)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA9)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA10)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA11)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA12)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA13)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA14)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA15)->SetWindowText("FF");}void CM1Test::OnBnClickedButton11{ GetDlgItem(IDC_EDIT_DATA0)->SetWindowText("00"); GetDlgItem(IDC_EDIT_DATA1)->SetWindowText("11"); GetDlgItem(IDC_EDIT_DATA2)->SetWindowText("22"); GetDlgItem(IDC_EDIT_DATA3)->SetWindowText("33"); GetDlgItem(IDC_EDIT_DATA4)->SetWindowText("44"); GetDlgItem(IDC_EDIT_DATA5)->SetWindowText("55"); GetDlgItem(IDC_EDIT_DATA6)->SetWindowText("66"); GetDlgItem(IDC_EDIT_DATA7)->SetWindowText("77"); GetDlgItem(IDC_EDIT_DATA8)->SetWindowText("88"); GetDlgItem(IDC_EDIT_DATA9)->SetWindowText("99"); GetDlgItem(IDC_EDIT_DATA10)->SetWindowText("AA"); GetDlgItem(IDC_EDIT_DATA11)->SetWindowText("BB"); GetDlgItem(IDC_EDIT_DATA12)->SetWindowText("CC"); GetDlgItem(IDC_EDIT_DATA13)->SetWindowText("DD"); GetDlgItem(IDC_EDIT_DATA14)->SetWindowText("EE"); GetDlgItem(IDC_EDIT_DATA15)->SetWindowText("FF");}void CM1Test::OnBnClickedButton12{ GetDlgItem(IDC_EDIT_DATA0)->SetWindowText("FF"); GetDlgItem(IDC_EDIT_DATA1)->SetWindowText("EE"); GetDlgItem(IDC_EDIT_DATA2)->SetWindowText("DD"); GetDlgItem(IDC_EDIT_DATA3)->SetWindowText("CC"); GetDlgItem(IDC_EDIT_DATA4)->SetWindowText("BB"); GetDlgItem(IDC_EDIT_DATA5)->SetWindowText("AA"); GetDlgItem(IDC_EDIT_DATA6)->SetWindowText("99"); GetDlgItem(IDC_EDIT_DATA7)->SetWindowText("88"); GetDlgItem(IDC_EDIT_DATA8)->SetWindowText("77"); GetDlgItem(IDC_EDIT_DATA9)->SetWindowText("66"); GetDlgItem(IDC_EDIT_DATA10)->SetWindowText("55"); GetDlgItem(IDC_EDIT_DATA11)->SetWindowText("44"); GetDlgItem(IDC_EDIT_DATA12)->SetWindowText("33"); GetDlgItem(IDC_EDIT_DATA13)->SetWindowText("22"); GetDlgItem(IDC_EDIT_DATA14)->SetWindowText("11"); GetDlgItem(IDC_EDIT_DATA15)->SetWindowText("00");}void CM1Test::OnBnClickedM1reset{ int nRet; CString sMsg; DWORD dwSerialNo; unsigned char ucSize; if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1Reset(m_iPort,&dwSerialNo,&ucSize); tSpan.EndTime; if (nRet == 0) { sMsg.Format("复位M1卡成功,卡号: %0.8X ,卡类型: %0.2X , %d ms",dwSerialNo,ucSize,tSpan.MSecond); } else { sMsg.Format("复位M1卡失败,nRet = %d, %d ms",nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } ((CTestDlg*)dialog)->InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButtonAuthena{ int nRet; CString sMsg; unsigned char ucKey[6]={0}; unsigned char uTmp[2]; unsigned char ucBloCK = 0; GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_OLDPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[5] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1AuthenKey(m_iPort,0,ucBloCK*4+3,ucKey); tSpan.EndTime; if (nRet == 0) { sMsg.Format("密钥A验证M1卡 %d 扇区成功, %d ms",ucBloCK,tSpan.MSecond); } else { sMsg.Format("密钥A验证M1卡 %d 扇区失败,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButtonAuthenb{ int nRet; CString sMsg; unsigned char ucKey[6]={0}; unsigned char uTmp[2]; unsigned char ucBloCK = 0; GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_OLDPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[5] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1AuthenKey(m_iPort,1,ucBloCK*4+3,ucKey); tSpan.EndTime; if (nRet == 0) { sMsg.Format("密钥B验证M1卡 %d 扇区成功, %d ms",ucBloCK,tSpan.MSecond); } else { sMsg.Format("密钥B验证M1卡 %d 扇区失败,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButtonRead{ int nRet ; CString sMsg; unsigned char ucData[16]={0}; unsigned char ucSec = 0; unsigned char ucBloCK = 0; GetDlgItem(IDC_EDIT_BLOCKNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucSec = atoi(sMsg); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1ReadBlock(m_iPort,ucSec*4 + ucBloCK,ucData); tSpan.EndTime; if (m_iM1ReadStart == 1) { m_iM1ReadSum++; } if (nRet == 0) { if (m_iM1ReadStart == 1) { m_iM1ReadOKSum++; } sMsg.Format("读M1卡 %d 扇区 %d 块成功, %d ms ,数据为:%0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X %0.2X ",ucSec,ucBloCK,tSpan.MSecond,ucData[0],ucData[1],ucData[2],ucData[3],ucData[4],ucData[5],ucData[6],ucData[7],ucData[8],ucData[9],ucData[10],ucData[11],ucData[12],ucData[13],ucData[14],ucData[15]); } else { sMsg.Format("读M1卡 %d 扇区 %d 块失败,nRet = %d, %d ms",ucSec,ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButtonWrite{ int nRet ; CString sMsg; unsigned char ucData[16]={0}; unsigned char uTmp[2]; unsigned char ucSec = 0; unsigned char ucBloCK = 0; GetDlgItem(IDC_EDIT_BLOCKNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucSec = atoi(sMsg); GetDlgItem(IDC_EDIT_DATA0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[5] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA6)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[6] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA7)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[7] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA8)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[8] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA9)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[9] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA10)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[10] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA11)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[11] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA12)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[12] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA13)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[13] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA14)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[14] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA15)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[15] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1WriteBlock(m_iPort,ucSec*4 + ucBloCK,ucData); tSpan.EndTime; if (m_iM1WriteStart == 1) { m_iM1WriteSum++; } if (nRet == 0) { if (m_iM1WriteStart == 1) { m_iM1WriteOKSum++; } sMsg.Format("写M1卡 %d 扇区 %d 块成功, %d ms ",ucSec,ucBloCK,tSpan.MSecond); } else { sMsg.Format("写M1卡 %d 扇区 %d 块失败,nRet = %d, %d ms",ucSec,ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedM1halt{ int nRet; CString sMsg; if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1Halt(m_iPort); tSpan.EndTime; if (nRet == 0) { sMsg.Format("挂起M1卡成功, %d ms",tSpan.MSecond); } else { sMsg.Format("挂起M1卡失败,nRet = %d, %d ms",nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::InsertDebugMes(CString sMsg){ ((CTestDlg*)dialog)->InsertDebugMes(sMsg);}unsigned char cTouchar1(unsigned char cCard[2],unsigned char mode){ unsigned char utmp[2]; unsigned char uRet; for(int j=0;j='A') { utmp[i] = cCard[i] - 'A' + 10; } if(cCard[i]='a') { utmp[i] = cCard[i] - 'a' + 10; } if(cCard[i]='0') { utmp[i] = cCard[i] - '0'; } } if (mode ==2) { uRet = utmp[0]*0X10 + utmp[1] ; } else { uRet = utmp[1]*0X10 + utmp[0] ; } return uRet;}void CM1Test::OnTimer(UINT_PTR nIDEvent){ if ( nIDEvent == 2 || nIDEvent == 4) { //OnBnClickedM1reset; OnBnClickedButton13; } if ( nIDEvent == 3) { //OnBnClickedM1reset; OnBnClickedButton15; } if ( nIDEvent == 5) { OnBnClickedButton19; } if ( nIDEvent == 6) { OnBnClickedButton20; } int m_iLoopSum=((CTestDlg*)dialog)->getLoopSum; switch (nIDEvent){ case 2: if (m_iM1ReadSum == m_iLoopSum) { OnBnClickedButton17; } break; case 3: if (m_iM1WriteSum == m_iLoopSum) { OnBnClickedButton18; } break; case 5: if (m_iM1ReadSum == m_iLoopSum) { OnBnClickedButton23; } break; case 6: if (m_iM1WriteSum == m_iLoopSum) { OnBnClickedButton24; } break; default : break; } CDialog::OnTimer(nIDEvent);}void CM1Test::OnBnClickedButton21{ KillTimer(m_iTime); m_iM1ReadStart = 1; m_iM1ReadSum = 0; m_iM1ReadOKSum = 0; m_iTime = SetTimer(5,1000,0);}void CM1Test::OnBnClickedButton23{ CString sMsg; m_iM1ReadStart = 0; KillTimer(m_iTime); sMsg.Format("读M1卡所有块 总计 %d 次,成功 %d 次",m_iM1ReadSum,m_iM1ReadOKSum); InsertDebugMes(sMsg); AfxMessageBox(sMsg);}void CM1Test::OnBnClickedButton22{ KillTimer(m_iTime); m_iM1WriteStart = 1; m_iM1WriteSum = 0; m_iM1WriteOKSum = 0; m_iTime = SetTimer(6,1000,0);}void CM1Test::OnBnClickedButton24{ CString sMsg; m_iM1WriteStart = 0; KillTimer(m_iTime); sMsg.Format("写M1卡所有块 总计 %d 次,成功 %d 次",m_iM1WriteSum,m_iM1WriteOKSum); InsertDebugMes(sMsg); AfxMessageBox(sMsg);}void CM1Test::OnBnClickedButton14{ KillTimer(m_iTime); m_iM1ReadStart = 1; m_iM1ReadSum = 0; m_iM1ReadOKSum = 0; m_iTime = SetTimer(2,1000,0);}void CM1Test::OnBnClickedButton17{ CString sMsg; unsigned char ucSec = 0; unsigned char ucBloCK = 0; m_iM1ReadStart = 0; GetDlgItem(IDC_EDIT_BLOCKNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucSec = atoi(sMsg); KillTimer(m_iTime); sMsg.Format("读M1卡 %d 扇区 %d 块 总计 %d 次,成功 %d 次",ucSec,ucBloCK,m_iM1ReadSum,m_iM1ReadOKSum); InsertDebugMes(sMsg); AfxMessageBox(sMsg);}void CM1Test::OnBnClickedButton16{ KillTimer(m_iTime); m_iM1WriteStart = 1; m_iM1WriteSum = 0; m_iM1WriteOKSum = 0; m_iTime = SetTimer(3,1000,0);}void CM1Test::OnBnClickedButton18{ CString sMsg; unsigned char ucSec = 0; unsigned char ucBloCK = 0; m_iM1WriteStart = 0; GetDlgItem(IDC_EDIT_BLOCKNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucSec = atoi(sMsg); KillTimer(m_iTime); sMsg.Format("写M1卡 %d 扇区 %d 块 总计 %d 次,成功 %d 次",ucSec,ucBloCK,m_iM1WriteSum,m_iM1WriteOKSum); InsertDebugMes(sMsg); AfxMessageBox(sMsg);}void CM1Test::OnBnClickedButton13{ OnBnClickedM1reset; OnBnClickedButtonAuthena; OnBnClickedButtonRead;}void CM1Test::OnBnClickedButton15{ OnBnClickedM1reset; OnBnClickedButtonAuthena; OnBnClickedButtonWrite;}void CM1Test::OnBnClickedButtonChanga{ int nRet; CString sMsg; unsigned char ucKey[6]={0},ucKey2[6]={0}; unsigned char uTmp[2]; unsigned char ucBloCK = 0; unsigned char ucData[16]={0}; DWORD dwSerialNo; unsigned char ucSize; GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_OLDPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[5] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[5] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1Reset(m_iPort,&dwSerialNo,&ucSize); nRet = Syn_USBHIDM1AuthenKey(m_iPort,0,ucBloCK*4+3,ucKey); if (nRet == 0) { nRet = Syn_USBHIDM1ReadBlock(m_iPort,ucBloCK*4+3,ucData); if (nRet == 0) { memcpy(ucData,ucKey2,6); nRet = Syn_USBHIDM1WriteBlock(m_iPort,ucBloCK*4+3,ucData); tSpan.EndTime; if (nRet == 0) { sMsg.Format("修改M1卡 %d 扇区密钥A成功, %d ms",ucBloCK,tSpan.MSecond); } else { sMsg.Format("修改M1卡 %d 扇区密钥A失败,写错误,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { tSpan.EndTime; sMsg.Format("修改M1卡 %d 扇区密钥A失败,读错误,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { tSpan.EndTime; sMsg.Format("密钥A验证M1卡 %d 扇区失败,无法修改密钥A,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButtonChangb{ int nRet; CString sMsg; unsigned char ucKey[6]={0},ucKey2[6]={0}; unsigned char uTmp[2]; unsigned char ucBloCK = 0; unsigned char ucData[16]={0}; DWORD dwSerialNo; unsigned char ucSize; GetDlgItem(IDC_EDIT_SECNO)->GetWindowText(sMsg); ucBloCK = atoi(sMsg); GetDlgItem(IDC_EDIT_OLDPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_OLDPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey[5] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_NEWPASS5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucKey2[5] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; nRet = Syn_USBHIDM1Reset(m_iPort,&dwSerialNo,&ucSize); nRet = Syn_USBHIDM1AuthenKey(m_iPort,0,ucBloCK*4+3,ucKey); if (nRet == 0) { nRet = Syn_USBHIDM1ReadBlock(m_iPort,ucBloCK*4+3,ucData); if (nRet == 0) { memcpy(ucData+10,ucKey2,6); nRet = Syn_USBHIDM1WriteBlock(m_iPort,ucBloCK*4+3,ucData); tSpan.EndTime; if (nRet == 0) { sMsg.Format("修改M1卡 %d 扇区密钥B成功, %d ms",ucBloCK,tSpan.MSecond); } else { sMsg.Format("修改M1卡 %d 扇区密钥B失败,写错误,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { tSpan.EndTime; sMsg.Format("修改M1卡 %d 扇区密钥B失败,读错误,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { tSpan.EndTime; sMsg.Format("验证M1卡 %d 扇区失败,无法修改密钥B,nRet = %d, %d ms",ucBloCK,nRet,tSpan.MSecond); } } else { sMsg = "打开端口错误"; } if (m_iPort >0) { Syn_ClosePort(m_iPort); } }else if(m_iPort0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButton19{ int nRet ; int nErr = 0; CString sMsg; unsigned char ucData[16]={0}; if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; for (int i = 0;i0) { Syn_ClosePort(m_iPort); } }else if(m_iPortGetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; for (int i = 0;i0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}void CM1Test::OnBnClickedButton20{ int nRet ; int nErr = 0; CString sMsg; unsigned char ucData[16]={0}; unsigned char uTmp[2]={0}; GetDlgItem(IDC_EDIT_DATA0)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[0] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA1)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[1] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA2)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[2] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA3)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[3] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA4)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[4] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA5)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[5] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA6)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[6] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA7)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[7] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA8)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[8] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA9)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[9] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA10)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[10] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA11)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[11] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA12)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[12] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA13)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[13] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA14)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[14] = cTouchar1(uTmp,sMsg.GetLength); GetDlgItem(IDC_EDIT_DATA15)->GetWindowText(sMsg); memcpy(uTmp,sMsg,2); ucData[15] = cTouchar1(uTmp,sMsg.GetLength); if (m_iPort == 9999) { nRet = Syn_OpenPort(m_iPort); //Syn_USBSetTransportType(m_iPort,((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; for (int i = 1;i0) { Syn_ClosePort(m_iPort); } }else if(m_iPortGetCheck); if (nRet == 0) { CCalcTime tSpan; tSpan.Clear; tSpan.BegginTime; for (int i = 0;i0) { Syn_SerialClose(m_iPort); } } else { sMsg = "此读卡器不支持该功能"; } InsertDebugMes(sMsg);}

在东方仙盟的筑基期,修仙者们开始接触各类奇妙法术,以探索和掌控灵域中的神秘力量。这段代码宛如一本珍贵的法术秘籍,专注于对 M1 卡的操作,如同赋予修仙者们一把能开启 M1 卡信息宝库的神奇钥匙,使其能够对 M1 卡进行复位、验证、读写以及密钥修改等操作,在灵域的数字化世界中建立起与 M1 卡之间的神秘联系。

在东方仙盟的诸多灵域事务中,M1 卡操作犹如一种神奇且实用的法术,拥有广泛的应用场景。在仙盟的门禁管理灵域,M1 卡可作为身份识别的令牌。修仙者通过对 M1 卡的读取与验证,确认来访者是否有权进入特定区域,就像守护灵域重要场所的神秘结界,只有持有正确 “密码”(M1 卡有效信息)的修仙者才能顺利通过。在资源分配灵域,M1 卡可记录修仙者的资源配额信息。通过对 M1 卡的读写操作,管理者能够准确分配和调整资源,确保资源合理分配给每一位修仙者,维持灵域资源秩序的稳定。而在灵盟的交易市场中,M1 卡可作为交易凭证,记录交易信息和双方身份,保障交易的安全与可追溯性,如同交易中的公正见证法器,防止欺诈行为,维护市场的公平公正。

在东方仙盟的众多行业中,M1 卡操作功能如同强大的灵力,为各个行业注入新的活力。在仙盟的行政管理行业,它协助管理人员高效处理人员信息与权限管理,就像为行政管理的灵力脉络打通阻塞,使其顺畅运行。在安全保卫行业,M1 卡操作成为守护灵域安全的坚固护盾。通过精确识别人员身份,安保人员能够迅速判断来访者是否具有进入特定区域的权限,有效防范潜在的安全威胁。在信息存储与传递行业,M1 卡作为信息的载体,通过代码对其进行操作,实现信息的安全存储与准确传递,如同信息的忠诚信使,确保信息在灵域中准确无误地流转。

随着东方仙盟的不断发展,对身份验证、信息管理和安全保障的需求日益增长,M1 卡操作功能的发展前景极为广阔。未来,它可能会与更多的仙盟法术和工具相结合,实现更强大的功能。例如,与灵域追踪法术结合,实时监控 M1 卡携带者的行踪,为仙盟的安全保障提供更有力的支持。还可能与仙盟的大数据分析法术融合,从海量的 M1 卡信息中挖掘出有价值的线索,助力仙盟在资源分配、修行指导等方面做出更精准的决策。如同在灵域中绽放出更加绚烂的灵力光芒,为仙盟的繁荣发展发挥更大的作用。

对于东方仙盟筑基期的初学者而言,掌握这段 M1 卡操作代码,恰似踏上一段充满挑战与机遇的神秘探索之旅。首先,要像虔诚的学徒般,深刻理解代码中各个函数和操作的意义。这就如同领悟法术的关键口诀,只有理解了每个步骤的作用,才能正确施展法术。例如,Syn_OpenPort、Syn_USBHIDM1Reset 等函数,分别对应着打开与 M1 卡通信的通道、对 M1 卡进行复位操作,如同在施展法术之前准备好法器和调整灵力状态。

接着,要仔细研读代码中对各种操作的实现逻辑。例如,在验证密钥和读写数据时,如何获取用户输入的信息、如何将其转换为与 M1 卡交互所需的格式,这就如同在法术施展过程中精确控制灵力的流动和变化。同时,要注重实践操作,在模拟的场景中不断尝试运行代码,观察结果,如同在灵域的试炼场中磨练法术技巧,从实践中加深对代码的理解。

在学习过程中,难免会遇到各种问题,比如端口打开失败、数据读写错误等,这就如同在探索灵域的过程中遭遇重重迷雾和阻碍。此时,要保持耐心与毅力,多参考成功案例和前辈的经验,如同借鉴前辈修仙者的智慧,逐步排查问题,找到解决方案。同时,积极参与仙盟中的技术交流活动,与其他修仙者分享心得,共同进步,最终熟练掌握 M1 卡操作代码这一重要技能,为自己在仙盟中的修行之路增添强大助力。

让我们积极投身于技术共享的浪潮中,不仅仅是作为受益者,更要成为贡献者。无论是分享自己的代码、撰写技术博客,还是参与开源项目的维护和改进,每一个小小的举动都可能成为推动技术进步的巨大力量

Embrace open source and sharing, witness the miracle of technological progress, and enjoy the happy times of humanity! Let's actively join the wave of technology sharing. Not only as beneficiaries, but also as contributors. Whether sharing our own code, writing technical blogs, or participating in the maintenance and improvement of open source projects, every small action may become a huge force driving technological progrss.

来源:吉米游戏

相关推荐