summaryrefslogtreecommitdiff
path: root/protocols/Xfire/src/searching4games.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-03-01 20:50:59 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-03-01 20:50:59 +0000
commitd6331b6e7bbef9facc7e6c8bdc42ed4e7b58668d (patch)
tree44032474a6abe389fcc2c5302743c019f95d7074 /protocols/Xfire/src/searching4games.cpp
parentcbf1506b70dfa0e5e6a7ef9107b6e0f127d7724e (diff)
XFire:
- Major cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@12294 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src/searching4games.cpp')
-rw-r--r--protocols/Xfire/src/searching4games.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp
index 93851ee494..2522a06f9b 100644
--- a/protocols/Xfire/src/searching4games.cpp
+++ b/protocols/Xfire/src/searching4games.cpp
@@ -46,10 +46,6 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL)
pos = strchr(ppath, '*');
if (pos)
{
- HANDLE fHandle;
- WIN32_FIND_DATAA wfd;
- BOOL weiter = TRUE;
-
if (pathwildcard)
{
strcpy_s(pathwildcard, XFIRE_MAX_STATIC_STRING_LEN, ppath);
@@ -60,26 +56,29 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL)
pos++;
//versuch die exe zu finden
- fHandle = FindFirstFileA(ppath, &wfd); // . skippen
- FindNextFileA(fHandle, &wfd); // .. auch skippen
-
- while ((FindNextFileA(fHandle, &wfd) && weiter == TRUE)) // erstes file
- {
- if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // nur verzeichnisse sind interessant
+ WIN32_FIND_DATAA wfd;
+ HANDLE fHandle = FindFirstFileA(ppath, &wfd); // . skippen
+ if (fHandle == INVALID_HANDLE_VALUE)
+ return FALSE;
+ if(FindNextFileA(fHandle, &wfd)) { // .. auch skippen
+ while (FindNextFileA(fHandle, &wfd)) // erstes file
{
- char temp[XFIRE_MAX_STATIC_STRING_LEN];
-
- strcpy(temp, ppath);
- *(temp + strlen(temp) - 1) = 0;
- strcat(temp, wfd.cFileName);
- strcat(temp, "\\");
- strcat(temp, pos);
-
- if (GetFileAttributesA(temp) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
- //gefundenes in path kopieren
- FindClose(fHandle);
- strcpy(ppath, temp);
- return TRUE;
+ if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // nur verzeichnisse sind interessant
+ {
+ char temp[XFIRE_MAX_STATIC_STRING_LEN];
+
+ strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
+ *(temp + strlen(temp) - 1) = 0;
+ strncat(temp, wfd.cFileName,XFIRE_MAX_STATIC_STRING_LEN-1);
+ strncat(temp, "\\",XFIRE_MAX_STATIC_STRING_LEN-1);
+ strncat(temp, pos,XFIRE_MAX_STATIC_STRING_LEN-1);
+
+ if (GetFileAttributesA(temp) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
+ //gefundenes in path kopieren
+ FindClose(fHandle);
+ strcpy(ppath, temp);
+ return TRUE;
+ }
}
}
}
@@ -291,7 +290,7 @@ void Scan4Games(LPVOID lparam)
pos++;
pos2 = strrchr(pos, '\\'); //key trennen
- if (pos != 0)
+ if (pos2 != 0)
{
*pos2 = 0;
pos2++;