From dd1bf3b998fb46f7a1034a5f93a3523b488a85ca Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 29 May 2018 12:54:45 +0100 Subject: [PATCH] [core] fix unable to format as FAT32 for RTL languages * This is a "stealth" update for the 3.0 release * The issue was that we are picking the UTF16 file system name from the dropdown, and where we use the "(Default)" suffixed version, it now has an RLE at the beginning which we must skip. * This prevented RTL languages from being able to format a drive as FAT32... --- res/appstore/AppxManifest.xml | 2 +- src/format.c | 14 +++++++++----- src/rufus.rc | 10 +++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/res/appstore/AppxManifest.xml b/res/appstore/AppxManifest.xml index 11628a04..241ddfc1 100644 --- a/res/appstore/AppxManifest.xml +++ b/res/appstore/AppxManifest.xml @@ -8,7 +8,7 @@ for an interesting struggle, when you also happen to have a comma in one of the fields... --> diff --git a/src/format.c b/src/format.c index d1ce5af1..c7a180ef 100644 --- a/src/format.c +++ b/src/format.c @@ -676,15 +676,17 @@ static BOOL FormatDrive(DWORD DriveIndex) BOOL r = FALSE; PF_DECL(FormatEx); PF_DECL(EnableVolumeCompression); - char FSType[32], path[MAX_PATH]; + char FSType[64], path[MAX_PATH]; char *locale, *VolumeName = NULL; WCHAR* wVolumeName = NULL; WCHAR wFSType[64]; WCHAR wLabel[64]; ULONG ulClusterSize; - size_t i; + size_t i, index; GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); + // Skip the RIGHT_TO_LEFT_EMBEDDING mark from LTR languages + index = (strncmp(FSType, RIGHT_TO_LEFT_EMBEDDING, sizeof(RIGHT_TO_LEFT_EMBEDDING) - 1) == 0) ? (sizeof(RIGHT_TO_LEFT_EMBEDDING) - 1) : 0; // Might have a (Default) suffix => remove it for (i=strlen(FSType); i>2; i--) { if (FSType[i] == '(') { @@ -693,9 +695,9 @@ static BOOL FormatDrive(DWORD DriveIndex) } } if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { - PrintInfoDebug(0, MSG_220, FSType, dur_mins, dur_secs); + PrintInfoDebug(0, MSG_220, &FSType[index], dur_mins, dur_secs); } else { - PrintInfoDebug(0, MSG_222, FSType); + PrintInfoDebug(0, MSG_222, &FSType[index]); } VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); @@ -727,6 +729,8 @@ static BOOL FormatDrive(DWORD DriveIndex) setlocale(LC_ALL, locale); GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); + // Again, skip the RIGHT_TO_LEFT_EMBEDDING mark if present + index = (wFSType[0] == 0x202b) ? 1 : 0; // We may have a " (Default)" trail for (i=0; i