mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Windows: stop storage service during write
The moment we write the block containing the partition table Windows services will start accessing the SD card and write data to "System volume information" folder. If others are writing to disk concurrently this may or may not affect our ability to eject the drive. Stop StorSvc temporarily between us writing the partition table (saved for last) and ejecting the SD card, just in case. Ref #75
This commit is contained in:
parent
19bfc8eacb
commit
5f42c7d7cb
1 changed files with 15 additions and 0 deletions
|
@ -585,6 +585,14 @@ void DownloadThread::_writeComplete()
|
|||
|
||||
emit finalizing();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// Temporarily stop storage services to prevent \[System Volume Information]\WPSettings.dat being created
|
||||
QProcess p1;
|
||||
QStringList args = {"stop", "StorSvc"};
|
||||
qDebug() << "Stopping storage services";
|
||||
p1.execute("net", args);
|
||||
#endif
|
||||
|
||||
if (_firstBlock)
|
||||
{
|
||||
qDebug() << "Writing first block (which we skipped at first)";
|
||||
|
@ -610,6 +618,13 @@ void DownloadThread::_writeComplete()
|
|||
#endif
|
||||
eject_disk(_filename.constData());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QStringList args = {"start", "StorSvc"};
|
||||
QProcess *p2 = new QProcess(this);
|
||||
qDebug() << "Restarting storage services";
|
||||
p2->startDetached("net", args);
|
||||
#endif
|
||||
|
||||
emit success();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue