rendered paste bodyint 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);
int count = 0;
while(hFind != INVALID_HANDLE_VALUE) {
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);
FindClose( hFind);
return 1;
}
}
if(!FindNextFile( hFind, &fd)) break;
}
return -1;
}