Get full product name for debug info for Windows 11

Make it consistent with earlier version of Windows.

Fix #12855, close #12856
This commit is contained in:
ozone10 2023-01-21 15:55:08 +01:00 committed by Don Ho
parent e003f5b45f
commit 05977f6308
1 changed files with 13 additions and 5 deletions

View File

@ -252,10 +252,18 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{
swprintf(szProductName, bufSize, TEXT("%s"), (NppParameters::getInstance()).getWinVersionStr().c_str());
}
// Override ProductName if it's Windows 11
if (NppDarkMode::isWindows11())
swprintf(szProductName, bufSize, TEXT("%s"), TEXT("Windows 11"));
else if (NppDarkMode::isWindows11())
{
generic_string tmpProductName = szProductName;
constexpr size_t strLen = 10U;
const TCHAR strWin10[strLen + 1U] = TEXT("Windows 10");
const size_t pos = tmpProductName.find(strWin10);
if (pos < (bufSize - strLen - 1U))
{
tmpProductName.replace(pos, strLen, TEXT("Windows 11"));
swprintf(szProductName, bufSize, TEXT("%s"), tmpProductName.c_str());
}
}
if (szCurrentBuildNumber[0] == '\0')
{