summaryrefslogtreecommitdiff
path: root/zen/FindFilePlus/find_file_plus.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:20:07 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:20:07 +0200
commit88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170 (patch)
treec6c5babb49b90293380106b81ae5c446959ac70f /zen/FindFilePlus/find_file_plus.cpp
parent5.3 (diff)
downloadFreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.gz
FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.bz2
FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.zip
5.4
Diffstat (limited to 'zen/FindFilePlus/find_file_plus.cpp')
-rw-r--r--zen/FindFilePlus/find_file_plus.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/zen/FindFilePlus/find_file_plus.cpp b/zen/FindFilePlus/find_file_plus.cpp
index ad385668..9fba5f1a 100644
--- a/zen/FindFilePlus/find_file_plus.cpp
+++ b/zen/FindFilePlus/find_file_plus.cpp
@@ -265,14 +265,49 @@ void FileSearcher::readDirImpl(FileInformation& output) //throw FileError
false); //__in BOOLEAN restartScan
if (!NT_SUCCESS(rv))
{
- if (rv == STATUS_NO_SUCH_FILE) //harmonize ntQueryDirectoryFile() error handling! failure to find a file on first call returns STATUS_NO_SUCH_FILE,
- rv = STATUS_NO_MORE_FILES; //while on subsequent accesses returns STATUS_NO_MORE_FILES
- //note: not all directories contain "., .." entries! E.g. a drive's root directory or NetDrive + ftp.gnu.org\CRYPTO.README"
- //-> addon: this is NOT a directory, it looks like one in NetDrive, but it's a file in Opera
+ /*
+ fallback to default directory query method, if FileIdBothDirectoryInformation is not properly implemented
+ this is required for NetDrive mounted Webdav, e.g. www.box.net and NT4, 2000 remote drives, et al.
+
+ NT status code | Win32 error code
+ --------------------------------|------------------------
+ STATUS_INVALID_LEVEL | ERROR_INVALID_LEVEL
+ STATUS_NOT_SUPPORTED | ERROR_NOT_SUPPORTED
+ STATUS_UNEXPECTED_NETWORK_ERROR | ERROR_UNEXP_NET_ERR -> traverse network drive hosted by Win98
+ STATUS_INVALID_PARAMETER | ERROR_INVALID_PARAMETER
+ STATUS_INVALID_NETWORK_RESPONSE | ERROR_BAD_NET_RESP
+ STATUS_INVALID_INFO_CLASS | ERROR_INVALID_PARAMETER
+ STATUS_UNSUCCESSFUL | ERROR_GEN_FAILURE
+ STATUS_ACCESS_VIOLATION | ERROR_NOACCESS ->FileIdBothDirectoryInformation on XP accessing UDF
+ STATUS_NO_SUCH_FILE | ERROR_FILE_NOT_FOUND
+
+ rv == STATUS_NO_SUCH_FILE:
+ failure to find a file on first call returns STATUS_NO_SUCH_FILE, while subsequent accesses return STATUS_NO_MORE_FILES
+ note: not all directories contain ".", ".." entries! E.g. a drive's root directory or NetDrive + ftp.gnu.org\CRYPTO.README"
+ -> addon: this is NOT a directory, it looks like one in NetDrive, but it's a file in Opera
+ STATUS_NO_SUCH_FILE is abused by some citrix shares instead of "STATUS_INVALID_PARAMETER" so we treat it as such!
+ => since the directory is "truly empty" a fallback won't hurt
+ */
+ if (rv == STATUS_INVALID_LEVEL ||
+ rv == STATUS_NOT_SUPPORTED ||
+ rv == STATUS_UNEXPECTED_NETWORK_ERROR ||
+ rv == STATUS_INVALID_PARAMETER ||
+ rv == STATUS_INVALID_NETWORK_RESPONSE ||
+ rv == STATUS_INVALID_INFO_CLASS ||
+ rv == STATUS_UNSUCCESSFUL ||
+ rv == STATUS_ACCESS_VIOLATION ||
+ rv == STATUS_NO_SUCH_FILE)
+ rv = STATUS_NOT_SUPPORTED;
throw NtFileError(rv); //throws STATUS_NO_MORE_FILES when finished
}
+ //for (NTSTATUS i = 0xC0000000L; i != -1; ++i)
+ //{
+ // if (rtlNtStatusToDosError(i) == 59) //ERROR_UNEXP_NET_ERR
+ // __asm int 3;
+ //}
+
if (status.Information == 0) //except for the first call to call ::NtQueryDirectoryFile():
throw NtFileError(STATUS_BUFFER_OVERFLOW); //if buffer size is too small, return value is STATUS_SUCCESS and Information == 0 -> we don't expect this!
}
bgstack15