mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
Windows: improve error reporting if Conditional File Access is active
This commit is contained in:
parent
ce549cadb2
commit
2853fd2b87
3 changed files with 23 additions and 19 deletions
|
@ -444,23 +444,7 @@ void DownloadThread::run()
|
|||
break;
|
||||
case CURLE_WRITE_ERROR:
|
||||
deleteDownloadedFile();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (_file.errorCode() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
QString msg = tr("Access denied error while writing file to disk.");
|
||||
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Defender\\Windows Defender Exploit Guard\\Controlled Folder Access",
|
||||
QSettings::Registry64Format);
|
||||
if (registry.value("EnableControlledFolderAccess").toInt() == 1)
|
||||
{
|
||||
msg += "<br>"+tr("Controlled Folder Access seems to be enabled. Please add both rpi-imager.exe and fat32format.exe to the list of allowed apps and try again.");
|
||||
}
|
||||
_onDownloadError(msg);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!_cancelled)
|
||||
_onDownloadError(tr("Error writing file to disk"));
|
||||
_onWriteError();
|
||||
break;
|
||||
case CURLE_ABORTED_BY_CALLBACK:
|
||||
deleteDownloadedFile();
|
||||
|
@ -671,6 +655,26 @@ void DownloadThread::_onDownloadError(const QString &msg)
|
|||
emit error(msg);
|
||||
}
|
||||
|
||||
void DownloadThread::_onWriteError()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (_file.errorCode() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
QString msg = tr("Access denied error while writing file to disk.");
|
||||
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Defender\\Windows Defender Exploit Guard\\Controlled Folder Access",
|
||||
QSettings::Registry64Format);
|
||||
if (registry.value("EnableControlledFolderAccess").toInt() == 1)
|
||||
{
|
||||
msg += "<br>"+tr("Controlled Folder Access seems to be enabled. Please add both rpi-imager.exe and fat32format.exe to the list of allowed apps and try again.");
|
||||
}
|
||||
_onDownloadError(msg);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!_cancelled)
|
||||
_onDownloadError(tr("Error writing file to disk"));
|
||||
}
|
||||
|
||||
void DownloadThread::_closeFiles()
|
||||
{
|
||||
_file.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue