FindFirstFile && FindNextFile

am trying to list files in certain directory.
The function works well, for a number of 6 to 7 iterations and then fails,
causing the OS to hang.
When you try to open any other application, windows complain about lack of quota
the following is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
std::list<File> files;
	if(this->isDirectory()){
		::WIN32_FIND_DATA findData;
		::HANDLE fileHandle;
		//append \\*
		std::string dir(this->getAbsoluteName());
		if(dir.empty())
			return files;
		dir+="\\*.*";
		std::wstring wDir = cplusplus::lang::Object::toWString(dir);
		fileHandle = ::FindFirstFile(wDir.c_str(), &findData);
		if(fileHandle!=INVALID_HANDLE_VALUE)
		{
			do{
				wchar_t *wChar = findData.cFileName;
				std::wstring wStr(wChar);
				std::string file = cplusplus::lang::Object::toString(wStr);
				if(file!="." && file!=".."){
					cplusplus::file::File ff(this->getAbsoluteName(), file);
					if(fileFilter)
					{
						if(fileFilter->filter(ff))
							files.push_back(ff);
					}
					else{
						files.push_back(ff);
					}
				}
			}while(::FindNextFile(fileHandle, &findData)!=0);
		}
		FindClose(fileHandle);
	}
	return files;


i work on Visual Studio 2008 under windows XP.
the server i am creating is surely about to run over its estimated completion time.
Any help will be greatly appreciated
Topic archived. No new replies allowed.