封装了枚举当前SD,TF卡片设备接口,同时封装了PCSC设备接口,接口封装层次分明。 示例代码如下 //DWORD dwRet = 0; HANDLE hFile = 0; WIN32_FIND_DATA stLFD = {0}; DWORD dwSumCount = 0; TCHAR athParsePath[MAX_PATH] = {0}; do { if(hFile == 0) { hFile = FindFirstFile(_T("\\*"),&stLFD); if(hFile == INVALID_HANDLE_VALUE ) { return ERROR_NO_DEVICE; } } else { memset(&stLFD,0,sizeof(stLFD)); if(!FindNextFile(hFile,&stLFD) || hFile == 0) { break; } } if(stLFD.dwFileAttributes != (FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_DIRECTORY)) { continue; } memset(athParsePath,0,sizeof(athParsePath)); _stprintf(athParsePath,_T("\\%s\\Vol:"),stLFD.cFileName); #if defined(TYKEY_S9CI_UPDATE_FLAG) && defined(TYKEY_INCOMM_UPDATE_FLAG) if(TYKEY_S9CI_UPDATE_FLAG < TYKEY_INCOMM_UPDATE_FLAG) { if( UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_S9CI) || UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_INCOMM)) {} } else { if( UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_INCOMM) || UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_S9CI)) {} } #else #ifdef TYKEY_S9CI_UPDATE_FLAG UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_S9CI); #endif #ifdef TYKEY_INCOMM_UPDATE_FLAG UpdateTfTokenByPath(athParsePath,CTokenBase::TT_TF_INCOMM); #endif #endif } while(1); if(hFile) { FindClose(hFile); }
1