Check if registry file exists before copying file over
@@ -25,10 +25,14 @@ HRESULT PrepareDevirtualizedRegistry::ExtractRegistry()
{
std::wstring registryFilePath = m_msixRequest->GetPackageDirectoryPath() + registryDatFile;
std::wstring registryFileCopyPath = m_msixRequest->GetPackageDirectoryPath() + registryDatFileCopy;
+
+ if (std::experimental::filesystem::exists(registryFilePath))
+ {
if (!CopyFile(registryFilePath.c_str(), registryFileCopyPath.c_str(), false))
{
return HRESULT_FROM_WIN32(GetLastError());
}
+ }
std::shared_ptr<RegistryDevirtualizer> registryDevirtualizer;
RETURN_IF_FAILED(RegistryDevirtualizer::Create(registryFileCopyPath, m_msixRequest, &registryDevirtualizer));
