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

[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...
This commit is contained in:
Pete Batard 2018-05-29 12:54:45 +01:00
parent 98ada80b1b
commit dd1bf3b998
3 changed files with 15 additions and 11 deletions

View file

@ -8,7 +8,7 @@
for an interesting struggle, when you also happen to have a comma in one of the fields... --> for an interesting struggle, when you also happen to have a comma in one of the fields... -->
<Identity <Identity
Name="Rufus" Name="Rufus"
Version="3.0.1303.0" Version="3.0.1304.0"
ProcessorArchitecture="x86" ProcessorArchitecture="x86"
Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' /> Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' />
<Properties> <Properties>

View file

@ -676,15 +676,17 @@ static BOOL FormatDrive(DWORD DriveIndex)
BOOL r = FALSE; BOOL r = FALSE;
PF_DECL(FormatEx); PF_DECL(FormatEx);
PF_DECL(EnableVolumeCompression); PF_DECL(EnableVolumeCompression);
char FSType[32], path[MAX_PATH]; char FSType[64], path[MAX_PATH];
char *locale, *VolumeName = NULL; char *locale, *VolumeName = NULL;
WCHAR* wVolumeName = NULL; WCHAR* wVolumeName = NULL;
WCHAR wFSType[64]; WCHAR wFSType[64];
WCHAR wLabel[64]; WCHAR wLabel[64];
ULONG ulClusterSize; ULONG ulClusterSize;
size_t i; size_t i, index;
GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); 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 // Might have a (Default) suffix => remove it
for (i=strlen(FSType); i>2; i--) { for (i=strlen(FSType); i>2; i--) {
if (FSType[i] == '(') { if (FSType[i] == '(') {
@ -693,9 +695,9 @@ static BOOL FormatDrive(DWORD DriveIndex)
} }
} }
if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { 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 { } else {
PrintInfoDebug(0, MSG_222, FSType); PrintInfoDebug(0, MSG_222, &FSType[index]);
} }
VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE);
wVolumeName = utf8_to_wchar(VolumeName); wVolumeName = utf8_to_wchar(VolumeName);
@ -727,6 +729,8 @@ static BOOL FormatDrive(DWORD DriveIndex)
setlocale(LC_ALL, locale); setlocale(LC_ALL, locale);
GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); 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 // We may have a " (Default)" trail
for (i=0; i<wcslen(wFSType); i++) { for (i=0; i<wcslen(wFSType); i++) {
if (wFSType[i] == ' ') { if (wFSType[i] == ' ') {
@ -750,7 +754,7 @@ static BOOL FormatDrive(DWORD DriveIndex)
fs_index = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs_index = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
uprintf("%s format was selected\n", IsChecked(IDC_QUICK_FORMAT)?"Quick":"Slow"); uprintf("%s format was selected\n", IsChecked(IDC_QUICK_FORMAT)?"Quick":"Slow");
pfFormatEx(wVolumeName, SelectedDrive.MediaType, wFSType, wLabel, pfFormatEx(wVolumeName, SelectedDrive.MediaType, &wFSType[index], wLabel,
IsChecked(IDC_QUICK_FORMAT), ulClusterSize, FormatExCallback); IsChecked(IDC_QUICK_FORMAT), ulClusterSize, FormatExCallback);
if ((fs == FS_NTFS) && (enable_ntfs_compression) && (pfEnableVolumeCompression != NULL)) { if ((fs == FS_NTFS) && (enable_ntfs_compression) && (pfEnableVolumeCompression != NULL)) {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.0.1303" CAPTION "Rufus 3.0.1304"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -389,8 +389,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,1303,0 FILEVERSION 3,0,1304,0
PRODUCTVERSION 3,0,1303,0 PRODUCTVERSION 3,0,1304,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -407,13 +407,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.0.1303" VALUE "FileVersion", "3.0.1304"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.0.1303" VALUE "ProductVersion", "3.0.1304"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"