mirror of
https://github.com/uroni/urbackup_frontend_wx.git
synced 2025-10-26 11:19:28 +00:00
Do not add non-existent components
This commit is contained in:
parent
bbea92ed79
commit
611fb8037f
@ -427,13 +427,17 @@ wxThread::ExitCode RestoreWindowsComponentsThread::Entry()
|
||||
}
|
||||
}
|
||||
|
||||
hr = backupcom->SetSelectedForRestore(writerId, componentInfo->type,
|
||||
componentInfo->bstrLogicalPath, componentInfo->bstrComponentName, true);
|
||||
|
||||
if (hr != S_OK)
|
||||
if (hasCurrComponent)
|
||||
{
|
||||
log("Error selecting component \"" + componentNameStr + "\" with logical path \"" + logicalPathStr + "\" of writer \"" + writerNameStr + "\" for restore");
|
||||
return false;
|
||||
hr = backupcom->SetSelectedForRestore(writerId, componentInfo->type,
|
||||
componentInfo->bstrLogicalPath, componentInfo->bstrComponentName, true);
|
||||
|
||||
if (hr != S_OK)
|
||||
{
|
||||
log("Error selecting component \"" + componentNameStr + "\" with logical path \"" + logicalPathStr + "\" of writer \"" + writerNameStr + "\" for restore. VSS error code " + GetErrorHResErrStr(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SRestoreComponent comp;
|
||||
@ -444,6 +448,7 @@ wxThread::ExitCode RestoreWindowsComponentsThread::Entry()
|
||||
comp.writerName = writerNameStr;
|
||||
comp.logicalPath = logicalPathStr;
|
||||
comp.type = componentInfo->type;
|
||||
comp.hasComponent = hasCurrComponent;
|
||||
|
||||
if (method == VSS_RME_RESTORE_IF_NOT_THERE)
|
||||
{
|
||||
@ -624,18 +629,23 @@ wxThread::ExitCode RestoreWindowsComponentsThread::Entry()
|
||||
"\" of writer \"" + comp.writerName + "\" finished.");
|
||||
}
|
||||
|
||||
hr = backupcom->SetFileRestoreStatus(comp.writerId,
|
||||
comp.type, comp.logicalPath.empty() ? NULL : ConvertToUnicode(comp.logicalPath).c_str(),
|
||||
ConvertToUnicode(comp.componentName).c_str(),
|
||||
has_restore_err ? VSS_RS_FAILED : VSS_RS_ALL);
|
||||
has_restore_err = false;
|
||||
|
||||
if (hr != S_OK)
|
||||
if (comp.hasComponent)
|
||||
{
|
||||
log("Error setting restore status of component \"" + comp.componentName +
|
||||
"\" of writer \"" + comp.writerName + "\". VSS error code " + GetErrorHResErrStr(hr));
|
||||
return false;
|
||||
hr = backupcom->SetFileRestoreStatus(comp.writerId,
|
||||
comp.type, comp.logicalPath.empty() ? NULL : ConvertToUnicode(comp.logicalPath).c_str(),
|
||||
ConvertToUnicode(comp.componentName).c_str(),
|
||||
has_restore_err ? VSS_RS_FAILED : VSS_RS_ALL);
|
||||
|
||||
|
||||
if (hr != S_OK)
|
||||
{
|
||||
log("Error setting restore status of component \"" + comp.componentName +
|
||||
"\" of writer \"" + comp.writerName + "\". VSS error code " + GetErrorHResErrStr(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
has_restore_err = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,7 +842,11 @@ bool RestoreWindowsComponentsThread::getFilespec(IVssWMFiledesc * wmFile, SFileS
|
||||
|
||||
hr = wmFile->GetRecursive(&filespec.recursive);
|
||||
|
||||
if (hr != S_OK)
|
||||
if (hr == S_FALSE)
|
||||
{
|
||||
filespec.recursive = false;
|
||||
}
|
||||
else if (hr != S_OK)
|
||||
{
|
||||
log("Getting recursive flag of file spec failed. VSS error code " + GetErrorHResErrStr(hr));
|
||||
return false;
|
||||
|
||||
@ -33,6 +33,7 @@ struct SRestoreComponent
|
||||
std::string logicalPath;
|
||||
VSS_COMPONENT_TYPE type;
|
||||
long long int restoreFlags;
|
||||
bool hasComponent;
|
||||
};
|
||||
|
||||
class RestoreWindowsComponentsThread : public wxThread
|
||||
|
||||
@ -916,6 +916,8 @@ std::string GetErrorHResErrStr(HRESULT res)
|
||||
#define CASE_VSS_ERROR(x) case x: return #x
|
||||
switch (res)
|
||||
{
|
||||
case S_OK:
|
||||
return "S_OK";
|
||||
case E_INVALIDARG:
|
||||
return "E_INVALIDARG";
|
||||
case E_OUTOFMEMORY:
|
||||
@ -951,6 +953,9 @@ std::string GetErrorHResErrStr(HRESULT res)
|
||||
CASE_VSS_ERROR(VSS_E_REBOOT_REQUIRED);
|
||||
CASE_VSS_ERROR(VSS_E_TRANSACTION_FREEZE_TIMEOUT);
|
||||
CASE_VSS_ERROR(VSS_E_TRANSACTION_THAW_TIMEOUT);
|
||||
CASE_VSS_ERROR(S_FALSE);
|
||||
CASE_VSS_ERROR(VSS_E_INVALID_XML_DOCUMENT);
|
||||
CASE_VSS_ERROR(VSS_E_UNEXPECTED);
|
||||
};
|
||||
#undef CASE_VSS_ERROR
|
||||
return "UNDEF(" + nconvert((long long int)res) + ")";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user