summaryrefslogtreecommitdiff
path: root/src/shared/directoryentry.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-06-29 18:04:10 +0200
committerTannin <devnull@localhost>2013-06-29 18:04:10 +0200
commitfe37b48dffd8edcd6e30f4e304d3e27a731ac8ae (patch)
treee996c5d329d9abf77bcd12af4d05238fd6ebca1f /src/shared/directoryentry.cpp
parentf8c683f700a3fff30540ff343df2bfba15080e86 (diff)
- caching of downloadwidgets to fix performance problem, currently broken and disabled
- added new state for downloads "uninstalled" for mods that were at one point installed and then removed - user-configured server preference is now used - updated tutorial to account for removal of integrated browser - reverted to qt 4 - using performance optimised findfirstfile on win vista and up - bugfix: it was possible to disable all columns of the mod list - bugfix: hook.dll doesn't load on win xp
Diffstat (limited to 'src/shared/directoryentry.cpp')
-rw-r--r--src/shared/directoryentry.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp
index 9958b934..5f0e0b5a 100644
--- a/src/shared/directoryentry.cpp
+++ b/src/shared/directoryentry.cpp
@@ -421,12 +421,33 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di
}
+static bool SupportOptimizedFind()
+{
+ OSVERSIONINFO versionInfo;
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&versionInfo);
+
+ // large fetch and basic info for FindFirstFileEx is supported on win server 2008 r2, win 7 and newer
+ return (versionInfo.dwMajorVersion > 6) ||
+ ((versionInfo.dwMajorVersion == 6) && (versionInfo.dwMinorVersion >= 1));
+}
+
+
void DirectoryEntry::addFiles(FilesOrigin &origin, wchar_t *buffer, int bufferOffset)
{
WIN32_FIND_DATAW findData;
_snwprintf(buffer + bufferOffset, MAXPATH_UNICODE - bufferOffset, L"\\*");
- HANDLE searchHandle = ::FindFirstFileExW(buffer, FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_CASE_SENSITIVE);
+
+ HANDLE searchHandle = NULL;
+
+ if (SupportOptimizedFind()) {
+ searchHandle = ::FindFirstFileExW(buffer, FindExInfoBasic, &findData, FindExSearchNameMatch, NULL,
+ FIND_FIRST_EX_LARGE_FETCH);
+ } else {
+ searchHandle = ::FindFirstFileExW(buffer, FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
+ }
+
if (searchHandle != INVALID_HANDLE_VALUE) {
BOOL result = true;
while (result) {