forked from FedoraQt/MediaWriter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows: complete rewrite of drive restoration and image writing
This is a complete rewrite of the Windows support. It introduces a new library 'libwindisk' that combines use of WMI and WinAPI to manipulate with devices. We use Windows Storage Management for getting information about devices and some actions, especially since pure WinAPI does not seem to have support for things like formatting or partition removal. This library is used in both the app and the helper process used for writing and formatting. We now also don't rely on diskpart since it didn't work properly in some cases. Fixes FedoraQt#626 | Fixes FedoraQt#575 | Fixes FedoraQt#574 |Fixes FedoraQt#555 | Fixes FedoraQt#96
- Loading branch information
Showing
15 changed files
with
1,680 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Fedora Media Writer | ||
* Copyright (C) 2024 Jan Grulich <jgrulichredhat.com> | ||
* Copyright (C) 2016 Martin Bříza <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Fedora Media Writer | ||
* Copyright (C) 2024 Jan Grulich <[email protected]> | ||
* Copyright (C) 2016 Martin Bříza <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
|
@@ -18,27 +19,28 @@ | |
*/ | ||
|
||
#include <QCoreApplication> | ||
#include <QLocale> | ||
#include <QTextStream> | ||
#include <QTranslator> | ||
#include <QLocale> | ||
|
||
#include "restorejob.h" | ||
#include "writejob.h" | ||
|
||
int main(int argc, char *argv[]) { | ||
int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication app(argc, argv); | ||
|
||
QTranslator translator; | ||
if (translator.load(QLocale(QLocale().language(), QLocale().country()), QLatin1String(), QLatin1String(), ":/translations")) | ||
app.installTranslator(&translator); | ||
|
||
if (app.arguments().count() == 3 && app.arguments()[1] == "restore") { | ||
new RestoreJob(app.arguments()[2]); | ||
if (translator.load(QLocale(), QLatin1String(), QLatin1String(), ":/translations")) { | ||
app.installTranslator(&translator); | ||
} | ||
else if (app.arguments().count() == 4 && app.arguments()[1] == "write") { | ||
new WriteJob(app.arguments()[2], app.arguments()[3]); | ||
} | ||
else { | ||
|
||
const QStringList args = app.arguments(); | ||
if (args.count() == 3 && args[1] == "restore") { | ||
new RestoreJob(args[2], &app); | ||
} else if (args.count() == 4 && args[1] == "write") { | ||
new WriteJob(args[2], args[3], &app); | ||
} else { | ||
QTextStream err(stderr); | ||
err << "Helper: Wrong arguments entered\n"; | ||
return 1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Fedora Media Writer | ||
* Copyright (C) 2024 Jan Grulich <[email protected]> | ||
* Copyright (C) 2016 Martin Bříza <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
|
@@ -20,6 +21,8 @@ | |
#ifndef RESTOREJOB_H | ||
#define RESTOREJOB_H | ||
|
||
#include <libwindisk/windisk.h> | ||
|
||
#include <QObject> | ||
#include <QProcess> | ||
#include <QTextStream> | ||
|
@@ -28,19 +31,19 @@ class RestoreJob : public QObject | |
{ | ||
Q_OBJECT | ||
public: | ||
explicit RestoreJob(const QString &where); | ||
explicit RestoreJob(const QString &where, QObject *parent); | ||
|
||
signals: | ||
|
||
private slots: | ||
void work(); | ||
|
||
private: | ||
QTextStream out { stdout }; | ||
QTextStream err { stderr }; | ||
QTextStream m_out{stdout}; | ||
QTextStream m_err{stderr}; | ||
|
||
QProcess m_diskpart; | ||
int m_where; | ||
std::unique_ptr<WinDiskManagement> m_diskManagement; | ||
std::unique_ptr<WinDisk> m_disk; | ||
}; | ||
|
||
#endif // RESTOREJOB_H |
Oops, something went wrong.