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

[loc] fix various RTL issues

* MSG_002 doesn't display in RTL
* Update Policy dialog loses RTL setting after the first paragraph
* Some text displayed in native Windows message boxes is not using RTL
 (even as the Message Box itself will display the rest of the UI elements as RTL)
* Detect if the relevant language pack is installed and use MessageBoxEx to
  display native message box buttons using the selected language.
* All theses issues are part of #621
* Also remove trailing whitespaces
This commit is contained in:
Pete Batard 2015-10-18 21:31:47 +01:00
parent 236bf77c24
commit e1f8b276c8
12 changed files with 190 additions and 110 deletions

View file

@ -2,7 +2,8 @@ o Version 2.5 (2015.10.??)
Add SHA-256 checksum verification Add SHA-256 checksum verification
Add a cheat mode to disable exclusive USB drive locking (Alt-,) Add a cheat mode to disable exclusive USB drive locking (Alt-,)
Add digital signature check on update downloads Add digital signature check on update downloads
Report Windows build number in the log (for Windows 8 and later) Report Windows build number in the log (Windows 8 or later)
Localization improvements
Additional translation updates Additional translation updates
o Version 2.4 (2015.09.27) o Version 2.4 (2015.09.27)

View file

@ -1635,8 +1635,8 @@ DWORD WINAPI FormatThread(void* param)
fprintf(log_fd, APPLICATION_NAME " bad blocks check ended on: %04d.%02d.%02d %02d:%02d:%02d\n", fprintf(log_fd, APPLICATION_NAME " bad blocks check ended on: %04d.%02d.%02d %02d:%02d:%02d\n",
lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond); lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond);
fclose(log_fd); fclose(log_fd);
r = MessageBoxU(hMainDialog, lmprintf(MSG_012, bb_msg, logfile), r = MessageBoxExU(hMainDialog, lmprintf(MSG_012, bb_msg, logfile),
lmprintf(MSG_010), MB_ABORTRETRYIGNORE|MB_ICONWARNING|MB_IS_RTL); lmprintf(MSG_010), MB_ABORTRETRYIGNORE|MB_ICONWARNING|MB_IS_RTL, selected_langid);
} else { } else {
// We didn't get any errors => delete the log file // We didn't get any errors => delete the log file
fclose(log_fd); fclose(log_fd);

View file

@ -124,12 +124,12 @@ const char* additional_copyrights =
"All other references can be found in the source.\\line\n}"; "All other references can be found in the source.\\line\n}";
const char* update_policy = const char* update_policy =
"{\\rtf1\\ansi{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}{\\f1\\fnil\\fcharset2 Symbol;}}\n" "{\\rtf1\\ansi{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}\n"
"\\fs16\\b %s\\b0\\line\n" "\\fs16\\b %s\\b0\\line\n"
"%s\\par\n" "%s\\par\n"
"\\pard{\\pntext\\f1\\'B7\\tab}{\\*\\pn\\pnlvlblt\\pnf2\\pnindent0{\\pntxtb\\'B7}}\\fi-150\\li220 %s\\par\n" "\\fs20•\\fs16 %s\\par\n"
"{\\pntext\\f1\\'B7\\tab}%s\\par\n" "\\fs20•\\fs16 %s\\par\n"
"{\\pntext\\f1\\'B7\\tab}%s\\line\\pard\n" "\\fs20•\\fs16 %s\\line\n"
"\\line\n" "\\line\n"
"%s\\line\n\\line\n" "%s\\line\n\\line\n"
"\\b %s\\b0\\line\n" "\\b %s\\b0\\line\n"

View file

@ -573,3 +573,53 @@ const char* get_name_from_id(int id)
} }
return "UNKNOWN ID"; return "UNKNOWN ID";
} }
/*
* This call is used to get a supported Windows Language identifier we
* should pass to MessageBoxEx to try to get the buttons displayed in
* the currently selected language. This relies on the relevant language
* pack having been installed.
*/
static BOOL found_lang;
static BOOL CALLBACK EnumUILanguagesProc(LPTSTR lpUILanguageString, LONG_PTR lParam)
{
wchar_t* wlang = (wchar_t*)lParam;
if (wcscmp(wlang, lpUILanguageString) == 0)
found_lang = TRUE;
return TRUE;
}
WORD get_language_id(loc_cmd* lcmd)
{
int i;
wchar_t wlang[5];
LANGID lang_id = GetUserDefaultUILanguage();
if (lcmd == NULL)
return MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
// Find if the selected language is the user default
for (i = 0; i<lcmd->unum_size; i++) {
if (lcmd->unum[i] == lang_id) {
uprintf("localization: will use default UI language 0x%04X", lang_id);
return MAKELANGID(lang_id, SUBLANG_DEFAULT);
}
}
// Selected language is not user default - find if a language pack is installed for it
found_lang = FALSE;
for (i = 0; (i<lcmd->unum_size); i++) {
// Always uppercase
swprintf_s(wlang, ARRAYSIZE(wlang), L"%04X", lcmd->unum[i]);
// This callback enumeration from Microsoft is retarded. Now we need a global
// boolean to tell us that we found what we were after.
EnumUILanguages(EnumUILanguagesProc, 0x4, (LONG_PTR)wlang); // 0x04 = MUI_LANGUAGE_ID
if (found_lang) {
uprintf("localization: will use installed language pack for 0x%04X", lcmd->unum[i]);
return MAKELANGID(lcmd->unum[i], SUBLANG_DEFAULT);
}
}
uprintf("localization: no matching language pack - some messages will be displayed using default locale");
return MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
}

