int dir(const char *szDir, bool bCountHidden) { char path[MAX_PATH]; WIN32_FIND_DATA fd; DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY; if( !bCountHidden) dwAttr |= FILE_ATTRIBUTE_HIDDEN; sprintf( path, "%s\\*", szDir); HANDLE hFind = FindFirstFile( path, &fd); if(hFind != INVALID_HANDLE_VALUE) { int count = 0; do { RegEx Pattern("SoftToken licens (\\d+)\\-(\\d+)"); if(Pattern.Search(fd.cFileName) == 1) { int low = atoi ( Pattern.Match(1) ); int high = atoi ( Pattern.Match(2) ); if ((((key-low)+low)<=high)&&(((key-low)+low)>=low)) { int len = strlen(fd.cFileName); map = new char[len + 1]; memcpy(map, fd.cFileName, len+1); return 1; } } } while( FindNextFile( hFind, &fd)); FindClose( hFind); return count; } return -1; }