summaryrefslogtreecommitdiff
path: root/src/libs/dutil/WixToolset.DUtil/cabcutil.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-03-10 22:37:58 -0800
committerRob Mensching <rob@firegiant.com>2022-03-14 12:50:55 -0700
commit9337172498d263399b8c5e3795aca1897093d37b (patch)
treeba14feb787a86377cbca75ca17e24ffd75a45791 /src/libs/dutil/WixToolset.DUtil/cabcutil.cpp
parent1ad3f518f0d725bb921ad8af943e94b124f35ace (diff)
downloadwix-9337172498d263399b8c5e3795aca1897093d37b.tar.gz
wix-9337172498d263399b8c5e3795aca1897093d37b.tar.bz2
wix-9337172498d263399b8c5e3795aca1897093d37b.zip
Use min DOS date/time when filetime not supported by cabinet
Cabinets require files use DOS date/time. Since there are limits to DOS date/time, use the minimum date/time when a file's actual DOS date/time are out of bounds. Fixes 5296
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/cabcutil.cpp')
-rw-r--r--src/libs/dutil/WixToolset.DUtil/cabcutil.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/cabcutil.cpp b/src/libs/dutil/WixToolset.DUtil/cabcutil.cpp
index 93a9b7e1..9cc45a83 100644
--- a/src/libs/dutil/WixToolset.DUtil/cabcutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/cabcutil.cpp
@@ -1047,12 +1047,12 @@ static HRESULT UtcFileTimeToLocalDosDateTime(
1047 1047
1048 if (!::FileTimeToLocalFileTime(pFileTime, &ftLocal)) 1048 if (!::FileTimeToLocalFileTime(pFileTime, &ftLocal))
1049 { 1049 {
1050 CabcExitWithLastError(hr, "Filed to convert file time to local file time."); 1050 CabcExitWithLastError(hr, "Failed to convert file time to local file time.");
1051 } 1051 }
1052 1052
1053 if (!::FileTimeToDosDateTime(&ftLocal, pDate, pTime)) 1053 if (!::FileTimeToDosDateTime(&ftLocal, pDate, pTime))
1054 { 1054 {
1055 CabcExitWithLastError(hr, "Filed to convert file time to DOS date time."); 1055 CabcExitWithLastError(hr, "Failed to convert file time to DOS date time.");
1056 } 1056 }
1057 1057
1058LExit: 1058LExit:
@@ -1508,7 +1508,15 @@ static __callback INT_PTR DIAMONDAPI CabCGetOpenInfo(
1508 // found. This would create further problems if the file was written to the CAB without this value. Windows 1508 // found. This would create further problems if the file was written to the CAB without this value. Windows
1509 // Installer would then fail to extract the file. 1509 // Installer would then fail to extract the file.
1510 hr = UtcFileTimeToLocalDosDateTime(&fad.ftCreationTime, pdate, ptime); 1510 hr = UtcFileTimeToLocalDosDateTime(&fad.ftCreationTime, pdate, ptime);
1511 CabcExitOnFailure(hr, "Filed to read a valid file time stucture on file '%s'.", pszName); 1511
1512 // If we could not convert the ftLastWriteTime or ftCreationTime to a DOS time, then set the date/time to
1513 // the smallest value that can be represented: midnight on 1/1/1980.
1514 if (FAILED(hr))
1515 {
1516 *pdate = 0;
1517 *ptime = 0;
1518 hr = S_OK;
1519 }
1512 } 1520 }
1513 1521
1514 iResult = CabCOpen(pszFilePlusMagic, _O_BINARY|_O_RDONLY, 0, err, pv); 1522 iResult = CabCOpen(pszFilePlusMagic, _O_BINARY|_O_RDONLY, 0, err, pv);