diff options
author | Bevan Weiss <bevan.weiss@gmail.com> | 2024-08-02 22:19:02 +1000 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2024-09-02 23:45:08 -0400 |
commit | 638532e58ab4c06c35f17421d36ae02ef02ffaf2 (patch) | |
tree | 35df538be7a0d35af73474dcd343d089ffe1fabf | |
parent | 97e2fb014127a390118dd9cbb6b9e0475123a2c9 (diff) | |
download | wix-638532e58ab4c06c35f17421d36ae02ef02ffaf2.tar.gz wix-638532e58ab4c06c35f17421d36ae02ef02ffaf2.tar.bz2 wix-638532e58ab4c06c35f17421d36ae02ef02ffaf2.zip |
Fix up small inaccuracy in logged error message.
When ::GetFileAttributesW returns 0xFFFFFFFF it means
'Invalid File/Folder'
So we should return a matching error message.
To avoid confusing invalid paths with junctions (in error message)
Unfortunately the constant for this is not defined.
So just define it here as though it would be.
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
-rw-r--r-- | src/ext/Util/ca/RemoveFoldersEx.cpp | 14 |
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 | |||
5 | LPCWSTR vcsRemoveFolderExQuery = | 11 | LPCWSTR 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); |