[wintogo] add an error popup if we can't select the version

This commit is contained in:
Pete Batard 2017-05-02 00:21:14 +01:00
parent 9950f5c088
commit 3b4b742772
4 changed files with 18 additions and 10 deletions

View file

@ -1281,7 +1281,8 @@ out:
// Checks which versions of Windows are available in an install.wim image // Checks which versions of Windows are available in an install.wim image
// to set our extraction index. Asks the user to select one if needed. // to set our extraction index. Asks the user to select one if needed.
BOOL SetWinToGoIndex(void) // Returns -2 on user cancel, -1 on other error, >=0 on success.
int SetWinToGoIndex(void)
{ {
char *mounted_iso, *build, image[128]; char *mounted_iso, *build, image[128];
char tmp_path[MAX_PATH] = "", xml_file[MAX_PATH] = ""; char tmp_path[MAX_PATH] = "", xml_file[MAX_PATH] = "";
@ -1344,7 +1345,7 @@ BOOL SetWinToGoIndex(void)
if ((build_nr < 15000) && (SelectedDrive.MediaType != FixedMedia)) { if ((build_nr < 15000) && (SelectedDrive.MediaType != FixedMedia)) {
if (MessageBoxExU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190), if (MessageBoxExU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190),
MB_YESNO | MB_ICONWARNING | MB_IS_RTL, selected_langid) != IDYES) MB_YESNO | MB_ICONWARNING | MB_IS_RTL, selected_langid) != IDYES)
wintogo_index = -1; wintogo_index = -2;
} }
} }
StrArrayDestroy(&version_name); StrArrayDestroy(&version_name);
@ -1353,7 +1354,7 @@ BOOL SetWinToGoIndex(void)
out: out:
DeleteFileU(xml_file); DeleteFileU(xml_file);
UnMountISO(); UnMountISO();
return (wintogo_index >= 0); return wintogo_index;
} }
// http://technet.microsoft.com/en-ie/library/jj721578.aspx // http://technet.microsoft.com/en-ie/library/jj721578.aspx

View file

@ -1308,8 +1308,15 @@ static BOOL BootCheck(void)
} }
} }
// If multiple versions are available, asks the user to select one before we commit to format the drive // If multiple versions are available, asks the user to select one before we commit to format the drive
if (!SetWinToGoIndex()) switch(SetWinToGoIndex()) {
case -1:
MessageBoxExU(hMainDialog, lmprintf(MSG_073), lmprintf(MSG_291), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
// fall through
case -2:
return FALSE; return FALSE;
default:
break;
}
} else if (tt == TT_UEFI) { } else if (tt == TT_UEFI) {
if (!IS_EFI_BOOTABLE(img_report)) { if (!IS_EFI_BOOTABLE(img_report)) {
// Unsupported ISO // Unsupported ISO

View file

@ -480,7 +480,7 @@ extern BOOL WimExtractFile_7z(const char* image, int index, const char* src, con
extern BOOL WimApplyImage(const char* image, int index, const char* dst); extern BOOL WimApplyImage(const char* image, int index, const char* dst);
extern BOOL IsBootableImage(const char* path); extern BOOL IsBootableImage(const char* path);
extern BOOL AppendVHDFooter(const char* vhd_path); extern BOOL AppendVHDFooter(const char* vhd_path);
extern BOOL SetWinToGoIndex(void); extern int SetWinToGoIndex(void);
extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid);
extern char* GetSignatureName(const char* path); extern char* GetSignatureName(const char* path);
extern LONG ValidateSignature(HWND hDlg, const char* path); extern LONG ValidateSignature(HWND hDlg, const char* path);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.15.1102" CAPTION "Rufus 2.15.1103"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,15,1102,0 FILEVERSION 2,15,1103,0
PRODUCTVERSION 2,15,1102,0 PRODUCTVERSION 2,15,1103,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.15.1102" VALUE "FileVersion", "2.15.1103"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.15.1102" VALUE "ProductVersion", "2.15.1103"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"