Drop Windows XP support

This commit is contained in:
Benjamin Staneck 2018-03-13 23:40:07 +01:00
parent 997e799138
commit 91651fc98b

View File

@ -16,8 +16,6 @@
#define USE_TASKBAR_API (_WIN32_WINNT >= _WIN32_WINNT_WIN7) #define USE_TASKBAR_API (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
#define XP (_WIN32_WINNT < _WIN32_WINNT_VISTA)
#define MB_TITLE L"Cmder Launcher" #define MB_TITLE L"Cmder Launcher"
#define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder" #define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder"
#define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder" #define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder"
@ -140,7 +138,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location! Restart Cmder as administrator." ? L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location! Restart Cmder as Administrator."
: L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy ConEmu.xml file to ConEmu-%COMPUTERNAME%.xml backup location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
@ -151,12 +149,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location! Restart Cmder as administrator." ? L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
: L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy ConEmu-%COMPUTERNAME%.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
} }
} }
else if (PathFileExists(userCfgPath)) { else if (PathFileExists(userCfgPath)) {
if (PathFileExists(cfgPath)) { if (PathFileExists(cfgPath)) {
@ -164,7 +161,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy ConEmu.xml file to backup location! Restart Cmder as administrator." ? L"Failed to copy ConEmu.xml file to backup location! Restart Cmder as Administrator."
: L"Failed to copy ConEmu.xml file to backup location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy ConEmu.xml file to backup location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
@ -175,7 +172,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as administrator." ? L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
: L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
@ -186,7 +183,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy ConEmu.xml file to user-conemu.xml backup location! Restart Cmder as administrator." ? L"Failed to copy ConEmu.xml file to user-conemu.xml backup location! Restart Cmder as Administrator."
: L"Failed to copy ConEmu.xml file to user-conemu.xml backup location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy ConEmu.xml file to user-conemu.xml backup location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
@ -196,7 +193,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
{ {
MessageBox(NULL, MessageBox(NULL,
(GetLastError() == ERROR_ACCESS_DENIED) (GetLastError() == ERROR_ACCESS_DENIED)
? L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as administrator." ? L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location! Restart Cmder as Administrator."
: L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP); : L"Failed to copy Cmder default ConEmu.xml file to vendored ConEmu.xml location!", MB_TITLE, MB_ICONSTOP);
exit(1); exit(1);
} }
@ -237,7 +234,6 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
} }
} }
SetEnvironmentVariable(L"CMDER_ROOT", exeDir); SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
if (wcscmp(userConfigDirPath, configDirPath) != 0) if (wcscmp(userConfigDirPath, configDirPath) != 0)
{ {
@ -344,11 +340,7 @@ void UnregisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
HKEY root = GetRootKey(opt); HKEY root = GetRootKey(opt);
HKEY cmderKey; HKEY cmderKey;
FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL)); FAIL_ON_ERROR(RegCreateKeyEx(root, keyBaseName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));
#if XP
FAIL_ON_ERROR(SHDeleteKey(cmderKey, NULL));
#else
FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL)); FAIL_ON_ERROR(RegDeleteTree(cmderKey, NULL));
#endif
RegCloseKey(cmderKey); RegCloseKey(cmderKey);
RegCloseKey(root); RegCloseKey(root);
} }
@ -363,7 +355,6 @@ struct cmderOptions
bool registerApp = false; bool registerApp = false;
bool unRegisterApp = false; bool unRegisterApp = false;
bool error = false; bool error = false;
}; };
cmderOptions GetOption() cmderOptions GetOption()