mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Remove Windows XP code
This commit is contained in:
parent
da59deea84
commit
c7580b374c
|
@ -3458,22 +3458,6 @@ int open_link(const char *link)
|
||||||
#endif
|
#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
|
struct SECURE_RANDOM_DATA
|
||||||
{
|
{
|
||||||
int initialized;
|
int initialized;
|
||||||
|
|
|
@ -2129,16 +2129,6 @@ PROCESS shell_execute(const char *file);
|
||||||
*/
|
*/
|
||||||
int kill_process(PROCESS process);
|
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
|
Function: generate_password
|
||||||
Generates a null-terminated password of length `2 *
|
Generates a null-terminated password of length `2 *
|
||||||
|
|
|
@ -4501,11 +4501,7 @@ bool CClient::RaceRecord_IsRecording()
|
||||||
void CClient::RequestDDNetInfo()
|
void CClient::RequestDDNetInfo()
|
||||||
{
|
{
|
||||||
char aUrl[256];
|
char aUrl[256];
|
||||||
static bool s_IsWinXP = os_is_winxp_or_lower();
|
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
|
||||||
if(s_IsWinXP)
|
|
||||||
str_copy(aUrl, "http://info2.ddnet.tw/info", sizeof(aUrl));
|
|
||||||
else
|
|
||||||
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
|
|
||||||
|
|
||||||
if(g_Config.m_BrIndicateFinished)
|
if(g_Config.m_BrIndicateFinished)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,6 @@ void CUpdater::Init()
|
||||||
m_pClient = Kernel()->RequestInterface<IClient>();
|
m_pClient = Kernel()->RequestInterface<IClient>();
|
||||||
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
||||||
m_pEngine = Kernel()->RequestInterface<IEngine>();
|
m_pEngine = Kernel()->RequestInterface<IEngine>();
|
||||||
m_IsWinXP = os_is_winxp_or_lower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CUpdater::~CUpdater()
|
CUpdater::~CUpdater()
|
||||||
|
@ -204,13 +203,10 @@ bool CUpdater::ReplaceClient()
|
||||||
char aPath[512];
|
char aPath[512];
|
||||||
|
|
||||||
// Replace running executable by renaming twice...
|
// 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");
|
||||||
m_pStorage->RemoveBinaryFile(CLIENT_EXEC ".old");
|
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
|
||||||
Success &= m_pStorage->RenameBinaryFile(PLAT_CLIENT_EXEC, CLIENT_EXEC ".old");
|
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
|
||||||
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
|
|
||||||
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
|
|
||||||
}
|
|
||||||
#if !defined(CONF_FAMILY_WINDOWS)
|
#if !defined(CONF_FAMILY_WINDOWS)
|
||||||
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof aPath);
|
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof aPath);
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
|
@ -387,23 +383,6 @@ void CUpdater::CommitUpdate()
|
||||||
m_State = NEED_RESTART;
|
m_State = NEED_RESTART;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!m_IsWinXP)
|
m_pClient->Restart();
|
||||||
m_pClient->Restart();
|
|
||||||
else
|
|
||||||
WinXpRestart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
|
@ -40,8 +40,6 @@ class CUpdater : public IUpdater
|
||||||
class IStorage *m_pStorage;
|
class IStorage *m_pStorage;
|
||||||
class IEngine *m_pEngine;
|
class IEngine *m_pEngine;
|
||||||
|
|
||||||
bool m_IsWinXP;
|
|
||||||
|
|
||||||
LOCK m_Lock;
|
LOCK m_Lock;
|
||||||
|
|
||||||
int m_State;
|
int m_State;
|
||||||
|
@ -80,7 +78,6 @@ public:
|
||||||
virtual void InitiateUpdate();
|
virtual void InitiateUpdate();
|
||||||
void Init();
|
void Init();
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
void WinXpRestart();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue