Exemplo n.º 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;
}
Exemplo n.º 2
0
void PrintLevel(const std::wstring & aParentName, CFileSystemObject & aObject)
{
	std::wstring fullName = aParentName + L'\\' + aObject.getName();
	printf("0x%x: %S\n", aObject.getFileAttributes(), fullName.c_str());
	for (auto it = aObject.begin(); it != aObject.end(); ++it) {
		PrintLevel(fullName, *it->second);
	}

	return;
}