1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] fix UEFI/BIOS mode never being disabled once enabled

* Closes #635
* Also fix minor logic issue and trailing whitespaces
This commit is contained in:
Pete Batard 2015-11-05 22:54:38 +00:00
parent 759599221c
commit 549bf731a6
4 changed files with 16 additions and 14 deletions

View file

@ -39,7 +39,7 @@
#include "localization.h" #include "localization.h"
#if !defined(PARTITION_BASIC_DATA_GUID) #if !defined(PARTITION_BASIC_DATA_GUID)
const GUID PARTITION_BASIC_DATA_GUID = const GUID PARTITION_BASIC_DATA_GUID =
{ 0xebd0a0a2L, 0xb9e5, 0x4433, {0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7} }; { 0xebd0a0a2L, 0xb9e5, 0x4433, {0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7} };
#endif #endif
#if !defined(PARTITION_MSFT_RESERVED_GUID) #if !defined(PARTITION_MSFT_RESERVED_GUID)
@ -63,7 +63,7 @@ size_t uefi_ntfs_size = 0;
* See https://github.com/pbatard/rufus/issues/386. * See https://github.com/pbatard/rufus/issues/386.
* *
* Reverse engineering diskpart and mountvol indicates that the former uses the IVdsService * Reverse engineering diskpart and mountvol indicates that the former uses the IVdsService
* ClearFlags()/SetFlags() to set VDS_SVF_AUTO_MOUNT_OFF whereas mountvol on uses * ClearFlags()/SetFlags() to set VDS_SVF_AUTO_MOUNT_OFF whereas mountvol on uses
* IOCTL_MOUNTMGR_SET_AUTO_MOUNT on "\\\\.\\MountPointManager". * IOCTL_MOUNTMGR_SET_AUTO_MOUNT on "\\\\.\\MountPointManager".
* As the latter is MUCH simpler this is what we'll use too * As the latter is MUCH simpler this is what we'll use too
*/ */
@ -156,7 +156,7 @@ out:
return hDrive; return hDrive;
} }
/* /*
* Return the path to access the physical drive, or NULL on error. * Return the path to access the physical drive, or NULL on error.
* The string is allocated and must be freed (to ensure concurrent access) * The string is allocated and must be freed (to ensure concurrent access)
*/ */
@ -172,7 +172,7 @@ out:
return (success)?safe_strdup(physical_name):NULL; return (success)?safe_strdup(physical_name):NULL;
} }
/* /*
* Return a handle to the physical drive identified by DriveIndex * Return a handle to the physical drive identified by DriveIndex
*/ */
HANDLE GetPhysicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive) HANDLE GetPhysicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive)
@ -295,7 +295,7 @@ BOOL WaitForLogical(DWORD DriveIndex)
return FALSE; return FALSE;
} }
/* /*
* Obtain a handle to the first logical volume on the disk identified by DriveIndex * Obtain a handle to the first logical volume on the disk identified by DriveIndex
* Returns INVALID_HANDLE_VALUE on error or NULL if no logical path exists (typical * Returns INVALID_HANDLE_VALUE on error or NULL if no logical path exists (typical
* of unpartitioned drives) * of unpartitioned drives)
@ -707,7 +707,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
suprintf("Cylinders: %" PRIi64 ", TracksPerCylinder: %d, SectorsPerTrack: %d\n", suprintf("Cylinders: %" PRIi64 ", TracksPerCylinder: %d, SectorsPerTrack: %d\n",
DiskGeometry->Geometry.Cylinders, DiskGeometry->Geometry.TracksPerCylinder, DiskGeometry->Geometry.SectorsPerTrack); DiskGeometry->Geometry.Cylinders, DiskGeometry->Geometry.TracksPerCylinder, DiskGeometry->Geometry.SectorsPerTrack);
r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_LAYOUT_EX,
NULL, 0, layout, sizeof(layout), &size, NULL ); NULL, 0, layout, sizeof(layout), &size, NULL );
if (!r || size <= 0) { if (!r || size <= 0) {
suprintf("Could not get layout for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString()); suprintf("Could not get layout for drive 0x%02x: %s\n", DriveIndex, WindowsErrorString());
@ -941,7 +941,7 @@ char* AltMountVolume(const char* drive_name, uint8_t part_nr)
uprintf("Could not find partition mapping for %s", target[0]); uprintf("Could not find partition mapping for %s", target[0]);
goto out; goto out;
} }
while ((--i > 0) && (isdigit(p[i]))); while ((--i > 0) && (isdigit(p[i])));
p[++i] = '0' + part_nr; p[++i] = '0' + part_nr;
p[++i] = 0; p[++i] = 0;

View file

@ -1647,7 +1647,9 @@ DWORD WINAPI FormatThread(void* param)
} }
RefreshDriveLayout(hPhysicalDrive); RefreshDriveLayout(hPhysicalDrive);
goto out; goto out;
} else if (IsChecked(IDC_BADBLOCKS)) { }
if (IsChecked(IDC_BADBLOCKS)) {
do { do {
// create a log file for bad blocks report. Since %USERPROFILE% may // create a log file for bad blocks report. Since %USERPROFILE% may
// have localized characters, we use the UTF-8 API. // have localized characters, we use the UTF-8 API.

View file

@ -3065,7 +3065,7 @@ relaunch:
// Alt-E => Enhanced installation mode (allow dual UEFI/BIOS mode and FAT32 for Windows) // Alt-E => Enhanced installation mode (allow dual UEFI/BIOS mode and FAT32 for Windows)
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'E')) { if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'E')) {
allow_dual_uefi_bios = !allow_dual_uefi_bios; allow_dual_uefi_bios = !allow_dual_uefi_bios;
WriteSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS, !allow_dual_uefi_bios); WriteSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS, allow_dual_uefi_bios);
PrintStatus2000(lmprintf(MSG_266), allow_dual_uefi_bios); PrintStatus2000(lmprintf(MSG_266), allow_dual_uefi_bios);
SetMBRForUEFI(TRUE); SetMBRForUEFI(TRUE);
continue; continue;

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.6.803" CAPTION "Rufus 2.6.804"
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
@ -319,8 +319,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,6,803,0 FILEVERSION 2,6,804,0
PRODUCTVERSION 2,6,803,0 PRODUCTVERSION 2,6,804,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -337,13 +337,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.6.803" VALUE "FileVersion", "2.6.804"
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.6.803" VALUE "ProductVersion", "2.6.804"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"