summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2016-06-06 17:23:07 +0000
committerKirill Volinsky <mataes2007@gmail.com>2016-06-06 17:23:07 +0000
commitdf1536b00473e18e2911911c5ec323a01c7f070b (patch)
tree57a3c602d7f8ec4d69fc04cb7fe3ce310d5c84f6 /plugins/PluginUpdater/src
parent279001d256a5bc6075284c76d65bf64c420acc7c (diff)
2 radiobuttons changed to 1 checkbutton for platform change
git-svn-id: http://svn.miranda-ng.org/main/trunk@16929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp29
-rw-r--r--plugins/PluginUpdater/src/Options.cpp71
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp6
-rw-r--r--plugins/PluginUpdater/src/resource.h9
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
5 files changed, 86 insertions, 31 deletions
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index f81db0c705..98256b7e56 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -128,12 +128,6 @@ static void ApplyUpdates(void *param)
db_set_ts(NULL, "CList", "TitleText", _T("Miranda NG"));
#endif
- opts.bForceRedownload = false;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
-
- opts.bChangePlatform = false;
- db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
-
db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5);
if (opts.bBackup)
@@ -144,10 +138,31 @@ static void ApplyUpdates(void *param)
PostMessage(hDlg, WM_CLOSE, 0, 0);
if (rc == IDYES)
#if MIRANDA_VER >= 0x0A00
- CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
+ if (opts.bChangePlatform) {
+ TCHAR mirstartpath[MAX_PATH];
+#ifdef _WIN64
+ mir_sntprintf(mirstartpath, _T("%s\\miranda32.exe"), tszMirandaPath);
+#else
+ mir_sntprintf(mirstartpath, _T("%s\\miranda64.exe"), tszMirandaPath);
+#endif
+ CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, (LPARAM)mirstartpath);
+ }
+ else
+ CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
#else
CallFunctionAsync(RestartMe, 0);
#endif
+
+ opts.bForceRedownload = false;
+ db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+
+ opts.bChangePlatform = false;
+ db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
+
+ TCHAR mirandaPath[MAX_PATH];
+ GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath));
+ db_set_ts(NULL, MODNAME, "OldBin", mirandaPath);
+
}
static void ResizeVert(HWND hDlg, int yy)
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index fd5f5f9ae7..6c2b44395d 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -145,11 +145,20 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
}
- #ifdef _WIN64
- CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED);
- #else
- CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED);
- #endif
+ {
+ BOOL bIsWow64 = FALSE;
+#ifdef _WIN64
+ SetDlgItemText(hwndDlg, IDC_CHANGE_PLATFORM, TranslateT("Change platform to x86"));
+#else
+ SetDlgItemText(hwndDlg, IDC_CHANGE_PLATFORM, TranslateT("Change platform to x64"));
+ IsWow64Process(GetCurrentProcess(), &bIsWow64);
+ if (!bIsWow64)
+ ShowWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), SW_HIDE);
+#endif
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
+ }
return TRUE;
case WM_COMMAND:
@@ -175,19 +184,28 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_TRUNK_SYMBOLS:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS);
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM))
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_OPP_BITS);
+ else
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_TRUNK:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS);
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM))
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_OPP_BITS);
+ else
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_STABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS);
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM))
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_OPP_BITS);
+ else
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -213,14 +231,35 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case IDC_X86:
- case IDC_X64:
- CheckDlgButton(hwndDlg, IDC_STABLE, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CUSTOM, BST_UNCHECKED);
- mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), LOWORD(wParam) == IDC_CHANGE_PLATFORM ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ case IDC_CHANGE_PLATFORM:
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_OPP_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_OPP_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_OPP_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ }
+ else {
+ if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
+ mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
+ }
+ }
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index 50d98c1904..b58d7a8e78 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -70,7 +70,11 @@ extern "C" __declspec(dllexport) int Load(void)
InitServices();
#endif
-
+ ptrT oldbin(db_get_tsa(NULL, MODNAME, "OldBin"));
+ if (oldbin) {
+ SafeDeleteFile(oldbin);
+ db_unset(NULL, MODNAME, "OldBin");
+ }
db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0);
DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath);
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h
index e92da5db28..1c36dbb44e 100644
--- a/plugins/PluginUpdater/src/resource.h
+++ b/plugins/PluginUpdater/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\Resource.rc
+// Used by d:\Miranda_orig\plugins\PluginUpdater\res\Resource.rc
//
#define IDD_UPDATE 101
#define IDD_OPT_UPDATENOTIFY 102
@@ -50,8 +50,7 @@
#define IDC_SILENTMODE 1047
#define IDC_NEEDRESTARTLABEL 1048
#define IDC_BACKUP 1049
-#define IDC_X86 1050
-#define IDC_X64 1051
+#define IDC_CHANGE_PLATFORM 1052
#define IDC_MSG_BOXES 40071
#define IDC_ERRORS 40072
#define IDC_INFO_MESSAGES 40073
@@ -69,9 +68,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 117
+#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40075
-#define _APS_NEXT_CONTROL_VALUE 1052
+#define _APS_NEXT_CONTROL_VALUE 1053
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 9efc5b88a1..0a97be2de0 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -117,13 +117,11 @@ extern struct PlugOptions
#define DEFAULT_OPP_BITS 32
#define OLD_FILENAME FILENAME_X64
#define NEW_FILENAME FILENAME_X32
- #define IDC_CHANGE_PLATFORM IDC_X86
#else
#define DEFAULT_BITS 32
#define DEFAULT_OPP_BITS 64
#define OLD_FILENAME FILENAME_X32
#define NEW_FILENAME FILENAME_X64
- #define IDC_CHANGE_PLATFORM IDC_X64
#endif
#define PLUGIN_INFO_URL _T("http://miranda-ng.org/p/%s")