From 993cc717a6759f68171ffb6cb3b02ca88ee3ef4f Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Tue, 7 Oct 2008 21:17:07 +0000 Subject: [PATCH] small registry query cleanups git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2869 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/tools.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/src/tools.cpp b/source/src/tools.cpp index d9c62a50..82fd246c 100644 --- a/source/src/tools.cpp +++ b/source/src/tools.cpp @@ -24,14 +24,15 @@ char *getregszvalue(HKEY root, const char *keystr, const char *query) DWORD type = 0, len = 0; if(RegQueryValueEx(key, query, 0, &type, 0, &len)==ERROR_SUCCESS && type==REG_SZ) { - LPSTR val = new char[len]; - long result = RegQueryValueEx(key, query, 0, &type, (unsigned char *)val, &len); + char *val = new char[len]; + long result = RegQueryValueEx(key, query, 0, &type, (uchar *)val, &len); if(result==ERROR_SUCCESS) { RegCloseKey(key); + val[len-1] = '\0'; return val; } - else delete[] val; + delete[] val; } RegCloseKey(key); } @@ -139,7 +140,7 @@ void sethomedir(const char *dir) if(mydocuments) { s_sprintf(tmpdir)("%s%s", mydocuments, dir+strlen(substitute)); - DELETEP(mydocuments); + delete[] mydocuments; } } #endif