Skip to content

Commit

Permalink
[core] enable the installation of a bare UEFI:NTFS in advanced mode
Browse files Browse the repository at this point in the history
* Closes pbatard#468
* Also prevent drives with UEFI:NTFS from being listed as multi-partitions
* Also add a label for the UEFI:NTFS FAT partition
* Also fix internal chver script
  • Loading branch information
pbatard committed Mar 18, 2015
1 parent ee5af9f commit 7f621b9
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 44 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
o Version 2.1 (2015.03.??)
Add 32 bit support to UEFI:NTFS boot
Add standalone UEFI:NTFS boot installation, in advanced mode
Add Vietnamese translation, courtesy of thanhtai2009
Disable support for ISOs that don't report their GRUB version (looking at you Kaspersky!)
Fix broken Windows UEFI installation when using GPT/NTFS
Fix creation of 32 bit UEFI Windows 10 installation flash drives
Other improvements

o Version 2.0 (2015.03.03)
Major UI improvements (improved font, new info field, no separate progress dialog, etc.)
Add support for Windows To Go (if Rufus is running on Windows 8 or later)
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Rufus: The Reliable USB Formatting Utility
Features:
- Formats USB flash drives as well as VHD images to FAT/FAT32/NTFS/UDF/exFAT/ReFS
- Creates DOS bootable USB drives, using FreeDOS or MS-DOS with no external files required
- Creates MBR or GPT/UEFI bootable drives
- Creates MBR or GPT/UEFI bootable drives, including UEFI bootable NTFS
- Creates bootable drives from bootable ISOs (Windows, Linux, etc.)
- Creates bootbale drives from disk images, including compressed ones
- Creates Windows To Go drives
Expand Down
2 changes: 1 addition & 1 deletion _chver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ s/^[ \t]*FILEVERSION[ \t]*.*,.*,\(.*\),\(.*\)/ FILEVERSION @@MAJOR@@,@@MINOR@@,\
s/^[ \t]*PRODUCTVERSION[ \t]*.*,.*,\(.*\),\(.*\)/ PRODUCTVERSION @@MAJOR@@,@@MINOR@@,\1,\2/
s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*".*\..*\.\(.*\)"/\1VALUE "FileVersion", "@@MAJOR@@.@@MINOR@@.\2"/
s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*".*\..*\.\(.*\)"/\1VALUE "ProductVersion", "@@MAJOR@@.@@MINOR@@.\2"/
s/^\(.*\)"Rufus \.*\.\.*\.\(.*\)\.\(.*\)"\(.*\)/\1"Rufus @@MAJOR@@.@@MINOR@@.\2.\3"\4/
s/^\(.*\)"Rufus .*\..*\.\(.*\)"\(.*\)/\1"Rufus @@MAJOR@@.@@MINOR@@.\2"\3/
_EOF

# First run sed to substitute our variable in the sed command file
Expand Down
56 changes: 28 additions & 28 deletions res/localization/rufus.loc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions res/uefi/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ o The UEFI:NTFS binaries (https://github.com/pbatard/uefi-ntfs), which were also

The FAT partition was created on Debian GNU/Linux using the following commands
dd if=/dev/zero of=uefi-ntfs.img bs=512 count=512
mkfs.vfat uefi-ntfs.img
and then mounting the `uefi-ntfs.img` and copying the relevant files.
mkfs.vfat -n UEFI_NTFS uefi-ntfs.img
and then mounting the uefi-ntfs.img image and copying the relevant files.
Binary file modified res/uefi/uefi-ntfs.img
Binary file not shown.
7 changes: 5 additions & 2 deletions src/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,8 @@ DWORD WINAPI FormatThread(void* param)
// According to Microsoft, every GPT disk (we RUN Windows from) must have an MSR due to not having hidden sectors
// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
extra_partitions = XP_MSR | XP_EFI;
else if ((fs == FS_NTFS) && (dt == DT_ISO) && (iso_report.has_efi) && ((bt == BT_UEFI) || (windows_to_go)))
else if ( (fs == FS_NTFS) && ((dt == DT_UEFI_NTFS) ||
((dt == DT_ISO) && (iso_report.has_efi) && ((bt == BT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) )
extra_partitions = XP_UEFI_NTFS;
else if (IsChecked(IDC_EXTRA_PARTITION))
extra_partitions = XP_COMPAT;
Expand Down Expand Up @@ -1803,7 +1804,9 @@ DWORD WINAPI FormatThread(void* param)
CHECK_FOR_USER_CANCEL;

if (IsChecked(IDC_BOOT)) {
if (bt == BT_UEFI) {
if (dt == DT_UEFI_NTFS) {
// All good
} else if (bt == BT_UEFI) {
// For once, no need to do anything - just check our sanity
if ( (dt != DT_ISO) || (!iso_report.has_efi) || (fs > FS_NTFS) ) {
uprintf("Spock gone crazy error!\n");
Expand Down
20 changes: 19 additions & 1 deletion src/rufus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ static BOOL BootCheck(void)
if ((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) {
if (fs != FS_NTFS) {
// Windows To Go only works for NTFS
MessageBoxU(hMainDialog, lmprintf(MSG_097), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL);
MessageBoxU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL);
return FALSE;
} else if (SelectedDrive.Geometry.MediaType != FixedMedia) {
if ((bt == BT_UEFI) && (pt == PARTITION_STYLE_GPT)) {
Expand Down Expand Up @@ -1488,6 +1488,12 @@ static BOOL BootCheck(void)
return FALSE;
}
}
} else if (dt == DT_UEFI_NTFS) {
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
if (fs != FS_NTFS) {
MessageBoxU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL);
return FALSE;
}
}
return TRUE;
}
Expand Down Expand Up @@ -1812,6 +1818,8 @@ void SetBoot(int fs, int bt)
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType,
"Grub4DOS " GRUB4DOS_VERSION), DT_GRUB4DOS));
}
if (advanced_mode)
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "UEFI:NTFS"), DT_UEFI_NTFS));
if ((!advanced_mode) && (selection_default >= DT_SYSLINUX_V4)) {
selection_default = DT_FREEDOS;
CheckDlgButton(hMainDialog, IDC_DISK_ID, BST_UNCHECKED);
Expand Down Expand Up @@ -2200,6 +2208,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SetWindowTextU(hLabel, iso_report.label);
}
} else {
if (selection_default == DT_UEFI_NTFS) {
// Try to select NTFS as default
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
fs = (int)ComboBox_GetItemData(hFileSystem, i);
if (fs == FS_NTFS)
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
}
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
ComboBox_GetCurSel(hFileSystem));
}
// Set focus on the start button
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
Expand Down
1 change: 1 addition & 0 deletions src/rufus.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ enum dos_type {
DT_REACTOS,
DT_GRUB4DOS,
DT_GRUB2,
DT_UEFI_NTFS,
DT_MAX
};

