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

[core] fix a conflict with Windows automount drive letter assignation

* Closes #239
This commit is contained in:
Pete Batard 2013-12-10 19:30:12 +00:00
parent 56c6b15feb
commit e899fc0e61
2 changed files with 17 additions and 5 deletions

View file

@ -598,6 +598,18 @@ BOOL UnmountVolume(HANDLE hDrive)
BOOL MountVolume(char* drive_name, char *drive_guid)
{
char mounted_guid[52]; // You need at least 51 characters on XP
char mounted_letter[16] = {0};
DWORD size;
// For fixed disks, Windows may already have remounted the volume, but with a different letter
// than the one we want. If that's the case, we need to unmount first.
if ( (GetVolumePathNamesForVolumeNameA(drive_guid, mounted_letter, sizeof(mounted_letter), &size))
&& (size > 2) && (safe_strcmp(mounted_letter, drive_name) != 0) ) {
uprintf("Volume is already mounted, but as %s instead of %s - Unmounting...\n", mounted_letter, drive_name);
if (!DeleteVolumeMountPointA(mounted_letter))
uprintf("Failed to unmount volume: %s", WindowsErrorString());
Sleep(200);
}
if (!SetVolumeMountPointA(drive_name, drive_guid)) {
// If the OS was faster than us at remounting the drive, this operation can fail

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.4.1.350"
CAPTION "Rufus v1.4.1.351"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -288,8 +288,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,1,350
PRODUCTVERSION 1,4,1,350
FILEVERSION 1,4,1,351
PRODUCTVERSION 1,4,1,351
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -306,13 +306,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.1.350"
VALUE "FileVersion", "1.4.1.351"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.1.350"
VALUE "ProductVersion", "1.4.1.351"
END
END
BLOCK "VarFileInfo"