From 46c77425ebf39fe8221a3cc3d026fbd611be9ca4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Jun 2015 20:46:57 +0000 Subject: more secure dll cleaner git-svn-id: http://svn.miranda-ng.org/main/trunk@14239 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/miranda32/src/checker.cpp | 8 ++------ src/miranda32/src/miranda.cpp | 5 ++--- src/miranda32/src/stdafx.h | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/miranda32/src/checker.cpp b/src/miranda32/src/checker.cpp index c6371a20f1..0d2ce78369 100644 --- a/src/miranda32/src/checker.cpp +++ b/src/miranda32/src/checker.cpp @@ -196,14 +196,10 @@ bool TryDeleteFile(const TCHAR *ptszFileName) ///////////////////////////////////////////////////////////////////////////////////////// -bool CheckDlls(const TCHAR *ptszPath) +bool CheckDlls() { - // ptszPath - slash-terminated string - TCHAR tszSearchPath[MAX_PATH]; - _sntprintf(tszSearchPath, _countof(tszSearchPath), _T("*.dll"), ptszPath); - WIN32_FIND_DATA findData; - HANDLE hSearch = FindFirstFile(tszSearchPath, &findData); + HANDLE hSearch = FindFirstFile(_T("*.dll"), &findData); if (hSearch == INVALID_HANDLE_VALUE) // no dlls? why bother return true; diff --git a/src/miranda32/src/miranda.cpp b/src/miranda32/src/miranda.cpp index 0f09be31b2..c5751aca4f 100644 --- a/src/miranda32/src/miranda.cpp +++ b/src/miranda32/src/miranda.cpp @@ -34,14 +34,13 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int) return 4; // if current dir isn't set - *p = 0; + p[1] = 0; SetCurrentDirectory(tszPath); // all dlls must be moved to libs - if (!CheckDlls(tszPath)) + if (!CheckDlls()) return 3; - *p = '\\'; p[1] = 0; _tcsncat(tszPath, _T("libs"), _TRUNCATE); DWORD cbPath = (DWORD)_tcslen(tszPath); diff --git a/src/miranda32/src/stdafx.h b/src/miranda32/src/stdafx.h index 043f60eda2..df679649e0 100644 --- a/src/miranda32/src/stdafx.h +++ b/src/miranda32/src/stdafx.h @@ -26,4 +26,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -bool CheckDlls(const TCHAR *ptszPath); +bool CheckDlls(void); -- cgit v1.2.3