[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

@ -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;