aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/tools/vsenvironmentdetector.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-12-04 16:33:27 -0800
committerJake Petroules <jake.petroules@qt.io>2016-12-05 18:54:41 +0000
commit063c459054e228c27676b0b41478697c0db9f66e (patch)
tree1651e9fdf941f1564787e1554ca72e072a21de91 /src/lib/corelib/tools/vsenvironmentdetector.cpp
parentd5b4d35659265013d2695f9de87d661d8101280c (diff)
Make Win32 API usage long-path aware
Most Win32 API functions are limited to working with paths which are up to MAX_PATH (260) characters long by default. Windows 10 version 1607 allows this limit to be exceeded by setting a LongPathsEnabled registry key and manifesting the application with the longPathAware=true setting. We cannot rely on this being the case since we support older Windows versions and the registry key is set to off by default. Fortunately, most Win32 API functions allow prepending the \\?\ prefix which raises the path length limit to UNICODE_STRING_MAX_CHARS (32767) characters. This works on all Windows versions. For the FileInfo class in particular, this resolves potential false negatives for file existence, inability to retrieve modification times, and misidentification of directories as files. Task-number: QBS-1068 Change-Id: Ia4a37fa75ede803e3e2ecb63ae1ab12d2dae33bd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/tools/vsenvironmentdetector.cpp')
-rw-r--r--src/lib/corelib/tools/vsenvironmentdetector.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/corelib/tools/vsenvironmentdetector.cpp b/src/lib/corelib/tools/vsenvironmentdetector.cpp
index 291c150c9..4d359f85c 100644
--- a/src/lib/corelib/tools/vsenvironmentdetector.cpp
+++ b/src/lib/corelib/tools/vsenvironmentdetector.cpp
@@ -59,7 +59,7 @@ namespace Internal {
static QString windowsSystem32Path()
{
#ifdef Q_OS_WIN
- wchar_t str[MAX_PATH];
+ wchar_t str[UNICODE_STRING_MAX_CHARS];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, 0, str)))
return QString::fromUtf16(reinterpret_cast<ushort*>(str));
#endif