View file

@ -174,3 +174,4 @@ loc_cmd* get_locale_from_lcid(int lcid, BOOL fallback);
loc_cmd* get_locale_from_name(char* locale_name, BOOL fallback); loc_cmd* get_locale_from_name(char* locale_name, BOOL fallback);
void toggle_default_locale(void); void toggle_default_locale(void);
const char* get_name_from_id(int id); const char* get_name_from_id(int id);
WORD get_language_id(loc_cmd* lcmd);

View file

@ -209,6 +209,20 @@ static __inline int MessageBoxU(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT
return ret; return ret;
} }
static __inline int MessageBoxExU(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId)
{
int ret;
DWORD err = ERROR_INVALID_DATA;
wconvert(lpText);
wconvert(lpCaption);
ret = MessageBoxExW(hWnd, wlpText, wlpCaption, uType, wLanguageId);
err = GetLastError();
wfree(lpText);
wfree(lpCaption);
SetLastError(err);
return ret;
}
static __inline int DrawTextU(HDC hDC, LPCSTR lpText, int nCount, LPRECT lpRect, UINT uFormat) static __inline int DrawTextU(HDC hDC, LPCSTR lpText, int nCount, LPRECT lpRect, UINT uFormat)
{ {
int ret; int ret;

View file

@ -386,8 +386,8 @@ out:
if (PromptOnError) { if (PromptOnError) {
PrintInfo(0, MSG_242); PrintInfo(0, MSG_242);
SetLastError(error_code); SetLastError(error_code);
MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(), MessageBoxExU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(),
lmprintf(MSG_044), MB_OK|MB_ICONERROR|MB_IS_RTL); lmprintf(MSG_044), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
} }
} }
if (hRequest) InternetCloseHandle(hRequest); if (hRequest) InternetCloseHandle(hRequest);

View file

