1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2021 - TortoiseGit
4 // Copyright (C) 2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "PathUtils.h"
23 #include "StringUtils.h"
25 static bool InitializeIsWin11OrLater()
27 PWSTR pszPath
= nullptr;
28 if (SHGetKnownFolderPath(FOLDERID_System
, KF_FLAG_CREATE
, nullptr, &pszPath
) != S_OK
)
30 CString sysPath
{ pszPath
};
31 CoTaskMemFree(pszPath
);
32 auto explorerVersion
= CPathUtils::GetVersionFromFile(sysPath
+ L
"\\shell32.dll");
33 std::vector
<int> versions
;
34 stringtok(versions
, explorerVersion
, true, L
".");
35 return versions
.size() > 3 && versions
[2] >= 22000;
40 m_bIsWindows11OrLater
= InitializeIsWin11OrLater();
47 const SysInfo
& SysInfo::Instance()
49 static SysInfo instance
;