[misc] add a cheat mode to not lock the physical drive during partitioning and formatting

* In some circumstances, this *might* help with the infamous #312 issue, though
  I will still recommend to figure out which application is keeping a lock instead
  of trying to cheat...
This commit is contained in:
Pete Batard 2015-10-01 22:22:20 +01:00
parent 4a5aa4bd2f
commit af53d11718
6 changed files with 18 additions and 9 deletions

View File

@ -538,6 +538,7 @@ t MSG_278 "Boot type"
t MSG_279 "Non bootable"
t MSG_280 "Image selection"
t MSG_281 "(Please select an image)"
t MSG_282 "Drive locking"
################################################################################
############################# TRANSLATOR END COPY ##############################

View File

@ -59,7 +59,7 @@ static int task_number = 0;
extern const int nb_steps[FS_MAX];
extern uint32_t dur_mins, dur_secs;
static int fs_index = 0;
extern BOOL force_large_fat32, enable_ntfs_compression;
extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive;
uint8_t *grub2_buf = NULL;
long grub2_len;
static BOOL WritePBR(HANDLE hLogicalDrive);
@ -1522,7 +1522,7 @@ DWORD WINAPI FormatThread(void* param)
extra_partitions = XP_COMPAT;
PrintInfoDebug(0, MSG_225);
hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE);
hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, lock_drive);
if (hPhysicalDrive == INVALID_HANDLE_VALUE) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED;
goto out;

View File

@ -391,6 +391,7 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_279),
LOC_CTRL(MSG_280),
LOC_CTRL(MSG_281),
LOC_CTRL(MSG_282),
LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL),

View File

@ -429,7 +429,8 @@
#define MSG_279 3279
#define MSG_280 3280
#define MSG_281 3281
#define MSG_MAX 3282
#define MSG_282 3282
#define MSG_MAX 3283
// Next default values for new objects
//

View File

@ -138,7 +138,7 @@ HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar;
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode;
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE;
BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE;
BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps;
int dialog_showing = 0, lang_button_id = 0;
uint16_t rufus_version[3], embedded_sl_version[2];
@ -3018,6 +3018,12 @@ relaunch:
GetUSBDevices(0);
continue;
}
// Alt-, => Disable physical drive locking
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == VK_OEM_COMMA)) {
lock_drive = !lock_drive;
PrintStatus2000(lmprintf(MSG_282), lock_drive);
continue;
}
// Alt-B => Toggle fake drive detection during bad blocks check
// By default, Rufus will check for fake USB flash drives that mistakenly present
// more capacity than they already have by looping over the flash. This check which

View File

@ -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.5.762"
CAPTION "Rufus 2.5.763"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -319,8 +319,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,5,762,0
PRODUCTVERSION 2,5,762,0
FILEVERSION 2,5,763,0
PRODUCTVERSION 2,5,763,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -337,13 +337,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.5.762"
VALUE "FileVersion", "2.5.763"
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.5.762"
VALUE "ProductVersion", "2.5.763"
END
END
BLOCK "VarFileInfo"