From c0d19c48fb0bc3222ca34fdf24e53159eae72aeb Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 12 Mar 2013 22:31:40 +0000 Subject: [PATCH] ------------------------------------------------------------------------ r4173 | acceptthis | 2013-01-17 11:21:20 +0000 (Thu, 17 Jan 2013) | 1 line buildbot doesn't have RegGetString, which is too recent for xp anyway, too. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4171 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_win.c | 34 +++++++++++++++++++++------------- plugins/xsv/m_x.c | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 22c63e760..a57395e25 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -1978,10 +1978,11 @@ void Win7_TaskListInit(void) } #endif - #if defined(SVNREVISION) #if defined(OFFICIAL_RELEASE) - #define BUILDTYPE "dev" + #define BUILDTYPE "rel" + #else + #define BUILDTYPE "test" #define UPDATE_URL "http://triptohell.info/moodles/" #define UPDATE_URL_VERSION UPDATE_URL "version.txt" #ifdef _WIN64 @@ -1989,8 +1990,6 @@ void Win7_TaskListInit(void) #else #define UPDATE_URL_BUILD UPDATE_URL "win32/fte" EXETYPE ".exe" #endif - #else - #define BUILDTYPE "rel" #endif #endif @@ -2018,17 +2017,31 @@ void Win7_TaskListInit(void) void MyRegSetValue(HKEY base, char *keyname, char *valuename, int type, void *data, int datalen) { HKEY subkey; - RegOpenKeyEx(HKEY_CURRENT_USER,keyname, 0, KEY_WRITE, &subkey); + RegOpenKeyEx(base, keyname, 0, KEY_WRITE, &subkey); RegSetValueEx(subkey, valuename, 0, type, data, datalen); RegCloseKey (subkey); } void MyRegDeleteKeyValue(HKEY base, char *keyname, char *valuename) { HKEY subkey; - RegOpenKeyEx(HKEY_CURRENT_USER,keyname, 0, KEY_WRITE, &subkey); + RegOpenKeyEx(base, keyname, 0, KEY_WRITE, &subkey); RegDeleteValue(subkey, valuename); RegCloseKey (subkey); } +void MyRegGetStringValue(HKEY base, char *keyname, char *valuename, void *data, int datalen) +{ + DWORD resultlen = datalen - 1; + HKEY subkey; + DWORD type = REG_NONE; + RegOpenKeyEx(base, keyname, 0, KEY_WRITE, &subkey); + RegQueryValueEx(subkey, valuename, NULL, &type, data, &datalen); + RegCloseKey (subkey); + + if (type == REG_SZ || type == REG_EXPAND_SZ) + ((char*)data)[datalen] = 0; + else + ((char*)data)[0] = 0; +} qboolean Update_GetHomeDirectory(char *homedir, int homedirsize) { @@ -2140,7 +2153,6 @@ qboolean Sys_CheckUpdated(void) { char pendingpath[MAX_OSPATH]; char updatedpath[MAX_QPATH]; - DWORD bufsz; PROCESS_INFORMATION childinfo; STARTUPINFO startinfo; @@ -2149,9 +2161,7 @@ qboolean Sys_CheckUpdated(void) memset(&startinfo, 0, sizeof(startinfo)); startinfo.cb = sizeof(startinfo); - bufsz = sizeof(pendingpath); - *pendingpath = 0; - RegGetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE, RRF_RT_REG_SZ, NULL, pendingpath, &bufsz); + MyRegGetStringValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE, pendingpath, sizeof(pendingpath)); if (*pendingpath) { MyRegDeleteKeyValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE); @@ -2161,9 +2171,7 @@ qboolean Sys_CheckUpdated(void) MyRegSetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, BUILDTYPE EXETYPE, REG_SZ, updatedpath, strlen(updatedpath)+1); } - bufsz = sizeof(updatedpath); - *updatedpath = 0; - RegGetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, BUILDTYPE EXETYPE, RRF_RT_REG_SZ, NULL, updatedpath, &bufsz); + MyRegGetStringValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, BUILDTYPE EXETYPE, updatedpath, sizeof(updatedpath)); if (*updatedpath) { diff --git a/plugins/xsv/m_x.c b/plugins/xsv/m_x.c index 15f54c50a..05781f19d 100644 --- a/plugins/xsv/m_x.c +++ b/plugins/xsv/m_x.c @@ -382,7 +382,7 @@ void X_SendIntialResponse(xclient_t *cl) setup->maxKeyCode = 255; vendor = (char *)(setup+1); - strcpy(vendor, "FTE QuakeWorld X"); + strcpy(vendor, FULLENGINENAME " X"); setup->nbytesVendor = (strlen(vendor)+3)&~3; pixmapformats = (xPixmapFormat *)(vendor + setup->nbytesVendor);