pafish_exists_regkey_value_str both args are case-insensitive now

This commit is contained in:
Alberto Ortega 2015-03-20 17:03:11 +01:00
parent 6d4f8d2827
commit a5c7814999

View File

@ -24,7 +24,12 @@ inline int pafish_exists_regkey_value_str(HKEY hKey, char * regkey_s, char * val
HKEY regkey;
LONG ret;
DWORD size;
char value[1024];
char value[1024], * lookup_str;
size_t lookup_size;
lookup_size = strlen(lookup);
lookup_str = malloc(lookup_size+sizeof(char));
strncpy(lookup_str, lookup, lookup_size+sizeof(char));
size = sizeof(value);
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ, &regkey);
@ -36,10 +41,16 @@ inline int pafish_exists_regkey_value_str(HKEY hKey, char * regkey_s, char * val
for (i = 0; i < strlen(value); i++) { /* case-insensitive */
value[i] = toupper(value[i]);
}
if (strstr(value, lookup) != NULL)
for (i = 0; i < lookup_size; i++) { /* case-insensitive */
lookup_str[i] = toupper(lookup_str[i]);
}
if (strstr(value, lookup_str) != NULL) {
free(lookup_str);
return TRUE;
}
}
}
free(lookup_str);
return FALSE;
}