INT __cdecl HashVerifySortCompare( PHASHVERIFYCONTEXT phvctx, PPCHVITEM ppItemA, PPCHVITEM ppItemB ) { PHASHVERIFYITEM pItemA = *(PPHVITEM)ppItemA; PHASHVERIFYITEM pItemB = *(PPHVITEM)ppItemB; switch (phvctx->sort.iColumn) { case HV_COL_FILENAME: return(StrCmpLogical(pItemA->pszDisplayName, pItemB->pszDisplayName)); case HV_COL_SIZE: return(Compare64(&pItemA->filesize.ui64, &pItemB->filesize.ui64)); case HV_COL_STATUS: return((INT8)pItemA->uStatusID - (INT8)pItemB->uStatusID); case HV_COL_EXPECTED: return(StrCmpI(pItemA->pszExpected, pItemB->pszExpected)); case HV_COL_ACTUAL: return(StrCmpI(pItemA->szActual, pItemB->szActual)); } return(0); }
sliTypes Str2UType(LPCSTR s) { if(StrCmpI(s,"URLS_LIST") == 0) return sltUrlList; if(StrCmpI(s,"URLS_TREE") == 0) return sltTree; if(StrCmpI(s,"URLS_GROUP") == 0) return sltGroup; return sltNone; }
bool OpenLangFile(api::File& LangFile, const string& Path,const string& Mask,const string& Language, string &strFileName, uintptr_t &nCodePage, bool StrongLang,string *pstrLangName) { strFileName.clear(); string strFullName, strEngFileName; api::FAR_FIND_DATA FindData; string strLangName; ScanTree ScTree(false, false); ScTree.SetFindPath(Path,Mask); while (ScTree.GetNextName(&FindData, strFullName)) { strFileName = strFullName; if (!LangFile.Open(strFileName, FILE_READ_DATA, FILE_SHARE_READ, nullptr, OPEN_EXISTING)) { strFileName.clear(); } else { GetFileFormat(LangFile, nCodePage, nullptr, false); if (GetLangParam(LangFile,L"Language",&strLangName,nullptr, nCodePage) && !StrCmpI(strLangName, Language)) break; LangFile.Close(); if (StrongLang) { strFileName.clear(); strEngFileName.clear(); break; } if (!StrCmpI(strLangName.data(),L"English")) strEngFileName = strFileName; } } if (!LangFile.Opened()) { if (!strEngFileName.empty()) strFileName = strEngFileName; if (!strFileName.empty()) { LangFile.Open(strFileName, FILE_READ_DATA, FILE_SHARE_READ, nullptr, OPEN_EXISTING); if (pstrLangName) *pstrLangName=L"English"; } } return LangFile.Opened(); }
void KeyBar::ReadRegGroup(const wchar_t *RegGroup, const wchar_t *Language) { if (!RegReaded || StrCmpI(strLanguage,Language) || StrCmpI(strRegGroupName,RegGroup)) { DWORD Index=0; string strRegName; string strValue; string strValueName; strLanguage=Language; strRegGroupName=RegGroup; strRegName=L"KeyBarLabels."; strRegName+=strLanguage; strRegName+=L"."; strRegName+=RegGroup; ClearKeyTitles(true); while (GeneralCfg->EnumValues(strRegName,Index++,strValueName,strValue)) { DWORD Key=KeyNameToKey(strValueName); DWORD Key0=Key&(~KEY_CTRLMASK); DWORD Ctrl=Key&KEY_CTRLMASK; if (Key0 >= KEY_F1 && Key0 <= KEY_F24) { size_t J; static DWORD Area[][2]= { { KBL_MAIN, 0 }, { KBL_SHIFT, KEY_SHIFT }, { KBL_CTRL, KEY_CTRL }, { KBL_ALT, KEY_ALT }, { KBL_CTRLSHIFT, KEY_CTRL|KEY_SHIFT }, { KBL_ALTSHIFT, KEY_ALT|KEY_SHIFT }, { KBL_CTRLALT, KEY_CTRL|KEY_ALT }, { KBL_CTRLALTSHIFT, KEY_CTRL|KEY_ALT|KEY_SHIFT }, }; for (J=0; J < ARRAYSIZE(Area); ++J) if (Area[J][1] == Ctrl) break; if (J <= ARRAYSIZE(Area)) { KeyTitlesCustom[Area[J][0]][Key0-KEY_F1]=xf_wcsdup(strValue.CPtr()); } } } RegReaded=TRUE; } }
TxSkin::brush* TxSkin::parseBrush( LPWSTR str ) { WCHAR fncName[255] = L""; WCHAR params[255] = L""; LPWSTR fnc = findFunction(str, fncName, params); while(fnc) { if(!StrCmpI(fncName, L"solidBrush")) { WCHAR strColor[255] = L""; ::findParam(params, strColor); TxSkin::color brushColor = parseColor(strColor); return new TxSkin::solid_brush(brushColor); } if(!StrCmpI(fncName, L"xGradient")) { WCHAR strColor1[255] = L""; WCHAR strColor2[255] = L""; LPWSTR nextParam = ::findParam(params, strColor1); nextParam = ::findParam(nextParam, strColor2); TxSkin::color brushColor1 = parseColor(strColor1); TxSkin::color brushColor2 = parseColor(strColor2); return new TxSkin::h_gradient_brush(brushColor1, brushColor2); } if(!StrCmpI(fncName, L"yGradient")) { WCHAR strColor1[255] = L""; WCHAR strColor2[255] = L""; LPWSTR nextParam = ::findParam(params, strColor1); nextParam = ::findParam(nextParam, strColor2); TxSkin::color brushColor1 = parseColor(strColor1); TxSkin::color brushColor2 = parseColor(strColor2); return new TxSkin::v_gradient_brush(brushColor1, brushColor2); } if(!StrCmpI(fncName, L"radialGradient")) { WCHAR strColor1[255] = L""; WCHAR strColor2[255] = L""; LPWSTR nextParam = ::findParam(params, strColor1); nextParam = ::findParam(nextParam, strColor2); TxSkin::color brushColor1 = parseColor(strColor1); TxSkin::color brushColor2 = parseColor(strColor2); return new TxSkin::radial_gradient_brush(brushColor1, brushColor2); } fnc = findFunction(fnc, fncName, params); } return NULL; }
/** * FsExecuteFile is called to execute a file on the plugin's file system, * or show its property sheet. */ int __stdcall FsExecuteFile(HWND MainWin, char *RemoteName, char *Verb) { if (!StrCmpI(Verb, "open")) { if (RequestProc(PluginNumber, RT_MsgYesNo, NULL, "Execute file?", NULL, 0)) { return FS_EXEC_YOURSELF; } else if (!StrCmpI(Verb, "properties")) { return FS_EXEC_OK; } } }
/// <summary>Determines whether path has a given extension (case insensitive)</summary> /// <param name="ext">The extention preceeded by a dot</param> /// <returns></returns> /// <exception cref="Logic::ArgumentNullException">Path is null</exception> bool Path::HasExtension(const WCHAR* ext) const { REQUIRED(ext); // Optimization for usage with literals return StrCmpI(PathFindExtension(Buffer.get()), ext) == 0; }
/// Function name : compareAVLTreeNodeWithValues // Description : Compares a node in an AVLTree against a specified set of values /// The number of values must match the number of tree sort keys // // CONST AVL_TREE* pTree : [in] AVLTree containing the nodes // CONST LPARAM pNodeData : [in] Data of the node to compare // ... ... : [in] Value to compare node against // // Return Value : CR_LESSER : The value is less than the node // CR_EQUAL : The value is equal to the node // CR_GREATER : The value is more than the node // COMPARISON_RESULT compareAVLTreeNodeWithValues(CONST AVL_TREE* pTree, CONST LPARAM pNodeData, LPARAM xValue1, LPARAM xValue2, LPARAM xValue3) { COMPARISON_RESULT eResult; // Comparison result CONST AVL_TREE_KEY* pCurrentKey; // Convenience pointer LPARAM xNodeProperty, // Extracted property of the input node xSearchValues[3] = {xValue1, xValue2, xValue3}; // Input values // Prepare eResult = CR_EQUAL; /// Iterate through sort keys for (UINT iKey = 0; (eResult == CR_EQUAL) AND (iKey < pTree->iKeyCount); iKey++) { // Prepare pCurrentKey = pTree->pSortKeys[iKey]; // Extract appropriate property value from node xNodeProperty = extractObjectProperty(pTree, pNodeData, pCurrentKey->eSorting); /// [COMPARISON] Compare property against current search value switch (pCurrentKey->eType) { case AP_STRING_CASE: eResult = (COMPARISON_RESULT)StrCmp((TCHAR*)xNodeProperty, (TCHAR*)xSearchValues[iKey]); break; case AP_STRING: eResult = (COMPARISON_RESULT)StrCmpI((TCHAR*)xNodeProperty, (TCHAR*)xSearchValues[iKey]); break; case AP_INTEGER: eResult = (COMPARISON_RESULT)utilCompareIntegers((INT)xSearchValues[iKey], (INT)xNodeProperty); break; } /// [DIRECTION] Flip the result for descending ordering if (pCurrentKey->eDirection == AO_DESCENDING) eResult = (COMPARISON_RESULT)(eResult * -1); } // Return result return eResult; }
BOOL Explorerplusplus::HandleShellMenuItem(LPITEMIDLIST pidlParent, const std::list<LPITEMIDLIST> &pidlItemList,DWORD_PTR dwData,TCHAR *szCmd) { FileContextMenuInfo_t *pfcmi = reinterpret_cast<FileContextMenuInfo_t *>(dwData); if(StrCmpI(szCmd,_T("open")) == 0) { /* If ppidl is NULL, open the item specified by pidlParent in the current listview. If ppidl is not NULL, open each of the items specified in ppidl. */ if(pidlItemList.size() == 0) { OpenItem(pidlParent,FALSE,FALSE); } else { LPITEMIDLIST pidlComplete = NULL; for each(auto pidl in pidlItemList) { pidlComplete = ILCombine(pidlParent,pidl); OpenItem(pidlComplete,FALSE,FALSE); CoTaskMemFree(pidlComplete); } } m_bTreeViewOpenInNewTab = TRUE; return TRUE; }
/* $ 01.09.2000 SVS + Новый метод, для получения параметров для .Options .Options <KeyName>=<Value> */ int GetOptionsParam(api::File& SrcFile,const wchar_t *KeyName,string &strValue, UINT nCodePage) { int Length=StrLength(L".Options"); auto CurFilePos = SrcFile.GetPointer(); string ReadStr; GetFileString GetStr(SrcFile, nCodePage); while (GetStr.GetString(ReadStr)) { if (!StrCmpNI(ReadStr.data(), L".Options", Length)) { string strFullParamName = ReadStr.substr(Length); RemoveExternalSpaces(strFullParamName); size_t pos = strFullParamName.rfind(L'='); if (pos != string::npos) { strValue = strFullParamName; strValue.erase(0, pos+1); RemoveExternalSpaces(strValue); strFullParamName.resize(pos); RemoveExternalSpaces(strFullParamName); if (!StrCmpI(strFullParamName.data(),KeyName)) { SrcFile.SetPointer(CurFilePos, nullptr, FILE_BEGIN); return TRUE; } } } } SrcFile.SetPointer(CurFilePos, nullptr, FILE_BEGIN); return FALSE; }
/*$ 11.05.2001 OT Теперь можно искать файл не только по полному имени, но и отдельно - путь, отдельно имя */ int Manager::FindFrameByFile(int ModalType,const wchar_t *FileName, const wchar_t *Dir) { string strBufFileName; string strFullFileName = FileName; if (Dir) { strBufFileName = Dir; AddEndSlash(strBufFileName); strBufFileName += FileName; strFullFileName = strBufFileName; } for (int I=0; I<FrameCount; I++) { string strType, strName; // Mantis#0000469 - получать Name будем только при совпадении ModalType if (FrameList[I]->GetType()==ModalType) { FrameList[I]->GetTypeAndName(strType, strName); if (!StrCmpI(strName, strFullFileName)) return(I); } } return -1; }
//============================================================================ void plNCAgeJoiner::Start () { s_instance = this; plNetClientMgr * nc = plNetClientMgr::GetInstance(); nc->SetFlagsBit(plNetClientMgr::kPlayingGame, false); nc->fServerTimeOffset = 0; // reset since we're connecting to a new server nc->fRequiredNumInitialSDLStates = 0; nc->fNumInitialSDLStates = 0; nc->SetFlagsBit(plNetClientApp::kNeedInitialAgeStateCount); nc->SetFlagsBit(plNetClientApp::kLoadingInitialAgeState); // if we're linking to startup then set the OfflineAge flag // so we by-pass the game server if (StrLen(age.ageDatasetName) == 0 || StrCmpI(age.ageDatasetName, "StartUp") == 0) { nc->SetFlagsBit(plNetClientApp::kLinkingToOfflineAge); // no need to update if we're not using a GameSrv plgDispatch::MsgSend(new plResPatcherMsg()); } else { nc->SetFlagsBit(plNetClientApp::kLinkingToOfflineAge, false); // we only need to update the age if we're using a GameSrv plAgeLoader* al = plAgeLoader::GetInstance(); al->UpdateAge(age.ageDatasetName); } }
bool MatcProcessImageName(DWORD dwProcId,const TCHAR* tcImageName, bool bTestRunning=false) { if(NULL == tcImageName) return false; HANDLE hProc = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcId ); bool bHasName= false; bool bResult = false; TCHAR tcModuleName[MAX_PATH]; if (NULL != hProc ) { if(bTestRunning) { DWORD ExitCode = 0; if(GetExitCodeProcess(hProc, &ExitCode)) { if (STILL_ACTIVE != ExitCode) return false; } else { if(WAIT_TIMEOUT != WaitForSingleObject(hProc, 0)) return false; } } HMODULE hMod; DWORD nRetCountMod = 0; if(EnumProcessModules(hProc, &hMod, sizeof(hMod), &nRetCountMod)){ bHasName = (0 != GetModuleBaseName( hProc, hMod, tcModuleName, sizeof(tcModuleName)/sizeof(TCHAR) ) ); } else { bHasName = (0 != GetProcessImageFileName(hProc, tcModuleName, sizeof(tcModuleName)/sizeof(TCHAR)) ) ; } } if(bHasName) { const TCHAR *pExeName = _tcsrchr(tcModuleName, TEXT('\\')); pExeName = (pExeName) ? ++pExeName : tcModuleName; bResult = (0 == StrCmpI(pExeName,tcImageName)); } CloseHandle(hProc); return bResult; }
/// Configuration : TESTING /// Function name : checkCommandTranslation // Description : Check whether the translation of a command matches a specified string // // CONST LIST* pCommandList : [in] List of translated COMMAND objects found in a ScriptFile // CONST UINT iIndex : [in] Index of the COMMAND to verify // CONST TCHAR* szTranslation : [in] String to verify the COMMAND translation against // // Return Value : TRUE if successfully verified, FALSE otherwise // BOOL checkCommandTranslation(CONST LIST* pCommandList, CONST UINT iIndex, CONST TCHAR* szTranslation) { LIST_ITEM* pListItem; // ListItem wrapper COMMAND* pCommand; // Translated COMMAND to check BOOL bResult; // Verification result // Prepare bResult = FALSE; /// Lookup COMMAND if (findListItemByIndex(pCommandList, iIndex, pListItem)) { // Extract COMMAND pCommand = (COMMAND*)pListItem->oData; /// Check translation bResult = (StrCmpI(szTranslation, pCommand->szBuffer) == 0); // [FAILED] Print out desired and actual translation if (!bResult) CONSOLE("ERROR: Command '%s' incorrectly translated as '%s'", szTranslation, pCommand->szBuffer); } // [ERROR] Command not translated else CONSOLE("ERROR: Command '%s' (index %u) was not present", szTranslation, iIndex); /// Return result return bResult; }
void FilePanels::GoToFile(const wchar_t *FileName) { if (FirstSlash(FileName)) { string ADir,PDir; Panel *PassivePanel = GetAnotherPanel(ActivePanel); int PassiveMode = PassivePanel->GetMode(); if (PassiveMode == NORMAL_PANEL) { PassivePanel->GetCurDir(PDir); AddEndSlash(PDir); } int ActiveMode = ActivePanel->GetMode(); if (ActiveMode==NORMAL_PANEL) { ActivePanel->GetCurDir(ADir); AddEndSlash(ADir); } string strNameFile = PointToName(FileName); string strNameDir = FileName; CutToSlash(strNameDir); /* $ 10.04.2001 IS Не делаем SetCurDir, если нужный путь уже есть на открытых панелях, тем самым добиваемся того, что выделение с элементов панелей не сбрасывается. */ BOOL AExist=(ActiveMode==NORMAL_PANEL) && !StrCmpI(ADir,strNameDir); BOOL PExist=(PassiveMode==NORMAL_PANEL) && !StrCmpI(PDir,strNameDir); // если нужный путь есть на пассивной панели if (!AExist && PExist) ProcessKey(KEY_TAB); if (!AExist && !PExist) ActivePanel->SetCurDir(strNameDir,TRUE); ActivePanel->GoToFile(strNameFile); // всегда обновим заголовок панели, чтобы дать обратную связь, что // Ctrl-F10 обработан ActivePanel->SetTitle(); } }
void NamesList::SetCurDir(const wchar_t *Dir) { if (StrCmpI(strCurrentDir,Dir) || !TestCurrentDirectory(Dir)) { strCurrentDir = Dir; PrepareDiskPath(strCurrentDir); } }
bool TestCurrentDirectory(const wchar_t *TestDir) { string strCurDir; if (apiGetCurrentDirectory(strCurDir) && !StrCmpI(strCurDir,TestDir)) return true; return false; }
/// <summary>Check whether listBox contains a specified string</summary> /// <param name="str">The string.</param> /// <param name="matchCase">match case.</param> /// <returns></returns> bool FindComboBox::Contains(const wstring& str, bool matchCase) const { auto list = GetAllStrings(); // Query strings in listBox return any_of(list.begin(), list.end(), [&str,matchCase](const wstring& s) { return matchCase ? s == str : StrCmpI(s.c_str(), str.c_str()) == 0; }); }
static void load_configuration(BOOL *use_active_monitoring, BOOL *is_move_offscreen_forbidden) { HKEY rkey; LONG status; DWORD buffer_size = 6; TCHAR buffer[6]; DWORD type; status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Ulteo\\OVD\\seamlessrdpshell", 0, KEY_READ, &rkey); if (status != ERROR_SUCCESS) return; status = RegQueryValueEx(rkey, "use_active_monitoring", NULL, &type, (BYTE*)buffer, &buffer_size); *use_active_monitoring = (status == ERROR_SUCCESS && type == REG_SZ && StrCmpI(buffer, "true") == 0); status = RegQueryValueEx(rkey, "move_offscreen_forbidden", NULL, &type, (BYTE*)buffer, &buffer_size); *is_move_offscreen_forbidden = (status == ERROR_SUCCESS && type == REG_SZ && StrCmpI(buffer, "true") == 0); RegCloseKey (rkey); }
int CContactDlg::phoneTypeToInt( LPCWSTR val ) { for(int i=0; g_phoneTypes[i]; i++) { if(!StrCmpI(val, g_phoneTypes[i])) { return i; } } return 0; }
void CreateLnkOnDesktop(const LPWSTR connTitle) { IShellLink *SLink; IPersistFile *PF; HRESULT HRes; TCHAR desktop_path[MAX_PATH] = TEXT(""); TCHAR pszFullLnkPath[MAX_PATH]; CoInitialize(NULL); ITEMIDLIST* pidl1 = NULL; SHGetFolderLocation(NULL, CSIDL_CONNECTIONS, NULL, 0, &pidl1); IShellFolder *desktop, *ncfolder; SHGetDesktopFolder(&desktop); desktop->BindToObject(pidl1, NULL, IID_IShellFolder, (void**)&ncfolder); IEnumIDList *items; ncfolder->EnumObjects(NULL, SHCONTF_NONFOLDERS, &items); ITEMIDLIST* pidl2 = NULL; while (S_OK == items->Next(1, &pidl2, NULL)) { STRRET sr = {STRRET_WSTR}; ncfolder->GetDisplayNameOf(pidl2, SHGDN_NORMAL, &sr); TCHAR buf[MAX_PATH] = TEXT(""); StrRetToBuf(&sr, pidl2, buf, MAX_PATH); if (0 == StrCmpI(buf, connTitle)) { ITEMIDLIST* pidl3 = ILCombine(pidl1, pidl2); HRESULT HRes = CoCreateInstance(CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, IID_IShellLink, ( LPVOID*)&SLink); SLink->SetIDList(pidl3); SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktop_path); StringCbPrintf(pszFullLnkPath, MAX_PATH * sizeof(TCHAR), TEXT("%s\\%s.lnk"), desktop_path, connTitle); HRes = SLink->QueryInterface(IID_IPersistFile, (LPVOID*)&PF); HRes = PF->Save((LPCOLESTR)pszFullLnkPath, TRUE); PF->Release(); SLink->Release(); ILFree(pidl3); ILFree(pidl2); break; } ILFree(pidl2); pidl2 = NULL; } ncfolder->Release(); desktop->Release(); ILFree(pidl1); CoUninitialize(); }
STDMETHODIMP_(int) GetKeywordIndex(LPCTSTR szKey, LPCTSTR* szKeys, UINT nKeys) { UINT i; for (i = 0; i < nKeys; ++i) { if (StrCmpI(szKey, szKeys[i]) == 0) { return i; } } return -1; }
/* Check for shared folders network profider */ BOOL vbox_network_share() { TCHAR szProviderName[MAX_PATH] = _T(""); DWORD lpBufferSize = MAX_PATH; if (WNetGetProviderName(WNNC_NET_RDR2SAMPLE, szProviderName, &lpBufferSize) == NO_ERROR) { if (StrCmpI(szProviderName, _T("VirtualBox Shared Folders")) == 0) return TRUE; else return FALSE; } return FALSE; }
BOOL CSearchDialog::HandleShellMenuItem(LPITEMIDLIST pidlParent, const std::list<LPITEMIDLIST> &pidlItemList,DWORD_PTR dwData,TCHAR *szCmd) { if(StrCmpI(szCmd,_T("open")) == 0) { for each(auto pidlItem in pidlItemList) { LPITEMIDLIST pidlComplete = ILCombine(pidlParent,pidlItem); m_pexpp->OpenItem(pidlComplete,FALSE,FALSE); CoTaskMemFree(pidlComplete); } return TRUE; }
ConsoleTitle::~ConsoleTitle() { CriticalSectionLock Lock(TitleCS); const FARString &strTitleAddons = GetFarTitleAddons(); size_t OldLen = strOldTitle.GetLength(); size_t AddonsLen = strTitleAddons.GetLength(); if (AddonsLen <= OldLen) { if (!StrCmpI(strOldTitle.CPtr()+OldLen-AddonsLen, strTitleAddons)) strOldTitle.SetLength(OldLen-AddonsLen); } ConsoleTitle::SetFarTitle(strOldTitle, true); }
ConsoleTitle::~ConsoleTitle() { SCOPED_ACTION(CriticalSectionLock)(TitleCS); const string &strTitleAddons = GetFarTitleAddons(); size_t OldLen = strOldTitle.size(); size_t AddonsLen = strTitleAddons.size(); if (AddonsLen <= OldLen) { if (!StrCmpI(strOldTitle.data()+OldLen-AddonsLen, strTitleAddons.data())) strOldTitle.resize(OldLen-AddonsLen); } SetFarTitle(strOldTitle); }
BOOL IsCabFile(LPWSTR pszFileName) { DWORD dwLen = lstrlenW(g_szDotCAB); ASSERT(pszFileName); DWORD dwFileLen = lstrlenW(pszFileName); if(dwFileLen < dwLen) return FALSE; if(StrCmpI(pszFileName+dwFileLen-dwLen, g_szDotCAB)) return FALSE; else return TRUE; // yes file name has .cab extension. }
BOOL WINAPI InstallFile( LPCTSTR lpszSource, LPTSTR lpszDest, LPTSTR lpszDestAppend ) { static const TCHAR szShellExt[] = TEXT("ShellExt"); static const TCHAR szDestFile[] = TEXT("\\") TEXT(HASHCHECK_FILENAME_STR); SSStaticCpy(lpszDestAppend, szShellExt); lpszDestAppend += countof(szShellExt) - 1; // Create directory if necessary if (! PathFileExists(lpszDest)) CreateDirectory(lpszDest, NULL); SSStaticCpy(lpszDestAppend, szDestFile); lpszDestAppend += countof(szDestFile) - 1; // No need to copy if the source and destination are the same if (StrCmpI(lpszSource, lpszDest) == 0) return(TRUE); // If the destination file does not already exist, just copy if (! PathFileExists(lpszDest)) return(CopyFile(lpszSource, lpszDest, FALSE)); // If destination file exists and cannot be overwritten TCHAR szTemp[MAX_PATH + 0x20]; SIZE_T cbDest = BYTEDIFF(lpszDestAppend, lpszDest); LPTSTR lpszTempAppend = (LPTSTR)BYTEADD(szTemp, cbDest); StringCbCopy(szTemp, sizeof(szTemp), lpszDest); *lpszTempAppend++ = TEXT('.'); SSCpy2Ch(lpszTempAppend, 0, 0); for (TCHAR ch = TEXT('0'); ch <= TEXT('9'); ++ch) { if (CopyFile(lpszSource, lpszDest, FALSE)) return(TRUE); *lpszTempAppend = ch; if (MoveFileEx(lpszDest, szTemp, MOVEFILE_REPLACE_EXISTING)) MoveFileEx(szTemp, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); } return(FALSE); }
/* Character string comparison */ static int KlezTypeCheckSub( const char* name, int mask ) { VIRUSKEYTBL* tbl = viruskeytbl; while( tbl->keyname ) { if( tbl->type & mask ) { if( !tbl->length ) { if( StrCmpI( name, tbl->keyname ) == 0 ) return 1; } else { if( StrCmpNI( name, tbl->keyname, tbl->length ) == 0 ) return 1; } } tbl++; } return 0; }
STREAM_DATA* CPluginStream::findData(LPCTSTR id) { int nodeIndex = -1; if(m_nodes.GetCount()) { nodeIndex = m_nodes[m_nodes.GetCount() - 1]; } for(int i=nodeIndex + 1; i < m_data.GetCount(); i++) { if(m_data[i].type == SDT_ENDNODE && *((LPDWORD) m_data[i].lpData) == nodeIndex) { break; } if(!StrCmpI(m_data[i].id, id)) { return &m_data[i]; } } return NULL; }