Index: src/ch/TLocalFilesystem.cpp
===================================================================
diff -u -N -re30c2b40bd1b533d8740edc88d80b2fb340f3466 -r1456ff2ae4a98c83f18d20dc253a24f26ddf521d
--- src/ch/TLocalFilesystem.cpp	(.../TLocalFilesystem.cpp)	(revision e30c2b40bd1b533d8740edc88d80b2fb340f3466)
+++ src/ch/TLocalFilesystem.cpp	(.../TLocalFilesystem.cpp)	(revision 1456ff2ae4a98c83f18d20dc253a24f26ddf521d)
@@ -70,7 +70,7 @@
 	WIN32_FIND_DATA fd;
 
 	// search by exact name
-	HANDLE hFind = FindFirstFile(pathToCheck.ToString(), &fd);
+	HANDLE hFind = FindFirstFile(PrependPathExtensionIfNeeded(pathToCheck).ToString(), &fd);
 	if(hFind != INVALID_HANDLE_VALUE)
 	{
 		FindClose(hFind);
@@ -81,7 +81,7 @@
 	// instead of c:\, which would never be found prev. way)
 	pathToCheck.AppendIfNotExists(_T("*"), false);
 
-	hFind = FindFirstFile(pathToCheck.ToString(), &fd);
+	hFind = FindFirstFile(PrependPathExtensionIfNeeded(pathToCheck).ToString(), &fd);
 	if(hFind != INVALID_HANDLE_VALUE)
 	{
 		::FindClose(hFind);
@@ -91,29 +91,23 @@
 		return false;
 }
 
-bool TLocalFilesystem::SetFileDirectoryTime(LPCTSTR lpszName, const FILETIME& ftCreationTime, const FILETIME& ftLastAccessTime, const FILETIME& ftLastWriteTime)
+bool TLocalFilesystem::SetFileDirectoryTime(const chcore::TSmartPath& pathFileDir, const FILETIME& ftCreationTime, const FILETIME& ftLastAccessTime, const FILETIME& ftLastWriteTime)
 {
-	TAutoFileHandle hFile = CreateFile(lpszName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);
+	TAutoFileHandle hFile = CreateFile(PrependPathExtensionIfNeeded(pathFileDir).ToString(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);
 	if(hFile == INVALID_HANDLE_VALUE)
 		return false;
 
-	BOOL bResult = (!SetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime));
+	BOOL bResult = SetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime);
 
 	if(!hFile.Close())
 		return false;
 
-	return bResult != 0;
+	return bResult != FALSE;
 }
 
 bool TLocalFilesystem::CreateDirectory(const chcore::TSmartPath& pathDirectory)
 {
-	if(pathDirectory.GetLength() > _MAX_PATH - 1)
-	{
-		std::wstring wstrPath = _T("\\\\?\\") + pathDirectory.ToWString();
-		return ::CreateDirectory(wstrPath.c_str(), NULL) != FALSE;
-	}
-	else
-		return ::CreateDirectory(pathDirectory.ToString(), NULL) != FALSE;
+	return ::CreateDirectory(PrependPathExtensionIfNeeded(pathDirectory).ToString(), NULL) != FALSE;
 }
 
 bool TLocalFilesystem::GetFileInfo(const chcore::TSmartPath& pathFile, CFileInfoPtr& rFileInfo, size_t stSrcIndex, const chcore::TPathContainer* pBasePaths)
@@ -122,21 +116,14 @@
 		THROW(_T("Invalid argument"), 0, 0, 0);
 
 	WIN32_FIND_DATA wfd;
-	HANDLE hFind = INVALID_HANDLE_VALUE;
+	HANDLE hFind = FindFirstFile(PrependPathExtensionIfNeeded(pathFile).ToString(), &wfd);
 
