summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/Common.h2
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp2
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp2
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp12
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp2
-rw-r--r--plugins/PluginUpdater/src/unzipfile.cpp14
6 files changed, 16 insertions, 18 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index 846d8b01ba..4b3a8c570e 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -190,7 +190,7 @@ INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name);
-bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath);
+bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch);
void strdel(TCHAR *parBuffer, int len);
///////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 839093393c..67f6afe957 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -102,7 +102,7 @@ static void ApplyDownloads(void *param)
BackupFile(tszSrcPath, tszBackFile);
}
- if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack))
+ if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack,false))
SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update
}
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index b873750d61..3682af171e 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -110,7 +110,7 @@ static void ApplyUpdates(void *param)
BackupFile(tszSrcPath, tszBackFile);
}
- if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack))
+ if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack,true))
SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update
}
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index b6ad025454..15b28ab0c6 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -115,7 +115,7 @@ static void MakePopupAction(POPUPACTION &pa, int id)
void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int ActType)
{
- if ( !ServiceExists(MS_POPUP_ADDPOPUP) || !db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) ) {
+ if ( !ServiceExists(MS_POPUP_ADDPOPUPT) || !db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) ) {
char setting[100];
mir_snprintf(setting, SIZEOF(setting), "Popups%dM", Number);
if (db_get_b(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
@@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
bool PrepareEscalation()
{
// First try to create a file near Miranda32.exe
- wchar_t szPath[MAX_PATH];
+ TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, SIZEOF(szPath));
TCHAR *ext = _tcsrchr(szPath, '.');
if (ext != NULL)
@@ -234,11 +234,11 @@ bool PrepareEscalation()
return false;
}
- wchar_t cmdLine[100], *p;
+ TCHAR cmdLine[100], *p;
GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
- if ((p = wcsrchr(szPath, '\\')) != 0)
- wcscpy(p+1, L"pu_stub.exe");
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), L"%d", GetCurrentProcessId());
+ if ((p = _tcsrchr(szPath, '\\')) != 0)
+ _tcscpy(p+1, _T("pu_stub.exe"));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("%d"), GetCurrentProcessId());
// Launch a stub
SHELLEXECUTEINFO sei = { sizeof(sei) };
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 3284c7e844..5082d7abe1 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -226,7 +226,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT& baseUrl, SERVLIST& arHashes)
return false;
}
- unzip(pFileUrl.tszDiskPath, tszTempPath, NULL);
+ unzip(pFileUrl.tszDiskPath, tszTempPath, NULL,true);
DeleteFile(pFileUrl.tszDiskPath);
TCHAR tszTmpIni[MAX_PATH] = {0};
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp
index 6517299d04..5ae9989053 100644
--- a/plugins/PluginUpdater/src/unzipfile.cpp
+++ b/plugins/PluginUpdater/src/unzipfile.cpp
@@ -45,21 +45,19 @@ void BackupFile(TCHAR *ptszSrcFileName, TCHAR *ptszBackFileName)
SafeMoveFile(ptszSrcFileName, ptszBackFileName);
}
-bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath)
+bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bool ch)
{
- int err = UNZ_OK;
unz_file_info64 file_info;
- char filename[MAX_PATH];
- char buf[8192];
+ char filename[MAX_PATH], buf[8192];
- err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, sizeof(buf), NULL, 0);
+ int err = unzGetCurrentFileInfo64(uf, &file_info, filename, sizeof(filename), buf, sizeof(buf), NULL, 0);
if (err != UNZ_OK)
return false;
for (char *p = strchr(filename, '/'); p; p = strchr(p+1, '/'))
*p = '\\';
- if (!db_get_b(NULL, MODNAME "Files", StrToLower(ptrA(mir_strdup(filename))), true))
+ if (ch && !db_get_b(NULL, MODNAME "Files", StrToLower(ptrA(mir_strdup(filename))), 1))
return true;
TCHAR tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
@@ -123,7 +121,7 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath)
return true;
}
-bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath)
+bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch)
{
bool bResult = true;
@@ -133,7 +131,7 @@ bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath)
unzFile uf = unzOpen2_64(ptszZipFile, &ffunc);
if (uf) {
do {
- if ( !extractCurrentFile(uf, ptszDestPath, ptszBackPath))
+ if ( !extractCurrentFile(uf, ptszDestPath, ptszBackPath,ch))
bResult = false;
}
while (unzGoToNextFile(uf) == UNZ_OK);