From 2d26921c87c663de4725963d7da87c6eacd1e3d3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Jun 2015 22:06:13 +0000 Subject: we delete only needed dlls, not everything but msvcr*.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@14240 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/miranda32/src/checker.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/miranda32/src/checker.cpp b/src/miranda32/src/checker.cpp index 0d2ce78369..0ba46a5c7f 100644 --- a/src/miranda32/src/checker.cpp +++ b/src/miranda32/src/checker.cpp @@ -196,34 +196,31 @@ bool TryDeleteFile(const TCHAR *ptszFileName) ///////////////////////////////////////////////////////////////////////////////////////// +static TCHAR *arDlls[] = { _T("mir_app.dll"), _T("mir_core.dll"), _T("pcre16.dll"), _T("zlib.dll"), _T("libtox.dll") }; + bool CheckDlls() { - WIN32_FIND_DATA findData; - HANDLE hSearch = FindFirstFile(_T("*.dll"), &findData); - if (hSearch == INVALID_HANDLE_VALUE) // no dlls? why bother - return true; - bool bInit = false; - do { - // skip Visual Studio runtime if present - if (!_tcsnicmp(findData.cFileName, _T("msvc"), 4)) + + for (int i = 0; i < _countof(arDlls); i++) { + // if dll is missing - skip it + if (_taccess(arDlls[i], 0) != 0) continue; // there's smth to delete. init UAC if (!bInit) { // failed? then we need UAC if (!PrepareEscalation()) { -LBL_Error: MessageBox(NULL, _T("Miranda failed to delete the obsolete file. Do it manually"), findData.cFileName, MB_ICONEXCLAMATION | MB_OK); +LBL_Error: MessageBox(NULL, _T("Miranda failed to delete the obsolete file. Do it manually"), arDlls[i], MB_ICONEXCLAMATION | MB_OK); return false; } bInit = true; } - if (!TryDeleteFile(findData.cFileName)) + if (!TryDeleteFile(arDlls[i])) goto LBL_Error; } - while (FindNextFile(hSearch, &findData)); return true; } -- cgit v1.2.3