@ -145,7 +145,7 @@ LONG ValidateSignature(HWND hDlg, const char* path)
signature_name = GetSignatureName(path); signature_name = GetSignatureName(path);
if (signature_name == NULL) { if (signature_name == NULL) {
uprintf("PKI: Could not get signature name"); uprintf("PKI: Could not get signature name");
MessageBoxU(hDlg, lmprintf(MSG_284), lmprintf(MSG_283), MB_OK | MB_ICONERROR | MB_IS_RTL); MessageBoxExU(hDlg, lmprintf(MSG_284), lmprintf(MSG_283), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
return TRUST_E_NOSIGNATURE; return TRUST_E_NOSIGNATURE;
} }
for (i = 0; i < ARRAYSIZE(valid_cert_names); i++) { for (i = 0; i < ARRAYSIZE(valid_cert_names); i++) {
@ -158,8 +158,8 @@ LONG ValidateSignature(HWND hDlg, const char* path)
} }
if (i >= ARRAYSIZE(valid_cert_names)) { if (i >= ARRAYSIZE(valid_cert_names)) {
uprintf("PKI: Signature '%s' is unexpected...", signature_name); uprintf("PKI: Signature '%s' is unexpected...", signature_name);
if (MessageBoxU(hDlg, lmprintf(MSG_285, signature_name), lmprintf(MSG_283), if (MessageBoxExU(hDlg, lmprintf(MSG_285, signature_name), lmprintf(MSG_283),
MB_YESNO | MB_ICONWARNING | MB_IS_RTL) != IDYES) MB_YESNO | MB_ICONWARNING | MB_IS_RTL, selected_langid) != IDYES)
return TRUST_E_EXPLICIT_DISTRUST; return TRUST_E_EXPLICIT_DISTRUST;
} }

View file

@ -134,6 +134,7 @@ char* image_path = NULL;
float fScale = 1.0f; float fScale = 1.0f;
int default_fs; int default_fs;
uint32_t dur_mins, dur_secs; uint32_t dur_mins, dur_secs;
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar; HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar;
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode; BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode;
@ -944,7 +945,8 @@ static void CALLBACK BlockingTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD
// A write or close operation hasn't made any progress since our last check // A write or close operation hasn't made any progress since our last check
user_notified = TRUE; user_notified = TRUE;
uprintf("Blocking I/O operation detected\n"); uprintf("Blocking I/O operation detected\n");
MessageBoxU(hMainDialog, lmprintf(MSG_080), lmprintf(MSG_048), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_080), lmprintf(MSG_048),
MB_OK|MB_ICONINFORMATION|MB_IS_RTL, selected_langid);
} else { } else {
last_iso_blocking_status = iso_blocking_status; last_iso_blocking_status = iso_blocking_status;
} }
@ -1058,7 +1060,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
PrintInfo(0, MSG_081); PrintInfo(0, MSG_081);
safe_free(image_path); safe_free(image_path);
EnableWindow(hStatusToolbar, FALSE); EnableWindow(hStatusToolbar, FALSE);
MessageBoxU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_082), lmprintf(MSG_081), MB_OK|MB_ICONINFORMATION|MB_IS_RTL, selected_langid);
PrintStatus(0, MSG_086); PrintStatus(0, MSG_086);
SetMBRProps(); SetMBRProps();
} else { } else {
@ -1284,18 +1286,18 @@ static BOOL BootCheck(void)
if ((bt == BT_ISO) || (bt == BT_IMG)) { if ((bt == BT_ISO) || (bt == BT_IMG)) {
if (image_path == NULL) { if (image_path == NULL) {
// Please click on the disc button to select a bootable ISO // Please click on the disc button to select a bootable ISO
MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) {
// This ISO image is too big for the selected target // This ISO image is too big for the selected target
MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
if (bt == BT_IMG) { if (bt == BT_IMG) {
if (!img_report.is_bootable_img) if (!img_report.is_bootable_img)
// The selected image doesn't match the boot option selected. // The selected image doesn't match the boot option selected.
MessageBoxU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return (img_report.is_bootable_img); return (img_report.is_bootable_img);
} }
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
@ -1303,29 +1305,29 @@ static BOOL BootCheck(void)
if ((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) { if ((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) {
if (fs != FS_NTFS) { if (fs != FS_NTFS) {
// Windows To Go only works for NTFS // Windows To Go only works for NTFS
MessageBoxU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} else if (SelectedDrive.Geometry.MediaType != FixedMedia) { } else if (SelectedDrive.Geometry.MediaType != FixedMedia) {
if ((tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) { if ((tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) {
// We're screwed since we need access to 2 partitions at the same time to set this, which // We're screwed since we need access to 2 partitions at the same time to set this, which
// Windows can't do. Cue in Arthur's Theme: "♫ I know it's stupid... but it's true. ♫" // Windows can't do. Cue in Arthur's Theme: "♫ I know it's stupid... but it's true. ♫"
MessageBoxU(hMainDialog, lmprintf(MSG_198), lmprintf(MSG_190), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_198), lmprintf(MSG_190), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
// I never had any success with drives that have the REMOVABLE attribute set, no matter the // I never had any success with drives that have the REMOVABLE attribute set, no matter the
// method or tool I tried. If you manage to get this working, I'd like to hear from you! // method or tool I tried. If you manage to get this working, I'd like to hear from you!
if (MessageBoxU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190), MB_YESNO|MB_ICONWARNING|MB_IS_RTL) != IDYES) if (MessageBoxExU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190), MB_YESNO|MB_ICONWARNING|MB_IS_RTL, selected_langid) != IDYES)
return FALSE; return FALSE;
} }
} else if (tt == TT_UEFI) { } else if (tt == TT_UEFI) {
if (!img_report.has_efi) { if (!img_report.has_efi) {
// Unsupported ISO // Unsupported ISO
MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
if (IS_WIN7_EFI(img_report) && (!WimExtractCheck())) { if (IS_WIN7_EFI(img_report) && (!WimExtractCheck())) {
// Your platform cannot extract files from WIM archives => download 7-zip? // Your platform cannot extract files from WIM archives => download 7-zip?
if (MessageBoxU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL) == IDYES) if (MessageBoxExU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL, selected_langid) == IDYES)
ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL);
return FALSE; return FALSE;
} }
@ -1333,16 +1335,16 @@ static BOOL BootCheck(void)
|| ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && (!img_report.has_efi) && || ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && (!img_report.has_efi) &&
(!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!IS_GRUB(img_report))) ) { (!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!IS_GRUB(img_report))) ) {
// Incompatible FS and ISO // Incompatible FS and ISO
MessageBoxU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} else if ((fs == FS_FAT16) && (img_report.has_kolibrios)) { } else if ((fs == FS_FAT16) && (img_report.has_kolibrios)) {
// KolibriOS doesn't support FAT16 // KolibriOS doesn't support FAT16
MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
if ((IS_FAT(fs)) && (img_report.has_4GB_file)) { if ((IS_FAT(fs)) && (img_report.has_4GB_file)) {
// This ISO image contains a file larger than 4GB file (FAT32) // This ISO image contains a file larger than 4GB file (FAT32)
MessageBoxU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
@ -1371,8 +1373,8 @@ static BOOL BootCheck(void)
} }
fclose(fd); fclose(fd);
} else { } else {
r = MessageBoxU(hMainDialog, lmprintf(MSG_116, img_report.grub2_version, GRUB2_PACKAGE_VERSION), r = MessageBoxExU(hMainDialog, lmprintf(MSG_116, img_report.grub2_version, GRUB2_PACKAGE_VERSION),
lmprintf(MSG_115), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); lmprintf(MSG_115), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid);
if (r == IDCANCEL) if (r == IDCANCEL)
return FALSE; return FALSE;
else if (r == IDYES) { else if (r == IDYES) {
@ -1420,8 +1422,8 @@ static BOOL BootCheck(void)
use_own_c32[i] = TRUE; use_own_c32[i] = TRUE;
} else { } else {
PrintInfo(0, MSG_204, old_c32_name[i]); PrintInfo(0, MSG_204, old_c32_name[i]);
if (MessageBoxU(hMainDialog, lmprintf(MSG_084, old_c32_name[i], old_c32_name[i]), if (MessageBoxExU(hMainDialog, lmprintf(MSG_084, old_c32_name[i], old_c32_name[i]),
lmprintf(MSG_083, old_c32_name[i]), MB_YESNO|MB_ICONWARNING|MB_IS_RTL) == IDYES) { lmprintf(MSG_083, old_c32_name[i]), MB_YESNO|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDYES) {
static_sprintf(tmp, "%s-%s", syslinux, embedded_sl_version_str[0]); static_sprintf(tmp, "%s-%s", syslinux, embedded_sl_version_str[0]);
IGNORE_RETVAL(_mkdir(tmp)); IGNORE_RETVAL(_mkdir(tmp));
static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, syslinux, embedded_sl_version_str[0], old_c32_name[i]); static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, syslinux, embedded_sl_version_str[0], old_c32_name[i]);
@ -1458,9 +1460,9 @@ static BOOL BootCheck(void)
ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux, ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], FILES_DIR, syslinux,
img_report.sl_version_str, img_report.sl_version_ext); img_report.sl_version_str, img_report.sl_version_ext);
} else { } else {
r = MessageBoxU(hMainDialog, lmprintf(MSG_114, img_report.sl_version_str, img_report.sl_version_ext, r = MessageBoxExU(hMainDialog, lmprintf(MSG_114, img_report.sl_version_str, img_report.sl_version_ext,
embedded_sl_version_str[1], embedded_sl_version_ext[1]), embedded_sl_version_str[1], embedded_sl_version_ext[1]),
lmprintf(MSG_115), MB_YESNO|MB_ICONWARNING|MB_IS_RTL); lmprintf(MSG_115), MB_YESNO|MB_ICONWARNING|MB_IS_RTL, selected_langid);
if (r != IDYES) if (r != IDYES)
return FALSE; return FALSE;
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
@ -1513,8 +1515,8 @@ static BOOL BootCheck(void)
static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[2]); static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[2]);
PrintInfo(0, MSG_206, tmp); PrintInfo(0, MSG_206, tmp);
// MSG_104: "Syslinux v5.0 or later requires a '%s' file to be installed" // MSG_104: "Syslinux v5.0 or later requires a '%s' file to be installed"
r = MessageBoxU(hMainDialog, lmprintf(MSG_104, "Syslinux v5.0", tmp, "Syslinux v5+", tmp), r = MessageBoxExU(hMainDialog, lmprintf(MSG_104, "Syslinux v5.0", tmp, "Syslinux v5+", tmp),
lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid);
if (r == IDCANCEL) if (r == IDCANCEL)
return FALSE; return FALSE;
if (r == IDYES) { if (r == IDYES) {
@ -1529,7 +1531,7 @@ static BOOL BootCheck(void)
} else if (bt == BT_MSDOS) { } else if (bt == BT_MSDOS) {
if ((size_check) && (ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)) >= 65536)) { if ((size_check) && (ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)) >= 65536)) {
// MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size // MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size
MessageBoxU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
} else if (bt == BT_GRUB4DOS) { } else if (bt == BT_GRUB4DOS) {
@ -1544,8 +1546,8 @@ static BOOL BootCheck(void)
} else { } else {
static_sprintf(tmp, "grldr"); static_sprintf(tmp, "grldr");
PrintInfo(0, MSG_206, tmp); PrintInfo(0, MSG_206, tmp);
r = MessageBoxU(hMainDialog, lmprintf(MSG_104, "Grub4DOS 0.4", tmp, "Grub4DOS", tmp), r = MessageBoxExU(hMainDialog, lmprintf(MSG_104, "Grub4DOS 0.4", tmp, "Grub4DOS", tmp),
lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); lmprintf(MSG_103, tmp), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid);
if (r == IDCANCEL) if (r == IDCANCEL)
return FALSE; return FALSE;
if (r == IDYES) { if (r == IDYES) {
@ -1561,7 +1563,7 @@ static BOOL BootCheck(void)
} else if (bt == BT_UEFI_NTFS) { } else if (bt == BT_UEFI_NTFS) {
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
if (fs != FS_NTFS) { if (fs != FS_NTFS) {
MessageBoxU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
return FALSE; return FALSE;
} }
} }
@ -1743,7 +1745,7 @@ void InitDialog(HWND hDlg)
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG));
SetComboEntry(hBootType, selection_default); SetComboEntry(hBootType, selection_default);
// Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody") // Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody")
IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_MARK "0x80")), 0x80)); IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_EMBEDDING "0x80" POP_DIRECTIONAL_FORMATTING)), 0x80));
for (i=1; i<=7; i++) { for (i=1; i<=7; i++) {
IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_109, 0x80+i, i+1)), 0x80+i)); IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_109, 0x80+i, i+1)), 0x80+i));
} }
@ -1919,7 +1921,7 @@ void ShowLanguageMenu(RECT rcExclude)
str = safe_strdup(lcmd->txt[1]); str = safe_strdup(lcmd->txt[1]);
l = strtok(str, search); l = strtok(str, search);
r = strtok(NULL, search); r = strtok(NULL, search);
static_sprintf(lang, LEFT_TO_RIGHT_MARK "(%s) " LEFT_TO_RIGHT_MARK "%s", r, l); static_sprintf(lang, LEFT_TO_RIGHT_EMBEDDING "(%s) " POP_DIRECTIONAL_FORMATTING "%s", r, l);
safe_free(str); safe_free(str);
} else { } else {
safe_strcpy(lang, sizeof(lang), lcmd->txt[1]); safe_strcpy(lang, sizeof(lang), lcmd->txt[1]);
@ -2051,6 +2053,7 @@ void SaveVHD(void)
} }
} }
/* /*
* Main dialog callback * Main dialog callback
*/ */
@ -2186,6 +2189,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (i++ == selected_language) { if (i++ == selected_language) {
if (selected_locale != lcmd) { if (selected_locale != lcmd) {
selected_locale = lcmd; selected_locale = lcmd;
selected_langid = get_language_id(lcmd);
relaunch = TRUE; relaunch = TRUE;
PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0); PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0);
} }
@ -2199,8 +2203,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
PF_INIT(SHChangeNotifyDeregister, Shell32); PF_INIT(SHChangeNotifyDeregister, Shell32);
EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE); EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
if (format_thid != NULL) { if (format_thid != NULL) {
if ((no_confirmation_on_cancel) || (MessageBoxU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049), if ((no_confirmation_on_cancel) || (MessageBoxExU(hMainDialog, lmprintf(MSG_105), lmprintf(MSG_049),
MB_YESNO|MB_ICONWARNING|MB_IS_RTL) == IDYES)) { MB_YESNO|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDYES)) {
// Operation may have completed in the meantime // Operation may have completed in the meantime
if (format_thid != NULL) { if (format_thid != NULL) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED;
@ -2463,7 +2467,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (dur_secs > UDF_FORMAT_WARN) { if (dur_secs > UDF_FORMAT_WARN) {
dur_mins = dur_secs/60; dur_mins = dur_secs/60;
dur_secs -= dur_mins*60; dur_secs -= dur_mins*60;
MessageBoxU(hMainDialog, lmprintf(MSG_112, dur_mins, dur_secs), lmprintf(MSG_113), MB_OK|MB_ICONASTERISK|MB_IS_RTL); MessageBoxExU(hMainDialog, lmprintf(MSG_112, dur_mins, dur_secs), lmprintf(MSG_113),
MB_OK|MB_ICONASTERISK|MB_IS_RTL, selected_langid);
} else { } else {
dur_secs = 0; dur_secs = 0;
dur_mins = 0; dur_mins = 0;
@ -2487,19 +2492,19 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
} }
GetWindowTextU(hDeviceList, tmp, ARRAYSIZE(tmp)); GetWindowTextU(hDeviceList, tmp, ARRAYSIZE(tmp));
if (MessageBoxU(hMainDialog, lmprintf(MSG_003, tmp), if (MessageBoxExU(hMainDialog, lmprintf(MSG_003, tmp),
APPLICATION_NAME, MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL) == IDCANCEL) { APPLICATION_NAME, MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL) {
format_op_in_progress = FALSE; format_op_in_progress = FALSE;
break; break;
} }
if ((SelectedDrive.nPartitions > 1) && (MessageBoxU(hMainDialog, lmprintf(MSG_093), if ((SelectedDrive.nPartitions > 1) && (MessageBoxExU(hMainDialog, lmprintf(MSG_093),
lmprintf(MSG_094), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL) == IDCANCEL)) { lmprintf(MSG_094), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL)) {
format_op_in_progress = FALSE; format_op_in_progress = FALSE;
break; break;
} }
if ((IsChecked(IDC_BOOT)) && (SelectedDrive.Geometry.BytesPerSector != 512) && if ((IsChecked(IDC_BOOT)) && (SelectedDrive.Geometry.BytesPerSector != 512) &&
(MessageBoxU(hMainDialog, lmprintf(MSG_196, SelectedDrive.Geometry.BytesPerSector), (MessageBoxExU(hMainDialog, lmprintf(MSG_196, SelectedDrive.Geometry.BytesPerSector),
lmprintf(MSG_197), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL) == IDCANCEL)) { lmprintf(MSG_197), MB_OKCANCEL|MB_ICONWARNING|MB_IS_RTL, selected_langid) == IDCANCEL)) {
format_op_in_progress = FALSE; format_op_in_progress = FALSE;
break; break;
} }
@ -2897,6 +2902,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// Init localization // Init localization
init_localization(); init_localization();
// Seek for a loc file in the current directory // Seek for a loc file in the current directory
if (GetFileAttributesU(rufus_loc) == INVALID_FILE_ATTRIBUTES) { if (GetFileAttributesU(rufus_loc) == INVALID_FILE_ATTRIBUTES) {
uprintf("loc file not found in current directory - embedded one will be used"); uprintf("loc file not found in current directory - embedded one will be used");
@ -2928,9 +2934,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|| ((selected_locale = ((locale_name == NULL)?get_locale_from_lcid(lcid, TRUE):get_locale_from_name(locale_name, TRUE))) == NULL) ) { || ((selected_locale = ((locale_name == NULL)?get_locale_from_lcid(lcid, TRUE):get_locale_from_name(locale_name, TRUE))) == NULL) ) {
uprintf("FATAL: Could not access locale!\n"); uprintf("FATAL: Could not access locale!\n");
MessageBoxU(NULL, "The locale data is missing or invalid. This application will now exit.", MessageBoxU(NULL, "The locale data is missing or invalid. This application will now exit.",
"Fatal error", MB_ICONSTOP|MB_IS_RTL|MB_SYSTEMMODAL); "Fatal error", MB_ICONSTOP|MB_SYSTEMMODAL);
goto out; goto out;
} }
selected_langid = get_language_id(selected_locale);
// Prevent 2 applications from running at the same time, unless "/W" is passed as an option // Prevent 2 applications from running at the same time, unless "/W" is passed as an option
// in which case we wait for the mutex to be relinquished // in which case we wait for the mutex to be relinquished
@ -2945,8 +2952,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if ((mutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) { if ((mutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) {
// Load the translation before we print the error // Load the translation before we print the error
get_loc_data_file(loc_file, selected_locale); get_loc_data_file(loc_file, selected_locale);
right_to_left_mode = ((selected_locale->ctrl_id) & LOC_RIGHT_TO_LEFT);
// Set MB_SYSTEMMODAL to prevent Far Manager from stealing focus... // Set MB_SYSTEMMODAL to prevent Far Manager from stealing focus...
MessageBoxU(NULL, lmprintf(MSG_002), lmprintf(MSG_001), MB_ICONSTOP|MB_IS_RTL|MB_SYSTEMMODAL); MessageBoxExU(NULL, lmprintf(MSG_002), lmprintf(MSG_001), MB_ICONSTOP|MB_IS_RTL|MB_SYSTEMMODAL, selected_langid);
goto out; goto out;
} }
@ -2993,7 +3001,8 @@ relaunch:
*/ */
hDlg = MyCreateDialog(hInstance, IDD_DIALOG, NULL, MainCallback); hDlg = MyCreateDialog(hInstance, IDD_DIALOG, NULL, MainCallback);
if (hDlg == NULL) { if (hDlg == NULL) {
MessageBoxU(NULL, "Could not create Window", "DialogBox failure", MB_ICONSTOP|MB_IS_RTL|MB_SYSTEMMODAL); MessageBoxExU(NULL, "Could not create Window", "DialogBox failure",
MB_ICONSTOP|MB_IS_RTL|MB_SYSTEMMODAL, selected_langid);
goto out; goto out;
} }
if ((relaunch_rc.left > -65536) && (relaunch_rc.top > -65536)) if ((relaunch_rc.left > -65536) && (relaunch_rc.top > -65536))

View file

@ -41,8 +41,12 @@
#define APPLICATION_NAME "Rufus" #define APPLICATION_NAME "Rufus"
#define COMPANY_NAME "Akeo Consulting" #define COMPANY_NAME "Akeo Consulting"
#define STR_NO_LABEL "NO_LABEL" #define STR_NO_LABEL "NO_LABEL"
#define LEFT_TO_RIGHT_MARK "" // Yes, there is a character between the quotes! // Yes, there is a character between these seemingly empty quotes!
#define RIGHT_TO_LEFT_MARK "" // Yes, there is a character between the quotes! #define LEFT_TO_RIGHT_MARK ""
#define RIGHT_TO_LEFT_MARK ""
#define LEFT_TO_RIGHT_EMBEDDING ""
#define RIGHT_TO_LEFT_EMBEDDING ""
#define POP_DIRECTIONAL_FORMATTING ""
#define DRIVE_ACCESS_TIMEOUT 15000 // How long we should retry drive access (in ms) #define DRIVE_ACCESS_TIMEOUT 15000 // How long we should retry drive access (in ms)
#define DRIVE_ACCESS_RETRIES 60 // How many times we should retry #define DRIVE_ACCESS_RETRIES 60 // How many times we should retry
#define DRIVE_INDEX_MIN 0x00000080 #define DRIVE_INDEX_MIN 0x00000080
@ -81,7 +85,7 @@
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#endif #endif
#define IsChecked(CheckBox_ID) (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED) #define IsChecked(CheckBox_ID) (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED)
#define MB_IS_RTL (right_to_left_mode?MB_RTLREADING:0) #define MB_IS_RTL (right_to_left_mode?MB_RTLREADING|MB_RIGHT:0)
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out #define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out
#define safe_free(p) do {free((void*)p); p = NULL;} while(0) #define safe_free(p) do {free((void*)p); p = NULL;} while(0)
@ -377,6 +381,7 @@ extern char WindowsVersionStr[128];
extern char embedded_sl_version_str[2][12]; extern char embedded_sl_version_str[2][12];
extern RUFUS_UPDATE update; extern RUFUS_UPDATE update;
extern int dialog_showing; extern int dialog_showing;
extern WORD selected_langid;
/* /*
* Shared prototypes * Shared prototypes

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
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
CAPTION "Rufus 2.5.779" CAPTION "Rufus 2.5.780"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -319,8 +319,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,5,779,0 FILEVERSION 2,5,780,0
PRODUCTVERSION 2,5,779,0 PRODUCTVERSION 2,5,780,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -337,13 +337,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", "2.5.779" VALUE "FileVersion", "2.5.780"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 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", "2.5.779" VALUE "ProductVersion", "2.5.780"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"