[core] improve support for multipart install.wim

* Closes #450
This commit is contained in:
Pete Batard 2015-02-26 23:47:20 +00:00
parent 785150dcb2
commit 000f60c535
4 changed files with 28 additions and 33 deletions

View file

@ -1296,7 +1296,7 @@ BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi)
uprintf("Mounted ISO as '%s'", mounted_iso); uprintf("Mounted ISO as '%s'", mounted_iso);
// Now we use the WIM API to apply that image // Now we use the WIM API to apply that image
static_sprintf(image, "%s\\sources\\install.wim", mounted_iso); static_sprintf(image, "%s%s", mounted_iso, &iso_report.install_wim_path[2]);
if (!WimApplyImage(image, 1, drive_name)) { if (!WimApplyImage(image, 1, drive_name)) {
uprintf("Failed to apply Windows To Go image"); uprintf("Failed to apply Windows To Go image");
if (!IS_ERROR(FormatStatus)) if (!IS_ERROR(FormatStatus))
@ -1477,7 +1477,6 @@ DWORD WINAPI FormatThread(void* param)
char drive_name[] = "?:\\"; char drive_name[] = "?:\\";
char drive_letters[27]; char drive_letters[27];
char logfile[MAX_PATH], *userdir; char logfile[MAX_PATH], *userdir;
char wim_image[] = "?:\\sources\\install.wim";
char efi_dst[] = "?:\\efi\\boot\\bootx64.efi"; char efi_dst[] = "?:\\efi\\boot\\bootx64.efi";
char kolibri_dst[] = "?:\\MTLD_F32"; char kolibri_dst[] = "?:\\MTLD_F32";
char grub4dos_dst[] = "?:\\grldr"; char grub4dos_dst[] = "?:\\grldr";
@ -1891,14 +1890,9 @@ DWORD WINAPI FormatThread(void* param)
} }
} }
// EFI mode selected, with no 'bootx64.efi' (bit #2) but Windows 7 x64's 'bootmgr.efi' (bit #0) // EFI mode selected, with no 'bootx64.efi' (bit #2) but Windows 7 x64's 'bootmgr.efi' (bit #0)
if ((bt == BT_UEFI) && (!(iso_report.has_efi & 4)) && (iso_report.has_efi & 1) && (iso_report.has_install_wim)) { if ((bt == BT_UEFI) && (!(iso_report.has_efi & 4)) && (iso_report.has_efi & 1) && (HAS_INSTALL_WIM(iso_report))) {
PrintInfoDebug(0, MSG_232); PrintInfoDebug(0, MSG_232);
wim_image[0] = drive_name[0]; iso_report.install_wim_path[0] = drive_name[0];
// Handle multipart .swm images
if (iso_report.has_install_wim == 2) {
wim_image[19] = 's';
wim_image[20] = 'w';
}
efi_dst[0] = drive_name[0]; efi_dst[0] = drive_name[0];
efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0;
if (!CreateDirectoryA(efi_dst, 0)) { if (!CreateDirectoryA(efi_dst, 0)) {
@ -1906,7 +1900,7 @@ DWORD WINAPI FormatThread(void* param)
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
} else { } else {
efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = '\\'; efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = '\\';
if (!WimExtractFile(wim_image, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) { if (!WimExtractFile(iso_report.install_wim_path, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) {
uprintf("Failed to setup Win7 EFI boot\n"); uprintf("Failed to setup Win7 EFI boot\n");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
} }

View file

@ -197,7 +197,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
if (safe_stricmp(psz_dirname, install_wim_path) == 0) { if (safe_stricmp(psz_dirname, install_wim_path) == 0) {
for (i=0; i<ARRAYSIZE(install_wim_name); i++) for (i=0; i<ARRAYSIZE(install_wim_name); i++)
if (safe_stricmp(psz_basename, install_wim_name[i]) == 0) if (safe_stricmp(psz_basename, install_wim_name[i]) == 0)
iso_report.has_install_wim |= (1<<i); static_sprintf(iso_report.install_wim_path, "?:\\%s\\%s", &install_wim_path[1], install_wim_name[i]);
} }
// Check for PE (XP) specific files in "/i386" or "/minint" // Check for PE (XP) specific files in "/i386" or "/minint"

View file

@ -231,26 +231,27 @@ typedef struct {
#define OLD_C32_THRESHOLD { 53500, 148000 } #define OLD_C32_THRESHOLD { 53500, 148000 }
/* ISO details that the application may want */ /* ISO details that the application may want */
#define WINPE_MININT 0x2A #define WINPE_MININT 0x2A
#define WINPE_I386 0x15 #define WINPE_I386 0x15
#define HAS_SYSLINUX(r) (r.sl_version != 0) #define HAS_SYSLINUX(r) (r.sl_version != 0)
#define HAS_TOGO(r) (r.has_bootmgr && r.has_efi && r.has_install_wim) #define HAS_INSTALL_WIM(r) (r.install_wim_path[0] != 0)
#define IS_WINPE(r) (((r & WINPE_MININT) == WINPE_MININT)||(( r & WINPE_I386) == WINPE_I386)) #define HAS_TOGO(r) (r.has_bootmgr && r.has_efi && HAS_INSTALL_WIM(r))
#define IS_WIN7_EFI(r) (r.has_efi & 1) #define IS_WINPE(r) (((r & WINPE_MININT) == WINPE_MININT)||(( r & WINPE_I386) == WINPE_I386))
#define IS_REACTOS(r) (r.reactos_path[0] != 0) #define IS_WIN7_EFI(r) (r.has_efi & 1)
#define IS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos)) #define IS_REACTOS(r) (r.reactos_path[0] != 0)
#define IS_FAT(fs) ((fs == FS_FAT16) || (fs == FS_FAT32)) #define IS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos))
#define IS_FAT(fs) ((fs == FS_FAT16) || (fs == FS_FAT32))
typedef struct { typedef struct {
char label[192]; /* 3*64 to account for UTF-8 */ char label[192]; /* 3*64 to account for UTF-8 */
char usb_label[192]; /* converted USB label for workaround */ char usb_label[192]; /* converted USB label for workaround */
char cfg_path[128]; /* path to the ISO's isolinux.cfg */ char cfg_path[128]; /* path to the ISO's isolinux.cfg */
char reactos_path[128]; /* path to the ISO's freeldr.sys or setupldr.sys */ char reactos_path[128]; /* path to the ISO's freeldr.sys or setupldr.sys */
char install_wim_path[64]; /* path to install.wim or install.swm */
uint64_t projected_size; uint64_t projected_size;
uint64_t src_size; uint64_t src_size;
uint8_t winpe; uint8_t winpe;
uint8_t has_efi; uint8_t has_efi;
uint8_t has_install_wim;
BOOL has_4GB_file; BOOL has_4GB_file;
BOOL has_long_filename; BOOL has_long_filename;
BOOL has_symlinks; BOOL has_symlinks;

View file

@ -32,7 +32,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
CAPTION "Rufus 2.0.633" CAPTION "Rufus 2.0.634"
FONT 8, "Segoe UI", 400, 0, 0x1 FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -157,7 +157,7 @@ END
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376 IDD_DIALOG_XP 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
CAPTION "Rufus 2.0.633" CAPTION "Rufus 2.0.634"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376 IDD_DIALOG_RTL 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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.633" CAPTION "Rufus 2.0.634"
FONT 8, "Segoe UI", 400, 0, 0x1 FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376 IDD_DIALOG_RTL_XP 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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.633" CAPTION "Rufus 2.0.634"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -671,8 +671,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,633,0 FILEVERSION 2,0,634,0
PRODUCTVERSION 2,0,633,0 PRODUCTVERSION 2,0,634,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -689,13 +689,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.0.633" VALUE "FileVersion", "2.0.634"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 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.0.633" VALUE "ProductVersion", "2.0.634"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"