aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ext/Util/ca/RemoveFoldersEx.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ext/Util/ca/RemoveFoldersEx.cpp b/src/ext/Util/ca/RemoveFoldersEx.cpp
index f162e929..5e813ca2 100644
--- a/src/ext/Util/ca/RemoveFoldersEx.cpp
+++ b/src/ext/Util/ca/RemoveFoldersEx.cpp
@@ -2,6 +2,12 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5// Whilst ::GetFileAttributesW might return FILE_ATTRIBUTE_INVALID for an invalid path, it's not a header defined variable.
6// so define it here, but guard it to avoid redefining it if Microsoft change their mind
7#ifndef FILE_ATTRIBUTE_INVALID
8#define FILE_ATTRIBUTE_INVALID ((DWORD)-1)
9#endif
10
5LPCWSTR vcsRemoveFolderExQuery = 11LPCWSTR vcsRemoveFolderExQuery =
6 L"SELECT `RemoveFolderEx`, `Component_`, `Property`, `InstallMode`, `Wix4RemoveFolderEx`.`Condition`, `Component`.`Attributes` " 12 L"SELECT `RemoveFolderEx`, `Component_`, `Property`, `InstallMode`, `Wix4RemoveFolderEx`.`Condition`, `Component`.`Attributes` "
7 L"FROM `Wix4RemoveFolderEx`,`Component` " 13 L"FROM `Wix4RemoveFolderEx`,`Component` "
@@ -38,8 +44,14 @@ static HRESULT RecursePath(
38 } 44 }
39#endif 45#endif
40 46
41 // Do NOT follow junctions.
42 DWORD dwAttributes = ::GetFileAttributesW(wzPath); 47 DWORD dwAttributes = ::GetFileAttributesW(wzPath);
48 if (FILE_ATTRIBUTE_INVALID == dwAttributes)
49 {
50 WcaLog(LOGMSG_STANDARD, "Path is invalid: %ls", wzPath);
51 ExitFunction();
52 }
53
54 // Do NOT follow junctions.
43 if (dwAttributes & FILE_ATTRIBUTE_REPARSE_POINT) 55 if (dwAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
44 { 56 {
45 WcaLog(LOGMSG_STANDARD, "Path is a junction; skipping: %ls", wzPath); 57 WcaLog(LOGMSG_STANDARD, "Path is a junction; skipping: %ls", wzPath);