aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/WixToolset.DUtil/fileutil.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-08-08 18:02:15 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-08-09 09:57:02 -0500
commit240b663ad5fc94ed6d19c966b5c9105a176ecf40 (patch)
treed194e242ccb5bb69f0dbbc388ede87cef65c700f /src/libs/dutil/WixToolset.DUtil/fileutil.cpp
parent8e1cbe8d7b468553d76c20452561e89726de5c47 (diff)
downloadwix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.tar.gz
wix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.tar.bz2
wix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.zip
Skip logging errors in some places when they are due to missing files or registry keys or values.
Related to 6696
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/fileutil.cpp')
-rw-r--r--src/libs/dutil/WixToolset.DUtil/fileutil.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/fileutil.cpp b/src/libs/dutil/WixToolset.DUtil/fileutil.cpp
index ac407916..a9369ea1 100644
--- a/src/libs/dutil/WixToolset.DUtil/fileutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/fileutil.cpp
@@ -443,6 +443,7 @@ extern "C" HRESULT DAPI FileSize(
443 ) 443 )
444{ 444{
445 HRESULT hr = S_OK; 445 HRESULT hr = S_OK;
446 DWORD er = ERROR_SUCCESS;
446 HANDLE hFile = INVALID_HANDLE_VALUE; 447 HANDLE hFile = INVALID_HANDLE_VALUE;
447 448
448 FileExitOnNull(pwzFileName, hr, E_INVALIDARG, "Attempted to check filename, but no filename was provided"); 449 FileExitOnNull(pwzFileName, hr, E_INVALIDARG, "Attempted to check filename, but no filename was provided");
@@ -450,6 +451,11 @@ extern "C" HRESULT DAPI FileSize(
450 hFile = ::CreateFileW(pwzFileName, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 451 hFile = ::CreateFileW(pwzFileName, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
451 if (INVALID_HANDLE_VALUE == hFile) 452 if (INVALID_HANDLE_VALUE == hFile)
452 { 453 {
454 er = ::GetLastError();
455 if (ERROR_PATH_NOT_FOUND == er || ERROR_FILE_NOT_FOUND == er)
456 {
457 ExitFunction1(hr = HRESULT_FROM_WIN32(er));
458 }
453 FileExitWithLastError(hr, "Failed to open file %ls while checking file size", pwzFileName); 459 FileExitWithLastError(hr, "Failed to open file %ls while checking file size", pwzFileName);
454 } 460 }
455 461
@@ -617,11 +623,11 @@ extern "C" HRESULT DAPI FileReadPartialEx(
617 if (INVALID_HANDLE_VALUE == hFile) 623 if (INVALID_HANDLE_VALUE == hFile)
618 { 624 {
619 er = ::GetLastError(); 625 er = ::GetLastError();
620 if (E_FILENOTFOUND == HRESULT_FROM_WIN32(er)) 626 if (ERROR_PATH_NOT_FOUND == er || ERROR_FILE_NOT_FOUND == er)
621 { 627 {
622 ExitFunction1(hr = E_FILENOTFOUND); 628 ExitFunction1(hr = HRESULT_FROM_WIN32(er));
623 } 629 }
624 FileExitOnWin32Error(er, hr, "Failed to open file: %ls", wzSrcPath); 630 FileExitWithLastError(hr, "Failed to open file: %ls", wzSrcPath);
625 } 631 }
626 632
627 if (!::GetFileSizeEx(hFile, &liFileSize)) 633 if (!::GetFileSizeEx(hFile, &liFileSize))