Skip to content

Instantly share code, notes, and snippets.

@wjt
Created May 12, 2017 15:35
Show Gist options
  • Save wjt/59215903cbc56b67360a051cc01cd2cb to your computer and use it in GitHub Desktop.
Save wjt/59215903cbc56b67360a051cc01cd2cb to your computer and use it in GitHub Desktop.
Changes between 1f58194 and f99c744
--- /tmp/1f58194.patch 2017-05-12 16:34:01.562433899 +0100
+++ /tmp/f99c744.patch 2017-05-12 16:34:16.494562569 +0100
@@ -1,8 +1,8 @@
-commit 1f581944a41ac439d604124a67e969e6a19b0412
+commit f99c744b3e90891e58328740e24f41dcecf6c472
Author: Will Thompson <wjt@endlessm.com>
AuthorDate: Thu Apr 13 14:35:59 2017 +0100
Commit: Will Thompson <wjt@endlessm.com>
-CommitDate: Fri Apr 14 12:04:11 2017 +0100
+CommitDate: Thu May 11 14:43:42 2017 +0100
Install Eosldr on BIOS systems
@@ -53,10 +53,28 @@
<ItemGroup>
<None Include="res\EndlessUsbTool.rc2">
diff --git a/src/endless/EndlessUsbToolDlg.cpp b/src/endless/EndlessUsbToolDlg.cpp
-index a138a63..bc4f1f4 100644
+index a138a63..ceb6d57 100644
--- a/src/endless/EndlessUsbToolDlg.cpp
+++ b/src/endless/EndlessUsbToolDlg.cpp
-@@ -560,7 +560,9 @@ CEndlessUsbToolDlg::CEndlessUsbToolDlg(UINT globalMessage, CWnd* pParent /*=NULL
+@@ -397,6 +397,7 @@ static LPCTSTR ErrorCauseToStr(ErrorCause_t errorCause)
+ {
+ switch (errorCause)
+ {
++ TOSTR(ErrorCauseNone);
+ TOSTR(ErrorCauseGeneric);
+ TOSTR(ErrorCauseCancelled);
+ TOSTR(ErrorCauseDownloadFailed);
+@@ -412,7 +413,8 @@ static LPCTSTR ErrorCauseToStr(ErrorCause_t errorCause)
+ TOSTR(ErrorCauseCantCheckMBR);
+ TOSTR(ErrorCauseInstallFailedDiskFull);
+ TOSTR(ErrorCauseSuspended);
+- TOSTR(ErrorCauseNone);
++ TOSTR(ErrorCauseInstallEosldrFailed);
++ TOSTR(ErrorCauseUninstallEosldrFailed);
+ default: return _T("Error Cause Unknown");
+ }
+ }
+@@ -560,7 +562,9 @@ CEndlessUsbToolDlg::CEndlessUsbToolDlg(UINT globalMessage, CWnd* pParent /*=NULL
m_lastErrorCause(ErrorCause_t::ErrorCauseNone),
m_localFilesScanned(false),
m_jsonDownloadState(JSONDownloadState::Pending),
@@ -67,7 +85,7 @@
{
FUNCTION_ENTER;
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
-@@ -5149,6 +5151,7 @@ DWORD WINAPI CEndlessUsbToolDlg::SetupDualBoot(LPVOID param)
+@@ -5149,6 +5153,7 @@ DWORD WINAPI CEndlessUsbToolDlg::SetupDualBoot(LPVOID param)
CString bootFilesPath = CEndlessUsbToolApp::TempFilePath(CString(BOOT_COMPONENTS_FOLDER)) + L"\\";
CStringW exeFilePath = GetExePath();
const bool isBIOS = IsLegacyBIOSBoot();
@@ -75,7 +93,7 @@
systemDriveLetter = GetSystemDrive();
endlessFilesPath = systemDriveLetter + PATH_ENDLESS_SUBDIRECTORY;
-@@ -5208,7 +5211,15 @@ DWORD WINAPI CEndlessUsbToolDlg::SetupDualBoot(LPVOID param)
+@@ -5208,7 +5213,15 @@ DWORD WINAPI CEndlessUsbToolDlg::SetupDualBoot(LPVOID param)
CHECK_IF_CANCELLED;
if (isBIOS) {
@@ -92,7 +110,7 @@
} else {
IFFALSE_GOTOERROR(SetupEndlessEFI(systemDriveLetter, bootFilesPath), "Error on SetupEndlessEFI");
}
-@@ -5233,7 +5244,7 @@ error:
+@@ -5233,7 +5246,7 @@ error:
uprintf("SetupDualBoot exited with error.");
if (dlg->m_lastErrorCause == ErrorCause_t::ErrorCauseNone) {
@@ -101,7 +119,7 @@
}
RemoveNonEmptyDirectory(endlessFilesPath);
-@@ -5973,10 +5984,20 @@ BOOL CEndlessUsbToolDlg::UninstallDualBoot(CEndlessUsbToolDlg *dlg)
+@@ -5973,10 +5986,20 @@ BOOL CEndlessUsbToolDlg::UninstallDualBoot(CEndlessUsbToolDlg *dlg)
IFFALSE_GOTOERROR(hPhysical != INVALID_HANDLE_VALUE, "Error on acquiring disk handle.");
@@ -127,7 +145,7 @@
bool found_boot_entry;
bool ret = UninstallEndlessEFI(systemDriveLetter, hPhysical, found_boot_entry);
diff --git a/src/endless/EndlessUsbToolDlg.h b/src/endless/EndlessUsbToolDlg.h
-index ab8c8c0..c948623 100644
+index ab8c8c0..bbadfe5 100644
--- a/src/endless/EndlessUsbToolDlg.h
+++ b/src/endless/EndlessUsbToolDlg.h
@@ -9,6 +9,7 @@
@@ -138,16 +156,15 @@
typedef struct FileImageEntry {
// Full, real path on disk
-@@ -42,6 +43,8 @@ typedef struct FileImageEntry {
+@@ -42,6 +43,7 @@ typedef struct FileImageEntry {
} FileImageEntry_t, *pFileImageEntry_t;
typedef enum ErrorCause {
+ ErrorCauseNone,
-+
ErrorCauseGeneric,
ErrorCauseCancelled,
ErrorCauseDownloadFailed,
-@@ -57,7 +60,8 @@ typedef enum ErrorCause {
+@@ -57,7 +59,8 @@ typedef enum ErrorCause {
ErrorCauseCantCheckMBR,
ErrorCauseInstallFailedDiskFull,
ErrorCauseSuspended,
@@ -157,18 +174,18 @@
} ErrorCause_t;
typedef struct RemoteImageEntry {
-@@ -297,6 +301,8 @@ private:
+@@ -297,6 +300,8 @@ private:
unsigned long m_cancelImageUnpack;
InstallMethod_t m_selectedInstallMethod;
-+ std::unique_ptr<EosldrInstaller> m_eosldrInstaller;
++ std::unique_ptr<EosldrInstaller> m_eosldrInstaller;
+
void TrackEvent(const CString &action, const CString &label = CString(), LONGLONG value = -1L);
void TrackEvent(const CString &action, LONGLONG value);
void SetSelectedInstallMethod(InstallMethod_t method);
diff --git a/src/endless/Eosldr.cpp b/src/endless/Eosldr.cpp
new file mode 100644
-index 0000000..61559c6
+index 0000000..a7da00c
--- /dev/null
+++ b/src/endless/Eosldr.cpp
@@ -0,0 +1,204 @@
@@ -244,7 +261,7 @@
+ FUNCTION_ENTER_FMT("%ls", path);
+
+ IFFALSE_PRINTERROR(SetFileAttributes(path, FILE_ATTRIBUTE_NORMAL),
-+ "SetFileAttributes failed; will try to delete anyway", false);
++ "SetFileAttributes failed; will try to delete anyway");
+ IFFALSE_RETURN_VALUE(DeleteFile(path), "DeleteFile failed", false);
+
+ return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment