char *MakeBackup(const char *FileName, char *NewName) { int l = strlen(FileName); if (l <= 0) return NULL; /* try 1 */ if (strlen(BackupDirectory) > 0) { char TmpFileName[MAXPATH]; char TmpBackupName[MAXPATH]; strcpy(TmpFileName, FileName); for (size_t idx=0; idx < strlen(TmpFileName); idx++) if (TmpFileName[idx] == '/' || TmpFileName[idx] == '\\' || TmpFileName[idx] == ':') TmpFileName[idx] = '_'; snprintf(TmpBackupName, MAXPATH, "%s/%s", BackupDirectory, TmpFileName); ExpandPath(TmpBackupName, NewName, MAXPATH); } else snprintf(NewName, MAXPATH, "%s~", FileName); if (!IsSameFile(FileName, NewName)) { if (access(NewName, 0) == 0) // Backup already exists? unlink(NewName); // Then delete the file.. if (access(FileName, 0) != 0) // Original found? return NewName; if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; /* file not found */ #endif } /* try 2: 8.3 */ strcpy(NewName, FileName); NewName[l-1] = '~'; if (!IsSameFile(FileName, NewName)) { if (access(NewName, 0) == 0) // Backup exists? unlink(NewName); // Then delete; if (access(FileName, 0) != 0) // Original exists? return NewName; // If not-> return base.. if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; #endif } return NULL; }
bool OperCFThread::CopyLink( FS* srcFs, FSPath& srcPath, FSNode* srcNode, FS* destFs, FSPath& destPath, bool move ) { ASSERT( srcNode->st.IsLnk() ); if ( IsSameFile( srcFs, srcPath, &( srcNode->st ), destFs, destPath ) ) { RedMessage( _LT( "Can't copy link to itself:\n" ) , srcFs->Uri( srcPath ).GetUtf8() ); return false; } int ret_err; while ( destFs->Symlink( destPath, srcNode->st.link, &ret_err, Info() ) && !skipNonRegular ) switch ( RedMessage( _LT( "Can't create symbolic link:\n" ), destFs->Uri( destPath ).GetUtf8(), "to\n", srcNode->st.link.GetUtf8(), bSkipSkipallCancel, destFs->StrError( ret_err ).GetUtf8() ) ) { case CMD_CANCEL: return false; case CMD_SKIPALL: skipNonRegular = true; case CMD_SKIP: return true; } return !move || Unlink( srcFs, srcPath ); }
int OperCFThread::MoveFile( FS* srcFs, FSPath& srcPath, FSNode* srcNode, FS* destFs, FSPath& destPath ) { if ( srcFs != destFs && !srcFs->Equal( destFs ) ) { return 1; } if ( IsSameFile( srcFs, srcPath, &( srcNode->st ), destFs, destPath ) ) { RedMessage( _LT( "Can't move file to itself:\n" ), srcFs->Uri( srcPath ).GetUtf8() ); return -1; } int ret_error; FSStat st; if ( !destFs->Stat( destPath, &st, &ret_error, Info() ) ) { if ( !commitAll ) { switch ( RedMessage( _LT( "Overwrite file?\n" ), destFs->Uri( destPath ).GetUtf8(), bOkAllNoCancel, destFs->StrError( ret_error ).GetUtf8() ) ) { case CMD_ALL: commitAll = true; //no break case CMD_OK: break; case CMD_NO: return 0; default: return -1; } } if ( destFs->Delete( destPath, &ret_error, Info() ) ) return RedMessage( _LT( "Can't delete the file:\n" ), destFs->Uri( destPath ).GetUtf8(), bSkipCancel, destFs->StrError( ret_error ).GetUtf8() ) == CMD_SKIP ? 0 : -1 ; } if ( srcFs->Rename( srcPath, destPath, &ret_error, Info() ) ) { if ( srcFs->IsEXDEV( ret_error ) ) { return 1; } return RedMessage( _LT( "Can't rename the file:\n" ), srcFs->Uri( srcPath ).GetUtf8(), "\nto\n", destFs->Uri( destPath ).GetUtf8(), bSkipCancel, srcFs->StrError( ret_error ).GetUtf8() ) == CMD_SKIP ? 0 : -1; } return 0; }
/* * Is this file the same as any other one in the store */ static int SameFileIsInStore(Pathstore *store, char *pathname) { PathstoreElement *e = store->elementList; while (e) { if (IsSameFile(store, pathname, e->pathname)) { return 1; // In store already } e = e->nextElement; } return 0; // Not found in store }
void CPatchManager::CheckFiles() { DWORD dwTotal = m_files.size(); DWORD i = 0; FILE_INFO info; FileContainerIterator it; for( it = m_files.begin(); it != m_files.end(); ) { info = ( *it ); if( info.bDir ) // 디렉토리이면 { CreateDirectory( info.szPath, NULL ); it = m_files.erase( it ); } else // 파일이면 { if( IsSameFile( info ) ) it = m_files.erase( it ); else { char szMsg[512]; wsprintf( szMsg, "IsSameFile: %s\n", info.szPath ); OutputDebugString( szMsg ); ++it; } } if( g_pDlg->IsClose() ) return; i++; g_pDlg->m_File_Progress.SetPos( i * 100 / dwTotal ); } }
int OperCFThread::MoveDir( FS* srcFs, FSPath& __srcPath, FSNode* srcNode, FS* destFs, FSPath& __destPath ) { if ( Info()->Stopped() ) { return -1; } if ( srcFs != destFs ) { return 1; } FSPath srcPath = __srcPath; int srcPos = srcPath.Count(); FSPath destPath = __destPath; int destPos = destPath.Count(); if ( IsSameFile( srcFs, srcPath, &( srcNode->st ), destFs, destPath ) ) { RedMessage( _LT( "Can't move directory to itself:\n" ), srcFs->Uri( __srcPath ).GetUtf8() ); return -1; } FSStat st; int ret_error; if ( !destFs->Stat( destPath, &st, &ret_error, Info() ) ) { if ( !st.IsDir() ) { switch ( RedMessage( _LT( "Can't copy directory\n" ), srcFs->Uri( srcPath ).GetUtf8(), _LT( "to file" ), "\n", _LT( "Delete the file?" ), destFs->Uri( destPath ).GetUtf8(), bOkSkipCancel ) ) { case CMD_CANCEL: return -1; case CMD_SKIP: return 0; } if ( !Unlink( destFs, destPath ) ) { return -1; } } else { FSList list; while ( true ) { int ret = srcFs->ReadDir( &list, srcPath, &ret_error, Info() ); if ( ret == -2 ) { return -1; } if ( !ret ) { break; } switch ( RedMessage( _LT( "Can`t open directory:\n" ), srcFs->Uri( __srcPath ).GetUtf8(), bRetrySkipCancel, srcFs->StrError( ret_error ).GetUtf8() ) ) { case CMD_SKIP: return 0; case CMD_RETRY: continue; default: return -1; } } for ( FSNode* node = list.First(); node; node = node->next ) { if ( Info()->Stopped() ) { return -1; } srcPath.SetItemStr( srcPos, node->Name() ); destPath.SetItemStr( destPos, node->Name() ); if ( !MoveFile( srcFs, srcPath, node, destFs, destPath ) ) { return -1; } } destFs->SetFileTime( destPath, srcNode->st.m_CreationTime, srcNode->st.m_LastWriteTime, srcNode->st.m_LastWriteTime, 0, Info() ); return RmDir( srcFs, srcPath ) ? 0 : -1; } } if ( srcFs->Rename( srcPath, destPath, &ret_error, Info() ) ) { if ( srcFs->IsEXDEV( ret_error ) ) { return 1; } return RedMessage( _LT( "Can't rename the directory:\n" ), srcFs->Uri( srcPath ).GetUtf8(), "\nto\n", destFs->Uri( destPath ).GetUtf8(), bSkipCancel, srcFs->StrError( ret_error ).GetUtf8() ) == CMD_SKIP ? 0 : -1; } return 0; }
bool OperCFThread::CopyFile( FS* srcFs, FSPath& srcPath, FSNode* srcNode, FS* destFs, FSPath& destPath, bool move ) { if ( !srcNode->st.IsReg() && !skipNonRegular ) switch ( RedMessage( _LT( "Can't copy the links or special file:\n" ), srcFs->Uri( srcPath ).GetUtf8(), bSkipSkipallCancel ) ) { case CMD_SKIPALL: skipNonRegular = true; // no break case CMD_SKIP: return true; default: return false; } if ( IsSameFile( srcFs, srcPath, &( srcNode->st ), destFs, destPath ) ) { RedMessage( _LT( "Can't copy file to itself:\n" ) , srcFs->Uri( srcPath ).GetUtf8() ); return false; } SendCopyNextFileInfo( srcFs->Uri( srcPath ), destFs->Uri( destPath ) ); SendProgressInfo( srcNode->st.size, 0, 0 ); bool stopped = false; int ret_err; int in = -1; if (destFs->Type() == FS::TYPES::TMP) { // copy and move to tmpfs work the same way. Should we yell on move op instead? FSTmp* destTmpFS = static_cast<FSTmp*>(destFs); if (!destTmpFS->BaseIsEqual(srcFs)) { RedMessage(_LT("Temporary panel can store only files from the same file system:\n")); return false; } if (srcFs->Type() == FS::TMP && srcNode->IsReg()) { FSString srcFullFSString(srcNode->name.GetUnicode()); FSPath srcFullFSPath(srcFullFSString); //srcFullFSPath.dbg_printf("OperCFThread::CopyFile srcFullFSPath="); //destPath.dbg_printf("OperCFThread::CopyFile destPath="); FSPath destDir(destPath); destDir.Pop(); return destTmpFS->AddNode(srcFullFSPath, destDir); } else return destTmpFS->AddNode(srcPath, srcNode, destPath); } while ( true ) { in = srcFs->OpenRead( srcPath, FS::SHARE_READ, &ret_err, Info() ); if ( in == -2 ) { return false; } if ( in >= 0 ) { break; } switch ( RedMessage( _LT( "Can't open file:\n" ) , srcFs->Uri( srcPath ).GetUtf8(), bRetrySkipCancel, srcFs->StrError( ret_err ).GetUtf8() ) ) { case CMD_CANCEL: return false; case CMD_SKIP: return true; } } int out = -1; out = destFs->OpenCreate( destPath, false | commitAll, srcNode->st.mode, 0, &ret_err, Info() ); if ( out < 0 && destFs->IsEEXIST( ret_err ) ) switch ( RedMessage( _LT( "Overwrite file?\n" ) , destFs->Uri( destPath ).GetUtf8(), bOkAllNoCancel ) ) { case CMD_ALL: commitAll = true; //no break case CMD_OK: out = destFs->OpenCreate( destPath, true, srcNode->st.mode, 0, &ret_err, Info() ); break; case CMD_NO: srcFs->Close( in, 0, Info() ); return true; default: srcFs->Close( in, 0, Info() ); return false; } if ( out < 0 ) { srcFs->Close( in, 0, Info() ); return RedMessage( _LT( "Can't create file:\n" ), destFs->Uri( destPath ).GetUtf8(), bSkipCancel, destFs->StrError( ret_err ).GetUtf8() ) == CMD_SKIP; } int bytes; //char buf[BUFSIZE]; int64_t doneBytes = 0; int blockSize = STARTSIZE; while ( true ) { if ( Info()->Stopped() ) { stopped = true; goto err; } time_t timeStart = time( 0 ); if ( ( bytes = srcFs->Read( in, _buffer, blockSize, &ret_err, Info() ) ) < 0 ) { if ( bytes == -2 || RedMessage( _LT( "Can't read the file:\n" ), srcFs->Uri( srcPath ).GetUtf8(), bSkipCancel, srcFs->StrError( ret_err ).GetUtf8() ) != CMD_SKIP ) { stopped = true; } goto err; } if ( !bytes ) { break; } int b; if ( ( b = destFs->Write( out, _buffer, bytes, &ret_err, Info() ) ) < 0 ) { if ( b == -2 || RedMessage( _LT( "Can't write the file:\n" ), destFs->Uri( destPath ).GetUtf8(), bSkipCancel, destFs->StrError( ret_err ).GetUtf8() ) != CMD_SKIP ) { stopped = true; } goto err; } if ( b != bytes ) { if ( RedMessage( "May be disk full \n(writed bytes != readed bytes)\nwhen write:\n", destFs->Uri( destPath ).GetUtf8(), bSkipCancel ) != CMD_SKIP ) { stopped = true; } goto err; } time_t timeStop = time( 0 ); if ( timeStart == timeStop && blockSize < BSIZE ) { blockSize = blockSize * 2; if ( blockSize > BSIZE ) { blockSize = BSIZE; } } doneBytes += bytes; SendProgressInfo( srcNode->st.size, doneBytes, bytes ); } srcFs->Close( in, 0, Info() ); in = -1; SendProgressInfo( srcNode->st.size, srcNode->st.size, 0 ); { int r = destFs->Close( out, &ret_err, Info() ); if ( r ) { if ( r == -2 || RedMessage( "Can't close the file:\n", destFs->Uri( destPath ).GetUtf8(), bSkipCancel, destFs->StrError( ret_err ).GetUtf8() ) != CMD_SKIP ) { stopped = true; } goto err; } else { out = -1; } } destFs->SetFileTime( destPath, srcNode->st.m_CreationTime, srcNode->st.m_LastWriteTime, srcNode->st.m_LastWriteTime, 0, Info() ); return !move || Unlink( srcFs, srcPath ); err: if ( in >= 0 ) { srcFs->Close( in, 0, Info() ); } if ( out >= 0 ) { destFs->Close( out, 0, Info() ); } Unlink( destFs, destPath ); return !stopped; }
bool OperCFThread::CopyFile(FS *srcFs, FSPath &srcPath, FSNode *srcNode, FS *destFs, FSPath &destPath, bool move) { if (!srcNode->st.IsReg() && !skipNonRegular) switch (RedMessage( _LT("Can't copy the links or special file:\n"), srcFs->Uri(srcPath).GetUtf8(), bSkipSkipallCancel)) { case CMD_SKIPALL: skipNonRegular = true; // no break case CMD_SKIP: return true; default: return false; } if (IsSameFile(srcFs, srcPath, &(srcNode->st), destFs, destPath)) { RedMessage( _LT("Can't copy file to itself:\n") , srcFs->Uri(srcPath).GetUtf8()); return false; } SendCopyNextFileInfo(srcFs->Uri(srcPath), destFs->Uri(destPath)); SendProgressInfo(srcNode->st.size, 0); bool stopped = false; int ret_err; int in = -1; while (true) { in = srcFs->OpenRead(srcPath, FS::SHARE_READ, &ret_err, Info()); if (in == -2) return false; if (in>=0) break; switch (RedMessage( _LT("Can't open file:\n") , srcFs->Uri(srcPath).GetUtf8(), bRetrySkipCancel, srcFs->StrError(ret_err).GetUtf8())) { case CMD_CANCEL: return false; case CMD_SKIP: return true; } } int out = -1; out = destFs->OpenCreate(destPath, false | commitAll, srcNode->st.mode, 0, &ret_err, Info()); if (out < 0 && destFs->IsEEXIST(ret_err)) switch (RedMessage( _LT("Owerwrite file?\n") , destFs->Uri(destPath).GetUtf8(), bOkAllNoCancel)) { case CMD_ALL: commitAll = true; //no break case CMD_OK: out = destFs->OpenCreate(destPath, true, srcNode->st.mode, 0, &ret_err, Info()); break; case CMD_NO: srcFs->Close(in, 0, Info()); return true; default: srcFs->Close(in, 0, Info()); return false; } if (out < 0) { srcFs->Close(in, 0, Info()); return RedMessage( _LT("Can't create file:\n"), destFs->Uri(destPath).GetUtf8(), bSkipCancel, destFs->StrError(ret_err).GetUtf8()) == CMD_SKIP; } int bytes; //char buf[BUFSIZE]; int64 doneBytes = 0; int blockSize = STARTSIZE; while (true) { if (Info()->Stopped()) { stopped = true; goto err; } time_t timeStart = time(0); if ((bytes = srcFs->Read(in, _buffer, blockSize, &ret_err, Info())) < 0) { if (bytes == -2 || RedMessage( _LT("Can't read the file:\n"), srcFs->Uri(srcPath).GetUtf8(), bSkipCancel, srcFs->StrError(ret_err).GetUtf8()) != CMD_SKIP) { stopped = true; } goto err; } if (!bytes) break; int b; if ((b = destFs->Write(out, _buffer, bytes, &ret_err, Info())) < 0) { if (b == -2 || RedMessage( _LT("Can't write the file:\n"), destFs->Uri(destPath).GetUtf8(), bSkipCancel, destFs->StrError(ret_err).GetUtf8()) != CMD_SKIP) stopped = true; goto err; } if (b != bytes) { if (RedMessage("May be disk full \n(writed bytes != readed bytes)\nwhen write:\n", destFs->Uri(destPath).GetUtf8(), bSkipCancel) != CMD_SKIP) stopped = true; goto err; } time_t timeStop = time(0); if (timeStart == timeStop && blockSize < BSIZE) { blockSize = blockSize*2; if (blockSize > BSIZE) blockSize = BSIZE; } doneBytes += bytes; SendProgressInfo(srcNode->st.size, doneBytes); } srcFs->Close(in, 0, Info()); in = -1; SendProgressInfo(srcNode->st.size, srcNode->st.size); { int r = destFs->Close(out, &ret_err, Info()); if (r) { if (r == -2 || RedMessage( "Can't close the file:\n", destFs->Uri(destPath).GetUtf8(), bSkipCancel, destFs->StrError(ret_err).GetUtf8()) != CMD_SKIP) stopped = true; goto err; } else out = -1; } destFs->SetFileTime(destPath, srcNode->st.mtime, srcNode->st.mtime, 0, Info()); return !move || Unlink(srcFs, srcPath); err: if (in >= 0) srcFs->Close(in, 0, Info()); if (out >= 0) destFs->Close(out, 0, Info()); Unlink(destFs, destPath); return !stopped; }
BOOL TInstDlg::Install(void) { char buf[MAX_PATH], setupDir[MAX_PATH], setupPath[MAX_PATH]; BOOL is_delay_copy = FALSE; int len; // インストールパス設定 len = GetDlgItemText(FILE_EDIT, setupDir, sizeof(setupDir)); if (GetChar(setupDir, len-1) == '\\') SetChar(setupDir, len-1, 0); Wstr w_setup(setupDir); if (IsWinVista() && TIsVirtualizedDirV(w_setup.Buf())) { if (!TIsUserAnAdmin()) { return RunAsAdmin(TRUE); } else if (cfg.runImme && cfg.setupDir && lstrcmpiV(w_setup.Buf(), cfg.setupDir)) { return MessageBox(GetLoadStr(IDS_ADMINCHANGE)), FALSE; } } CreateDirectory(setupDir, NULL); DWORD attr = GetFileAttributes(setupDir); if (attr == 0xffffffff || (attr & FILE_ATTRIBUTE_DIRECTORY) == 0) return MessageBox(GetLoadStr(IDS_NOTCREATEDIR)), FALSE; MakePath(setupPath, setupDir, FASTCOPY_EXE); if (MessageBox(GetLoadStr(IDS_START), INSTALL_STR, MB_OKCANCEL|MB_ICONINFORMATION) != IDOK) return FALSE; // ファイルコピー if (cfg.mode == SETUP_MODE) { char installPath[MAX_PATH], orgDir[MAX_PATH]; ::GetModuleFileName(NULL, orgDir, sizeof(orgDir)); GetParentDir(orgDir, orgDir); for (int cnt=0; SetupFiles[cnt] != NULL; cnt++) { MakePath(buf, orgDir, SetupFiles[cnt]); MakePath(installPath, setupDir, SetupFiles[cnt]); if (MiniCopy(buf, installPath) || IsSameFile(buf, installPath)) continue; if ((strcmp(SetupFiles[cnt], CURRENT_SHEXTDLL_EX) == 0 || strcmp(SetupFiles[cnt], CURRENT_SHEXTDLL) == 0) && DelayCopy(buf, installPath)) { is_delay_copy = TRUE; continue; } return MessageBox(installPath, GetLoadStr(IDS_NOTCREATEFILE)), FALSE; } } // スタートメニュー&デスクトップに登録 char *linkPath[] = { toA(cfg.startMenu, TRUE), toA(cfg.deskTop, TRUE), NULL }; BOOL execFlg[] = { cfg.programLink, cfg.desktopLink, NULL }; for (int cnt=0; linkPath[cnt]; cnt++) { strcpy(buf, linkPath[cnt]); if (cnt != 0 || RemoveSameLink(linkPath[cnt], buf) == FALSE) { ::wsprintf(buf + strlen(buf), "\\%s", FASTCOPY_SHORTCUT); } if (execFlg[cnt]) { if (IS_WINNT_V) { Wstr w_setup(setupPath, BY_MBCS); Wstr w_buf(buf, BY_MBCS); SymLinkV(w_setup.Buf(), w_buf.Buf()); } else { SymLinkV(setupPath, buf); } } else { if (IS_WINNT_V) { Wstr w_buf(buf, BY_MBCS); DeleteLinkV(w_buf.Buf()); } else { DeleteLinkV(buf); } } } #if 0 // レジストリにアンインストール情報を登録 if (reg.OpenKey(REGSTR_PATH_UNINSTALL)) { if (reg.CreateKey(FASTCOPY)) { MakePath(buf, setupDir, INSTALL_EXE); strcat(buf, " /r"); reg.SetStr(REGSTR_VAL_UNINSTALLER_DISPLAYNAME, FASTCOPY); reg.SetStr(REGSTR_VAL_UNINSTALLER_COMMANDLINE, buf); reg.CloseKey(); } reg.CloseKey(); } #endif if (IsWinVista() && TIsVirtualizedDirV(w_setup.Buf())) { WCHAR wbuf[MAX_PATH] = L"", old_path[MAX_PATH] = L"", usr_path[MAX_PATH] = L""; WCHAR fastcopy_dir[MAX_PATH], *fastcopy_dirname = NULL; GetFullPathNameW(w_setup.Buf(), MAX_PATH, fastcopy_dir, &fastcopy_dirname); if (cfg.appData) { strcpyV(usr_path, cfg.appData); } else { TSHGetSpecialFolderPathV(NULL, wbuf, CSIDL_APPDATA, FALSE); MakePathV(usr_path, wbuf, fastcopy_dirname); } ConvertVirtualStoreConf(w_setup.Buf(), usr_path, cfg.virtualDir); } // コピーしたアプリケーションを起動 const char *msg = GetLoadStr(is_delay_copy ? IDS_DELAYSETUPCOMPLETE : IDS_SETUPCOMPLETE); int flg = MB_OKCANCEL|MB_ICONINFORMATION; if (IsWin7()) { msg = Fmt("%s%s", msg, GetLoadStr(IDS_COMPLETE_WIN7)); } TLaunchDlg dlg(msg, this); UINT id; if ((id = dlg.Exec()) == IDOK || id == LAUNCH_BUTTON) { char *arg = (id == LAUNCH_BUTTON) ? "/install" : ""; ShellExecute(NULL, "open", setupPath, arg, setupDir, SW_SHOW); } ::PostQuitMessage(0); return TRUE; }
// 真实的向设备进行写入工作 static int _iWriteCard(struct RWRequestS *list) { struct RWRequestS *pReq = list; struct RWRequestS *pOldReq = NULL; int status = 1; int UKey = 0; int mode = 0; char write_flag = 1; if (Instance) { while (pReq) { status = 0; if (!IsSameFile(pReq, pOldReq)) { if (strlen((char*)(g_recIndex[pReq->nID-1].section)) > 0) { status = Instance->iSelectFile(CARDSEAT_RF, g_recIndex[pReq->nID-1].section); UKey = GetFloderKeyID((char*)g_recIndex[pReq->nID-1].section); status |= Instance->iUCardAuthSys(UKey); LOG_INFO("文件名:%s, KeyID:%d, iUCardAuthSys:%d", g_recIndex[pReq->nID-1].section, UKey, status); } if (strlen((char*)(g_recIndex[pReq->nID-1].subSection)) > 0) { status |= Instance->iSelectFile(CARDSEAT_RF, g_recIndex[pReq->nID-1].subSection); UKey = GetFloderKeyID((char*)g_recIndex[pReq->nID-1].subSection); status |= Instance->iUCardAuthSys(UKey); LOG_INFO("文件名:%s, KeyID:%d, iUCardAuthSys:%d", g_recIndex[pReq->nID-1].subSection, UKey, status); } } mode = *(BYTE*)(pReq->value); mode = (mode==0 ? 1 : 0); UKey = GetUpdateKeyID(pReq->nID, mode); status |= Instance->iUCardAuthSys(UKey); if (status) { LOG_ERROR("写验证失败, Update KeyID:%d, iUCardAuthSys:%d", UKey, status); goto done; } switch (pReq->datatype) { case eRecType: status |= Instance->iWriteRec(CARDSEAT_RF, g_recIndex[pReq->nID-1].fileName, pReq->value, pReq->length , write_flag, get_sec_counts(pReq->nID)); LOG_INFO("记录文件名:%s,内容长度:%d, iWriteRec:%d", g_recIndex[pReq->nID-1].fileName, pReq->length, status); break; case eBinType: status |= Instance->iWriteBin(CARDSEAT_RF, g_recIndex[pReq->nID-1].fileName , pReq->value, 0, pReq->length, pReq->offset); LOG_INFO("Bin文件名:%s,内容长度:%d, iWriteBin:%d", g_recIndex[pReq->nID-1].fileName, pReq->length, status); break; case eCycType: status |= Instance->iAppendRec(g_recIndex[pReq->nID-1].fileName, pReq->value, pReq->length); LOG_INFO("循环文件名:%s,内容长度:%d, iAppendRec:%d", g_recIndex[pReq->nID-1].fileName, pReq->length, status); break; case eSureType: status |= Instance->iSignRec(g_recIndex[pReq->nID-1].fileName, pReq->nColumID, mode); LOG_INFO("标记文件名:%s,内容:%d, iSignRec:%d", g_recIndex[pReq->nID-1].fileName, mode, status); break; } pOldReq = pReq; pReq = pReq->Next; } } done: return status; }