diff --git a/openvpn_config.c b/openvpn_config.c index b90f2e8..177af83 100644 --- a/openvpn_config.c +++ b/openvpn_config.c @@ -33,21 +33,21 @@ extern struct options o; static int -match (const WIN32_FIND_DATA *find, const char *ext) +match (const WIN32_FIND_DATA *find, const TCHAR *ext) { int i; if (find->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) return MATCH_DIR; - if (!strlen (ext)) + if (!_tcslen(ext)) return MATCH_FILE; - i = strlen (find->cFileName) - strlen (ext) - 1; + i = _tcslen(find->cFileName) - _tcslen(ext) - 1; if (i < 1) return MATCH_FALSE; - if (find->cFileName[i] == '.' && !strcasecmp (find->cFileName + i + 1, ext)) + if (find->cFileName[i] == '.' && !_tcsicmp(find->cFileName + i + 1, ext)) return MATCH_FILE; else return MATCH_FALSE; @@ -57,68 +57,68 @@ match (const WIN32_FIND_DATA *find, const char *ext) * Modify the extension on a filename. */ static bool -modext (char *dest, unsigned int size, const char *src, const char *newext) +modext (TCHAR *dest, unsigned int size, const TCHAR *src, const TCHAR *newext) { int i; - if (size > 0 && (strlen (src) + 1) <= size) + if (size > 0 && (_tcslen(src) + 1) <= size) { - strcpy (dest, src); - dest [size - 1] = '\0'; - i = strlen (dest); + _tcscpy(dest, src); + dest[size - 1] = _T('\0'); + i = _tcslen(dest); while (--i >= 0) { - if (dest[i] == '\\') + if (dest[i] == _T('\\')) break; - if (dest[i] == '.') + if (dest[i] == _T('.')) { - dest[i] = '\0'; + dest[i] = _T('\0'); break; } } - if (strlen (dest) + strlen(newext) + 2 <= size) + if (_tcslen(dest) + _tcslen(newext) + 2 <= size) { - strcat (dest, "."); - strcat (dest, newext); + _tcscat(dest, _T(".")); + _tcscat(dest, newext); return true; } - dest [0] = '\0'; + dest[0] = _T('\0'); } return false; } -int ConfigAlreadyExists(char newconfig[]) +int ConfigAlreadyExists(TCHAR newconfig[]) { int i; for (i=0; i