summaryrefslogtreecommitdiff
path: root/zen/FindFilePlus/find_file_plus.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/FindFilePlus/find_file_plus.h')
-rw-r--r--zen/FindFilePlus/find_file_plus.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/zen/FindFilePlus/find_file_plus.h b/zen/FindFilePlus/find_file_plus.h
index 33e9a178..2ef5affe 100644
--- a/zen/FindFilePlus/find_file_plus.h
+++ b/zen/FindFilePlus/find_file_plus.h
@@ -38,7 +38,7 @@ struct FileInformation
DWORD fileAttributes;
DWORD shortNameLength;
WCHAR shortName[MAX_PATH + 1]; //shortName is 0-terminated
-}; //no need for #pragma pack -> all members already starting at 4 byte boundary!
+}; //no need for #pragma pack -> all members are perfectly 4, 8 byte aligned!
class FileSearcher;
typedef FileSearcher* FindHandle;
@@ -49,6 +49,19 @@ FindHandle openDir(const wchar_t* dirname); //returns NULL on error, call ::GetL
DLL_FUNCTION_DECLARATION
bool readDir(FindHandle hnd, FileInformation& output); //returns false on error or if there are no more files; ::GetLastError() returns ERROR_NO_MORE_FILES in this case
+/*
+warning:; this may also return file system implementation dependent error codes like ERROR_NOT_SUPPORTED, ERROR_INVALID_LEVEL,
+ect. if "FileIdBothDirectoryInformation" is not supported! We need a fallback:
+
+ sometimes it's *not* sufficient to use fallback for NtQueryDirectoryFile() alone, we need to reset "hDir", since it may be f$ck$d $p by some poor file system layer implementation:
+ - Samba before v3.0.22 (Mar 30, 2006) seems to have a bug which sucessfully returns 128 elements via NtQueryDirectoryFile() and FileIdBothDirectoryInformation,
+ then fails with STATUS_INVALID_LEVEL. Fallback to FileBothDirectoryInformation will return STATUS_NO_MORE_FILES, even if there *are* more files
+ - NtQueryDirectoryFile() may *not* respect "restartScan" for some weird Win2000 file system drivers, so we cannot rely on this as a replacement for a "hDir" reset
+ - Windows 7 Remote Desktop sharing does not work unless "hDir" is reset!
+ => let's assume worst case in general and do a reset!
+ perf note: implementing this reset at a folder level is possible, but a huge perf-killer (additional open/close handle), therefore fallback must apply to a complete folder (sub-)tree!
+ => caller needs to handle this and implement FindFirstFile()/FindNextFile() fallback!
+*/
DLL_FUNCTION_DECLARATION
void closeDir(FindHandle hnd);
bgstack15