[core] relax the rule for exclusive write access

* If we can't get a write handle for more than 5 seconds, retry with FILE_SHARE_WRITE
* This is a partial revert of 2f81e4f177, in order to address #924.
This commit is contained in:
Pete Batard 2017-04-09 21:05:10 +01:00
parent 2417ea7409
commit 854620d0ba
2 changed files with 9 additions and 10 deletions

View File

@ -57,7 +57,6 @@ const GUID PARTITION_SYSTEM_GUID =
* Globals
*/
RUFUS_DRIVE_INFO SelectedDrive;
extern BOOL lock_drive;
/*
* The following methods get or set the AutoMount setting (which is different from AutoRun)
@ -148,10 +147,10 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
break;
if (i == 0) {
uprintf("Waiting for access...");
} else if (!lock_drive && bWriteAccess && !bWriteShare && (i > (2*DRIVE_ACCESS_RETRIES)/3)) {
// If we can't seem to get a hold of the drive for a long time,
// and Alt-, is enabled, make a last ditch effort with FILE_SHARE_WRITE...
uprintf("Can't access %s - Retrying with write sharing enabled...");
} else if (bWriteAccess && !bWriteShare && (i > DRIVE_ACCESS_RETRIES/3)) {
// If we can't seem to get a hold of the drive for some time,
// try to enable FILE_SHARE_WRITE...
uprintf("Warning: Could not obtain exclusive rights. Retrying with write sharing enabled...");
bWriteShare = TRUE;
}
Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES);

View File

@ -33,7 +33,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
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.14.1084"
CAPTION "Rufus 2.14.1085"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,14,1084,0
PRODUCTVERSION 2,14,1084,0
FILEVERSION 2,14,1085,0
PRODUCTVERSION 2,14,1085,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.14.1084"
VALUE "FileVersion", "2.14.1085"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.14.1084"
VALUE "ProductVersion", "2.14.1085"
END
END
BLOCK "VarFileInfo"