You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In core.cpp the function DetectPackagePayloadsCached has this code:
hr = FileSize(sczPayloadCachePath, &llSize);
if (SUCCEEDED(hr) && static_cast<DWORD64>(llSize) == pPackagePayload->pPayload->qwFileSize)
{
pPackagePayload->fCached = TRUE;
}
else
{
if (static_cast<DWORD64>(llSize) != pPackagePayload->pPayload->qwFileSize)
{
hr = HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
}
LogId(REPORT_STANDARD, MSG_DETECT_PACKAGE_NOT_FULLY_CACHED, pPackage->sczId, pPackagePayload->pPayload->sczKey, hr);
cache = BURN_CACHE_STATE_PARTIAL; // found a payload that was not cached so we are partial.
hr = S_OK;
}
If FileSize returns a error then it also returns file size 0. Thus the comparison at the start of the else will overwrite the return code with the generic ERROR_FILE_CORRUPT. This does not allow postmortem debugging based on the log file. Better would be to retain the HRESULT from FileSize and present that value in the log. I'd suggest modifying the code as follows:
hr = FileSize(sczPayloadCachePath, &llSize);
if (SUCCEEDED(hr) && static_cast<DWORD64>(llSize) == pPackagePayload->pPayload->qwFileSize)
{
pPackagePayload->fCached = TRUE;
}
else
{
if (SUCCEEDED(hr) && static_cast<DWORD64>(llSize) != pPackagePayload->pPayload->qwFileSize)
{
hr = HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
}
LogId(REPORT_STANDARD, MSG_DETECT_PACKAGE_NOT_FULLY_CACHED, pPackage->sczId, pPackagePayload->pPayload->sczKey, hr);
cache = BURN_CACHE_STATE_PARTIAL; // found a payload that was not cached so we are partial.
hr = S_OK;
}
The new test for SUCCEEDED(hr) means that the generic error code will only be returned if the actual file size differs from the stored value.
Originally opened by bernie.vachon
The text was updated successfully, but these errors were encountered:
In core.cpp the function DetectPackagePayloadsCached has this code:
If FileSize returns a error then it also returns file size 0. Thus the comparison at the start of the else will overwrite the return code with the generic ERROR_FILE_CORRUPT. This does not allow postmortem debugging based on the log file. Better would be to retain the HRESULT from FileSize and present that value in the log. I'd suggest modifying the code as follows:
The new test for SUCCEEDED(hr) means that the generic error code will only be returned if the actual file size differs from the stored value.
The text was updated successfully, but these errors were encountered: