From d3c7ade18c29cd71c8eab0630f7a7ffcc7ca390d Mon Sep 17 00:00:00 2001 From: Don Ho Date: Fri, 22 May 2015 21:11:08 +0200 Subject: [PATCH] [NEW] Prevent from launching updater under XP due to the obsolet security layer --- PowerEditor/src/Notepad_plus.rc | 4 +- PowerEditor/src/NppCommands.cpp | 41 ++++++++++++------- .../src/WinControls/AboutDlg/AboutDlg.cpp | 7 +--- PowerEditor/src/winmain.cpp | 6 ++- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 292bf99d7..a118459f3 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -832,7 +832,7 @@ BEGIN POPUP "&?" BEGIN - MENUITEM "Help Contents", IDM_HELP + //MENUITEM "Help Contents", IDM_HELP MENUITEM "Command Line Arguments...", IDM_CMDLINEARGUMENTS MENUITEM SEPARATOR MENUITEM "Notepad++ Home", IDM_HOMESWEETHOME @@ -876,7 +876,7 @@ BEGIN LTEXT "Author :",IDC_STATIC,21,45,31,8 LTEXT "Notepad++ team",IDC_AUTHOR_NAME,78,45,70,8 LTEXT "Home Page :",IDC_STATIC,21,59,47,8 - LTEXT "http://notepad-plus-plus.org/",IDC_HOME_ADDR,78,59,126,8 + LTEXT "https://notepad-plus-plus.org/",IDC_HOME_ADDR,78,59,126,8 GROUPBOX "GNU General Public Licence",IDC_STATIC,19,75,231,131,BS_CENTER DEFPUSHBUTTON "OK",IDOK,106,215,50,14,BS_FLAT,WS_EX_STATICEDGE // IDC_LICENCE_EDIT should be the last line, don't know why diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 0dbd252c1..74bf3a052 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2197,12 +2197,12 @@ void Notepad_plus::command(int id) case IDM_HOMESWEETHOME : { - ::ShellExecute(NULL, TEXT("open"), TEXT("http://notepad-plus-plus.org/"), NULL, NULL, SW_SHOWNORMAL); + ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/"), NULL, NULL, SW_SHOWNORMAL); break; } case IDM_PROJECTPAGE : { - ::ShellExecute(NULL, TEXT("open"), TEXT("http://sourceforge.net/projects/notepad-plus/"), NULL, NULL, SW_SHOWNORMAL); + ::ShellExecute(NULL, TEXT("open"), TEXT("https://github.com/donho/notepad-plus-plus/"), NULL, NULL, SW_SHOWNORMAL); break; } @@ -2233,21 +2233,34 @@ void Notepad_plus::command(int id) case IDM_UPDATE_NPP : case IDM_CONFUPDATERPROXY : { - generic_string updaterDir = (NppParameters::getInstance())->getNppPath(); - PathAppend(updaterDir ,TEXT("updater")); + // wingup doesn't work with the obsolet security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org + winVer ver = NppParameters::getInstance()->getWinVersion(); + if (ver <= WV_XP) + { + long res = ::MessageBox(NULL, TEXT("Notepad++ updater is not compatible with XP due to its obsolet security layer.\rDo you want to go to Notepad++ page to download it?"), TEXT("Notepad++ Updater"), MB_OK); + if (res == IDYES) + { + ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/download/"), NULL, NULL, SW_SHOWNORMAL); + } + } + else + { + generic_string updaterDir = (NppParameters::getInstance())->getNppPath(); + PathAppend(updaterDir, TEXT("updater")); - generic_string updaterFullPath = updaterDir; - PathAppend(updaterFullPath, TEXT("gup.exe")); - - generic_string param = TEXT("-verbose -v"); - param += VERSION_VALUE; + generic_string updaterFullPath = updaterDir; + PathAppend(updaterFullPath, TEXT("gup.exe")); - if (id == IDM_CONFUPDATERPROXY) - param = TEXT("-options"); + generic_string param = TEXT("-verbose -v"); + param += VERSION_VALUE; - Process updater(updaterFullPath.c_str(), param.c_str(), updaterDir.c_str()); - - updater.run(); + if (id == IDM_CONFUPDATERPROXY) + param = TEXT("-options"); + + Process updater(updaterFullPath.c_str(), param.c_str(), updaterDir.c_str()); + + updater.run(); + } break; } diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp index 7ed7a1b05..a2e63a7a1 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp @@ -58,13 +58,10 @@ BOOL CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) _emailLink.init(_hInst, _hSelf); //_emailLink.create(::GetDlgItem(_hSelf, IDC_AUTHOR_NAME), TEXT("mailto:don.h@free.fr")); - _emailLink.create(::GetDlgItem(_hSelf, IDC_AUTHOR_NAME), TEXT("http://notepad-plus-plus.org/contributors")); + _emailLink.create(::GetDlgItem(_hSelf, IDC_AUTHOR_NAME), TEXT("https://notepad-plus-plus.org/contributors")); _pageLink.init(_hInst, _hSelf); - _pageLink.create(::GetDlgItem(_hSelf, IDC_HOME_ADDR), TEXT("http://notepad-plus-plus.org/")); - - //_onLineHelp.init(_hInst, _hSelf); - //_onLineHelp.create(::GetDlgItem(_hSelf, IDC_ONLINEHELP_ADDR), TEXT("http://notepad-plus.sourceforge.net/uk/generalFAQ.php")); + _pageLink.create(::GetDlgItem(_hSelf, IDC_HOME_ADDR), TEXT("https://notepad-plus-plus.org/")); getClientRect(_rc); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 27f52abf9..df610d479 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -411,7 +411,10 @@ DEVOMER*/ doUpdate = false; } - if (TheFirstOne && isUpExist && doUpdate) + // wingup doesn't work with the obsolet security layer (API) under xp since downloadings are secured with SSL on notepad_plus_plus.org + winVer ver = pNppParameters->getWinVersion(); + bool isGtXP = ver > WV_XP; + if (TheFirstOne && isUpExist && doUpdate && isGtXP) { Process updater(updaterFullPath.c_str(), version.c_str(), updaterDir.c_str()); updater.run(); @@ -430,7 +433,6 @@ DEVOMER*/ // Tell UAC that lower integrity processes are allowed to send WM_COPYDATA messages to this process (or window) // This allows opening new files to already opened elevated Notepad++ process via explorer context menu. - winVer ver = pNppParameters->getWinVersion(); if (ver >= WV_VISTA || ver == WV_UNKNOWN) { HMODULE hDll = GetModuleHandle(TEXT("user32.dll"));