From 3dfe526019a66be4cac540affbf17dc833bf51b6 Mon Sep 17 00:00:00 2001 From: SinghRajenM Date: Fri, 10 Feb 2017 17:19:04 +0530 Subject: [PATCH] Show OS platform (32/64 bit) in Debug Info. Closes #2895 --- .../MISC/PluginsManager/Notepad_plus_msgs.h | 1 + PowerEditor/src/Parameters.cpp | 36 ++++++++++++++++++- PowerEditor/src/Parameters.h | 3 ++ .../src/WinControls/AboutDlg/AboutDlg.cpp | 3 ++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 739f148a2..bcbed23ac 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -45,6 +45,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ L_EXTERNAL}; enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10}; +enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 }; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index c64999408..c6fd332ba 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -742,7 +742,7 @@ generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) } -winVer getWindowsVersion() +winVer NppParameters::getWindowsVersion() { OSVERSIONINFOEX osvi; SYSTEM_INFO si; @@ -766,6 +766,24 @@ winVer getWindowsVersion() else GetSystemInfo(&si); + switch (si.wProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_IA64: + _platForm = PF_IA64; + break; + + case PROCESSOR_ARCHITECTURE_AMD64: + _platForm = PF_X64; + break; + + case PROCESSOR_ARCHITECTURE_INTEL: + _platForm = PF_X86; + break; + + default: + _platForm = PF_UNKNOWN; + } + switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: @@ -5887,6 +5905,22 @@ generic_string NppParameters:: getWinVersionStr() const } } +generic_string NppParameters::getWinVerBitStr() const +{ + switch (_platForm) + { + case PF_X86: + return TEXT("32-bit"); + + case PF_X64: + case PF_IA64: + return TEXT("64-bit"); + + default: + return TEXT("Unknown-bit"); + } +} + void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers) { TiXmlNode *lexersRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles")); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index b76f1b87b..cdc18e1a5 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1476,6 +1476,7 @@ public: bool reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu); winVer getWinVersion() const {return _winVersion;}; generic_string getWinVersionStr() const; + generic_string getWinVerBitStr() const; FindHistory & getFindHistory() {return _findHistory;}; bool _isFindReplacing = false; // an on the fly variable for find/replace functions void safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection); @@ -1663,6 +1664,7 @@ private: bool _asNotepadStyle = false; winVer _winVersion; + Platform _platForm; NativeLangSpeaker *_pNativeLangSpeaker = nullptr; @@ -1734,4 +1736,5 @@ private: void initScintillaKeys(); //these functions have to be called first before any modifications are loaded int getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, generic_string menuEntryName, generic_string menuItemName); // return -1 if not found int getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, generic_string pluginName, generic_string pluginCmdName); // return -1 if not found + winVer getWindowsVersion(); }; diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp index 33a3e53d6..8d61477f8 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp @@ -161,6 +161,9 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM / // OS version _debugInfoStr += TEXT("OS : "); _debugInfoStr += (NppParameters::getInstance())->getWinVersionStr(); + _debugInfoStr += TEXT(" ("); + _debugInfoStr += (NppParameters::getInstance())->getWinVerBitStr(); + _debugInfoStr += TEXT(")"); _debugInfoStr += TEXT("\r\n"); // Plugins