IC操作 读写器

时间:2015-02-04 10:57:24
【文件属性】:

文件名称:IC操作 读写器

文件大小:3.06MB

文件格式:RAR

更新时间:2015-02-04 10:57:24

IC操作 读写器

UINT mainThread(LPVOID ThreadParam) { int ret; uchar szbuff[100]; for(int i=0;i<10;i++) { //memset(szbuff,0,100); ::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_GET,0,0);//取数据 for(int k=0;k<2;k++) { ret=mifs_request_2(0x26,szbuff); //寻卡 if(ret==0)break; } if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,14,0);continue;} ret=mifs_load_keyE2(0x60,g_SectorNO,g_KeyA);//装载密钥A if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,1,0);continue;} ret=mifs_anticoll(0x00, g_CardSerialNo);//防冲突,返回卡序号 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,3,0);continue;} ret=mifs_select(g_CardSerialNo, szbuff);//根据卡序号选择卡片 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,4,0);continue;} ret=mifs_authenticationE2(0x60,g_CardSerialNo, g_SectorNO);//密钥A验证 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,5,0);continue;} ret=mifs_read(g_BlockNO,g_BlockData);//读取块数据 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,6,0);continue;} /* ret=mifs_authenticationE2(0x61,g_CardSerialNo, g_SectorNO);//密钥B验证 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,7,0);continue;} */ // ret=mifs_initValue(g_BlockNO, g_InitValue);//初始化余额 // if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,8,0);continue;} // ::Sleep(100); ret=mifs_addValue(g_BlockNO, g_AddValue);//增余额 // ret=mifs_value(0xc1,g_BlockNO,g_AddValue); if(ret>0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,10,0);continue;} else if(ret<0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,15,0);break;} ret=mifs_decreaseValue(g_BlockNO, g_DecValue);//减余额 // ret=mifs_value(0xc0,g_BlockNO,g_DecValue); if(ret>0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,11,0);continue;} else if(ret<0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,13,0);break;} ret=mifs_readValue(g_BlockNO, &g_ReadValue);//读余额 if(ret!=0){::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,9,0);continue;} // Buzzer(2);//蜂鸣(加了蜂鸣之后读卡器会滞后) ::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_PUT,0,0);//显示结果 //::Sleep(1000); } ::SendMessage((HWND)ThreadParam,WM_MY_MESSAGE_INFO,12,0); g_ReadFlag=0; return 0; }


【文件预览】:
Mifare One卡操作源码
----M1卡源码()
--------unix()
--------Release()
--------dp()
--------vc()
--------vb()
----使用说明请参看右侧注释====〉〉.txt(771B)

网友评论