-	if(pathFile.GetLength() > _MAX_PATH - 1)
-	{
-		std::wstring wstrPath = _T("\\\\?\\") + pathFile.ToWString();
-		hFind = FindFirstFile(wstrPath.c_str(), &wfd);
-	}
-	else
-		hFind = FindFirstFile(pathFile.ToString(), &wfd);
-
 	if(hFind != INVALID_HANDLE_VALUE)
 	{
 		FindClose(hFind);
 
-		// add data to members
+		// new instance of path to accomodate the corrected path (i.e. input path might have lower case names, but we'd like to
+		// preserve the original case contained in the filesystem)
 		chcore::TSmartPath pathNew(pathFile);
 		pathNew.DeleteFileName();
 
@@ -154,3 +141,78 @@
 		return false;
 	}
 }
+
+bool TLocalFilesystem::FastMove(const chcore::TSmartPath& pathSource, const chcore::TSmartPath& pathDestination)
+{
+	return ::MoveFile(PrependPathExtensionIfNeeded(pathSource).ToString(), PrependPathExtensionIfNeeded(pathDestination).ToString()) != FALSE;
+}
+
+TLocalFilesystemFind TLocalFilesystem::CreateFinder(const chcore::TSmartPath& pathDir, const chcore::TSmartPath& pathMask)
+{
+	return TLocalFilesystemFind(pathDir, pathMask);
+}
+
+chcore::TSmartPath TLocalFilesystem::PrependPathExtensionIfNeeded(const chcore::TSmartPath& pathInput)
+{
+	if(pathInput.GetLength() > _MAX_PATH - 1)
+		return chcore::PathFromString(_T("\\\\?\\")) + pathInput;
+	else
+		return pathInput;
+}
+
+TLocalFilesystemFind::TLocalFilesystemFind(const chcore::TSmartPath& pathDir, const chcore::TSmartPath& pathMask) :
+	m_pathDir(pathDir),
+	m_pathMask(pathMask),
+	m_hFind(INVALID_HANDLE_VALUE)
+{
+}
+
+TLocalFilesystemFind::~TLocalFilesystemFind()
+{
+	Close();
+}
+
+bool TLocalFilesystemFind::FindNext(CFileInfoPtr& rspFileInfo)
+{
+	WIN32_FIND_DATA wfd;
+	chcore::TSmartPath pathCurrent = m_pathDir + m_pathMask;
+
+	// Iterate through dirs & files
+	bool bContinue = true;
+	if(m_hFind != INVALID_HANDLE_VALUE)
+		bContinue = (FindNextFile(m_hFind, &wfd) != FALSE);
+	else
+		m_hFind = FindFirstFile(TLocalFilesystem::PrependPathExtensionIfNeeded(pathCurrent).ToString(), &wfd);	// in this case we always continue
+	if(bContinue)
+	{
+		do
+		{
+			if(!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+			{
+				rspFileInfo->Init(m_pathDir + chcore::PathFromString(wfd.cFileName), wfd.dwFileAttributes, (((ULONGLONG) wfd.nFileSizeHigh) << 32) + wfd.nFileSizeLow, wfd.ftCreationTime,
+					wfd.ftLastAccessTime, wfd.ftLastWriteTime, 0);
+				return true;
+			}
+			else if(wfd.cFileName[0] != _T('.') || (wfd.cFileName[1] != _T('\0') && (wfd.cFileName[1] != _T('.') || wfd.cFileName[2] != _T('\0'))))
+			{
+				// Add directory itself
+				rspFileInfo->Init(m_pathDir + chcore::PathFromString(wfd.cFileName),
+					wfd.dwFileAttributes, (((ULONGLONG) wfd.nFileSizeHigh) << 32) + wfd.nFileSizeLow, wfd.ftCreationTime,
+					wfd.ftLastAccessTime, wfd.ftLastWriteTime, 0);
+				return true;
+			}
+		}
+		while(::FindNextFile(m_hFind, &wfd));
+
+		Close();
+	}
+
+	return false;
+}
+
+void TLocalFilesystemFind::Close()
+{
+	if(m_hFind != INVALID_HANDLE_VALUE)
+		FindClose(m_hFind);
+	m_hFind = INVALID_HANDLE_VALUE;
+}