Remove Windows XP code

This commit is contained in:
Jupeyy 2021-08-23 12:05:01 +02:00
parent da59deea84
commit c7580b374c
5 changed files with 6 additions and 60 deletions

View file

@ -3458,22 +3458,6 @@ int open_link(const char *link)
#endif
}
int os_is_winxp_or_lower()
{
#if defined(CONF_FAMILY_WINDOWS)
static const DWORD WINXP_MAJOR = 5;
static const DWORD WINXP_MINOR = 1;
OSVERSIONINFO ver;
mem_zero(&ver, sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&ver);
return ver.dwMajorVersion < WINXP_MAJOR ||
(ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
#else
return 0;
#endif
}
struct SECURE_RANDOM_DATA
{
int initialized;

View file

@ -2129,16 +2129,6 @@ PROCESS shell_execute(const char *file);
*/
int kill_process(PROCESS process);
/*
Function: os_is_winxp_or_lower
Checks whether the program runs on Windows XP or lower.
Returns:
1 - Windows XP or lower.
0 - Higher Windows version, Linux, macOS, etc.
*/
int os_is_winxp_or_lower();
/*
Function: generate_password
Generates a null-terminated password of length `2 *

View file

@ -4501,11 +4501,7 @@ bool CClient::RaceRecord_IsRecording()
void CClient::RequestDDNetInfo()
{
char aUrl[256];
static bool s_IsWinXP = os_is_winxp_or_lower();
if(s_IsWinXP)
str_copy(aUrl, "http://info2.ddnet.tw/info", sizeof(aUrl));
else
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
if(g_Config.m_BrIndicateFinished)
{

View file

@ -102,7 +102,6 @@ void CUpdater::Init()
m_pClient = Kernel()->RequestInterface<IClient>();
m_pStorage = Kernel()->RequestInterface<IStorage>();
m_pEngine = Kernel()->RequestInterface<IEngine>();
m_IsWinXP = os_is_winxp_or_lower();
}
CUpdater::~CUpdater()
@ -204,13 +203,10 @@ bool CUpdater::ReplaceClient()
char aPath[512];
// Replace running executable by renaming twice...
if(!m_IsWinXP)
{
m_pStorage->RemoveBinaryFile(CLIENT_EXEC ".old");
Success &= m_pStorage->RenameBinaryFile(PLAT_CLIENT_EXEC, CLIENT_EXEC ".old");
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
}
m_pStorage->RemoveBinaryFile(CLIENT_EXEC ".old");
Success &= m_pStorage->RenameBinaryFile(PLAT_CLIENT_EXEC, CLIENT_EXEC ".old");
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
#if !defined(CONF_FAMILY_WINDOWS)
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof aPath);
char aBuf[512];
@ -387,23 +383,6 @@ void CUpdater::CommitUpdate()
m_State = NEED_RESTART;
else
{
if(!m_IsWinXP)
m_pClient->Restart();
else
WinXpRestart();
m_pClient->Restart();
}
}
void CUpdater::WinXpRestart()
{
char aBuf[512];
IOHANDLE bhFile = io_open(m_pStorage->GetBinaryPath("du.bat", aBuf, sizeof aBuf), IOFLAG_WRITE);
if(!bhFile)
return;
char bBuf[512];
str_format(bBuf, sizeof(bBuf), ":_R\r\ndel \"" PLAT_CLIENT_EXEC "\"\r\nif exist \"" PLAT_CLIENT_EXEC "\" goto _R\r\n:_T\r\nmove /y \"update\\%s\" \"" PLAT_CLIENT_EXEC "\"\r\nif not exist \"" PLAT_CLIENT_EXEC "\" goto _T\r\nstart " PLAT_CLIENT_EXEC "\r\ndel \"du.bat\"\r\n", m_aClientExecTmp);
io_write(bhFile, bBuf, str_length(bBuf));
io_close(bhFile);
shell_execute(aBuf);
m_pClient->Quit();
}

View file

@ -40,8 +40,6 @@ class CUpdater : public IUpdater
class IStorage *m_pStorage;
class IEngine *m_pEngine;
bool m_IsWinXP;
LOCK m_Lock;
int m_State;
@ -80,7 +78,6 @@ public:
virtual void InitiateUpdate();
void Init();
virtual void Update();
void WinXpRestart();
};
#endif