Example #1
0
static DWORD _BuildTreeLevel(const HANDLE hDirectory, CFileSystemObject & FSObject)
{
	DWORD ret = ERROR_GEN_FAILURE;

	ret = FSObject.FindChildren(hDirectory);
	if (ret == ERROR_SUCCESS) {
		for (auto it = FSObject.begin(); it != FSObject.end(); ++it) {
			CFileSystemObject *ch = it->second;
			ULONG attr = ch->getFileAttributes();
			
			if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) == 0 && (attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
				HANDLE hChild = NULL;

				ret = _OpenDirectoryName(hDirectory, ch->getName(), &hChild);
				if (ret == ERROR_SUCCESS) {
					ret = _BuildTreeLevel(hChild, *ch);
					CloseHandle(hChild);
				}
			}

//			if (ret != ERROR_SUCCESS)
//				break;
		}
	}

	return ret;
}