Expand Down
16 changes: 8 additions & 8 deletions src/rufus.rc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.646"
CAPTION "Rufus 2.1.647"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
Expand Down Expand Up @@ -157,7 +157,7 @@ END

IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.646"
CAPTION "Rufus 2.1.647"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
Expand Down Expand Up @@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
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
CAPTION "Rufus 2.0.646"
CAPTION "Rufus 2.1.647"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
Expand Down Expand Up @@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
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
CAPTION "Rufus 2.0.646"
CAPTION "Rufus 2.1.647"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
Expand Down Expand Up @@ -671,8 +671,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,646,0
PRODUCTVERSION 2,1,646,0
FILEVERSION 2,1,647,0
PRODUCTVERSION 2,1,647,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -689,13 +689,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.1.646"
VALUE "FileVersion", "2.1.647"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "� 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.1.646"
VALUE "ProductVersion", "2.1.647"
END
END
BLOCK "VarFileInfo"
Expand Down
12 changes: 11 additions & 1 deletion src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ BOOL GetUSBDevices(DWORD devnum)
htab_table htab_devid = HTAB_EMPTY;
StrArray dev_if_path;
char letter_name[] = " (?:)";
char uefi_togo_check[] = "?:\\EFI\\Rufus\\ntfs_x64.efi";
BOOL r = FALSE, found = FALSE, is_SCSI;
HDEVINFO dev_info = NULL;
SP_DEVINFO_DATA dev_info_data;
SP_DEVICE_INTERFACE_DATA devint_data;
PSP_DEVICE_INTERFACE_DETAIL_DATA_A devint_detail_data;
DEVINST parent_inst, device_inst;
DWORD size, i, j, k, datatype, drive_index;
DWORD size, i, j, k, l, datatype, drive_index;
ULONG list_size[ARRAYSIZE(storage_name)] = { 0 }, full_list_size, ulFlags;
HANDLE hDrive;
LONG maxwidth = 0;
Expand Down Expand Up @@ -401,6 +402,15 @@ BOOL GetUSBDevices(DWORD devnum)
entry = lmprintf(MSG_046, label, drive_number,
SizeToHumanReadable(GetDriveSize(drive_index), FALSE, use_fake_units));
} else {
// Find the UEFI:TOGO partition(s) (and eliminate them form our listing)
for (k=0; drive_letters[k]; k++) {
uefi_togo_check[0] = drive_letters[k];
if (PathFileExistsA(uefi_togo_check)) {
for (l=k; drive_letters[l]; l++)
drive_letters[l] = drive_letters[l+1];
k--;
}
}
// We have multiple volumes assigned to the same device (multiple partitions)
// If that is the case, use "Multiple Volumes" instead of the label
safe_strcpy(entry_msg, sizeof(entry_msg), ((drive_letters[0] != 0) && (drive_letters[1] != 0))?
Expand Down

0 comments on commit 7f621b9

Please sign in to comment.