From e163ecb9eb14c14ce154048adf7290ed192c1ca9 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sat, 30 Nov 2013 17:39:38 +0000 Subject: [PATCH] [misc] last minute fixes and improvements for v1.4.0 * Fix missing DOS codepages for Asian languages (reported by Kyle) * Fix wrong label being reported when an USB HDD is present (reported by NaJiyoun) * Fix potential issue with error message reporting * Fix ISO button being truncated on high DPI displays * Improve French and Korean translations * Improve launch of updated application --- res/localization/rufus.loc | 23 +++++++++++------------ src/dos_locale.c | 7 ++++++- src/net.c | 2 +- src/rufus.c | 25 +++++++++++++++++++------ src/rufus.rc | 12 ++++++------ src/stdio.c | 8 +++----- src/stdlg.c | 9 +++------ 7 files changed, 49 insertions(+), 37 deletions(-) diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 9af4bcbc..fb07535d 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -789,9 +789,9 @@ t MSG_184 "Afin de générer des statistiques d’utilisation privées, il se pe "les informations ainsi obtenues \\b au plus un an\\b0 . A moins d’y être contraint par la loi, " "nous nous engageons aussi à ne pas diffuser ces informations à de tierce parties." t MSG_185 "Processus de mise à jour:" -t MSG_186 "Aucun service ou tâche de fond ne sont installés ou lancés par Rufus. Cela veut dire que les " - "test de mises à jour interviennent seulement lorsque l’application principale s'exécute.\\line\n" - "Bien entendu, un accès à internet est requis pour vérifier la disponibilité des mises à jour." +t MSG_186 "Aucun service ou tâche de fond n'est installé ou lancé par Rufus ; la vérification " + "de mises à jour intervient seulement lorsque l’application principale s'exécute.\\line\n" + "Bien entendu, un accès à internet est requis pour vérifier les mises à jour." # Status messages t MSG_201 "Annulation - Veuillez patienter..." @@ -1981,11 +1981,10 @@ s IDC_BOOT +3,0 m IDC_BOOTTYPE +3,0 m IDC_SELECT_ISO +2,0 t IDC_SET_ICON "확장 레이블 및 아이콘 파일 만들기" -t IDC_ABOUT "프로그램 정보" -s IDC_ABOUT +10,0 +t IDC_ABOUT "정보..." t IDC_LOG "로그" -s IDC_LOG +2,0 -m IDC_LOG +8,0 +s IDC_LOG +5,0 +m IDC_LOG -2,0 t IDCANCEL "닫기" t IDC_START "시작" m IDC_START +2,0 @@ -2247,18 +2246,18 @@ t MSG_173 "선택하려면 클릭..." # The following will appear in the about dialog t MSG_174 "Rufus - 믿을 수 있는 USB 포맷 유틸리티" t MSG_175 "버전 %d.%d.%d (빌드 %d)" -t MSG_176 "한국어 번역: 나두야간다 - 세상사는 이야기" +t MSG_176 "한국어 번역: 나두야간다 " t MSG_177 "버그에 대한 보고나 프로그램의 개선을 요청:" -t MSG_178 "" -t MSG_179 "업데이트 정책:\\line\n" +t MSG_178 "추가 저작권:" +t MSG_179 "업데이트 정책:" t MSG_180 "프로그램을 업데이트 하도록 선택한 경우, " - "다음의 정보는 우리의 서버에 수집 될 수 있음에 동의하는 것을 의미합니다.\\line\n" + "다음의 정보는 우리의 서버에 수집 될 수 있음에 동의하는 것을 의미합니다." t MSG_181 "사용 중인 운영 체제의 아키텍처와 버전" t MSG_182 "현재 사용 중인 프로그램의 버전" t MSG_183 "사용자의 IP 주소" t MSG_184 "수집된 정보는 사용자의 년간 통계와 프로그램의 성능 향상을 위한 목적으로만 사용되어지며, " "제 3자에게 수집된 정보를 공개하지 않습니다." -t MSG_185 "업데이트 프로세스:\\line\n" +t MSG_185 "업데이트 프로세스:" t MSG_186 "이 프로그램은 백그라운드 서비스를 설치하거나 실행하지 않으므로 주 프로그램이 실행 중일 때에만 업데이트가 수행됩니다.\\line\n" "업데이트에는 인터넷 연결이 필요합니다." diff --git a/src/dos_locale.c b/src/dos_locale.c index a8f09bdf..e6b239b1 100644 --- a/src/dos_locale.c +++ b/src/dos_locale.c @@ -298,7 +298,7 @@ typedef struct { } cp_list; // From FreeDOS CPX pack as well as -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756.aspx +// http://msdn.microsoft.com/en-us/library/dd317756.aspx static cp_list cp_hr_list[] = { { 113, "Lat-Yugoslavian"}, { 437, "US-English"}, @@ -336,8 +336,13 @@ static cp_list cp_hr_list[] = { { 867, "Czech Kamenicky"}, { 869, "Modern Greek"}, { 872, "Cyr-South-Slavic (Euro)"}, + { 874, "Thai"}, { 895, "Czech Kamenicky (Alt)"}, { 899, "Armenian"}, + { 932, "Japanese"}, + { 936, "Chinese (Simplified)"}, + { 949, "Korean"}, + { 950, "Chinese (Traditional)"}, { 991, "Mazovian-Polish (Zloty)"}, { 1116, "Estonian"}, { 1117, "Latvian"}, diff --git a/src/net.c b/src/net.c index 56c1c419..e9e3eef8 100644 --- a/src/net.c +++ b/src/net.c @@ -84,7 +84,7 @@ const char* WinInetErrorString(void) static char error_string[256]; DWORD size = sizeof(error_string); - error_code = GetLastError(); + error_code = HRESULT_CODE(GetLastError()); if ((error_code < INTERNET_ERROR_BASE) || (error_code > INTERNET_ERROR_LAST)) return WindowsErrorString(); diff --git a/src/rufus.c b/src/rufus.c index f0ae0ad7..5ad44166 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -509,6 +509,7 @@ static BOOL PopulateProperties(int ComboIndex) double HumanReadableSize; char no_label[] = STR_NO_LABEL; int i, j, pt, bt; + char* device_tooltip; IGNORE_RETVAL(ComboBox_ResetContent(hPartitionScheme)); IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem)); @@ -554,22 +555,33 @@ static BOOL PopulateProperties(int ComboIndex) } IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, j)); SetPartitionSchemeTooltip(); - CreateTooltip(hDeviceList, DriveID.Table[ComboIndex], -1); + device_tooltip = (char*) malloc(safe_strlen(DriveID.Table[ComboIndex]) + 16); // Set a proposed label according to the size (eg: "256MB", "8GB") if (HumanReadableSize < 1.0) { HumanReadableSize *= 1024.0; i--; } - // If we're beneath the tolerance, round proposed label to an integer, if not, show two decimal point + // If we're beneath the tolerance, round proposed label to an integer, if not, show two decimal points if (fabs(HumanReadableSize / ceil(HumanReadableSize) - 1.0) < PROPOSEDLABEL_TOLERANCE) { safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label), "%0.0f%s", ceil(HumanReadableSize), lmprintf(MSG_020+i)); + if (device_tooltip != NULL) + safe_sprintf(device_tooltip, safe_strlen(DriveID.Table[ComboIndex]) + 16, + "%s (%0.0f%s)", DriveID.Table[ComboIndex], ceil(HumanReadableSize), lmprintf(MSG_020+i)); } else { safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label), "%0.2f%s", HumanReadableSize, lmprintf(MSG_020+i)); + if (device_tooltip != NULL) + safe_sprintf(device_tooltip, safe_strlen(DriveID.Table[ComboIndex]) + 16, + "%s (%0.2f%s)", DriveID.Table[ComboIndex], HumanReadableSize, lmprintf(MSG_020+i)); } + // Add a tooltip (with the size of the device in parenthesis) + if (device_tooltip != NULL) + CreateTooltip(hDeviceList, device_tooltip, -1); + safe_free(device_tooltip); + // If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB") if ((iso_path == NULL) || (iso_report.label[0] == 0)) { if ( (safe_stricmp(no_label, DriveLabel.Table[ComboIndex]) == 0) @@ -733,10 +745,6 @@ static BOOL GetUSBDevices(DWORD devnum) drive_index = device_number.DeviceNumber + DRIVE_INDEX_MIN; if (GetDriveLabel(drive_index, &drive_letter, &label)) { - // Must ensure that the combo box is UNSORTED for indexes to be the same - StrArrayAdd(&DriveID, buffer); - StrArrayAdd(&DriveLabel, label); - if ((!enable_HDDs) && ((score = IsHDD(drive_index, vid, pid, buffer)) > 0)) { uprintf("Device eliminated because it was detected as an USB Hard Drive (score %d > 0)\n", score); uprintf("If this device is not an USB Hard Drive, please e-mail the author of this application\n"); @@ -758,6 +766,11 @@ static BOOL GetUSBDevices(DWORD devnum) } entry = lmprintf(MSG_047, label, drive_letter); } + + // Must ensure that the combo box is UNSORTED for indexes to be the same + StrArrayAdd(&DriveID, buffer); + StrArrayAdd(&DriveLabel, label); + IGNORE_RETVAL(ComboBox_SetItemData(hDeviceList, ComboBox_AddStringU(hDeviceList, entry), device_number.DeviceNumber + DRIVE_INDEX_MIN)); maxwidth = max(maxwidth, GetEntryWidth(hDeviceList, entry)); diff --git a/src/rufus.rc b/src/rufus.rc index a9a9d76c..759e0992 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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.0.333" +CAPTION "Rufus v1.4.0.334" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -53,7 +53,7 @@ BEGIN LTEXT "New volume label",IDS_LABEL_TXT,9,121,186,10 EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL CONTROL "Check device for bad blocks:",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10 - CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,181,10 + CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,106,10 CONTROL "Create a bootable disk using:",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,104,10 CONTROL "Create extended label and icon files",IDC_SET_ICON, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,198,181,10 @@ -288,8 +288,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,0,333 - PRODUCTVERSION 1,4,0,333 + FILEVERSION 1,4,0,334 + PRODUCTVERSION 1,4,0,334 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.0.333" + VALUE "FileVersion", "1.4.0.334" 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.0.333" + VALUE "ProductVersion", "1.4.0.334" END END BLOCK "VarFileInfo" diff --git a/src/stdio.c b/src/stdio.c index 80b3ed3c..54c32ebc 100644 --- a/src/stdio.c +++ b/src/stdio.c @@ -118,7 +118,7 @@ static char err_string[256] = {0}; safe_sprintf(err_string, sizeof(err_string), "[0x%08X] ", error_code); - size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error_code, + size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, HRESULT_CODE(error_code), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[strlen(err_string)], sizeof(err_string)-(DWORD)strlen(err_string), NULL); if (size == 0) { @@ -144,8 +144,7 @@ static void CALLBACK PrintStatusTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, { bStatusTimerArmed = FALSE; // potentially display lower priority message that was overridden - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, - SBT_OWNERDRAW | 0, szStatusMessage); + SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); KillTimer(hMainDialog, TID_MESSAGE); } @@ -158,8 +157,7 @@ void PrintStatus(unsigned int duration, BOOL debug, const char* message) uprintf("%s\n", szStatusMessage); if ((duration) || (!bStatusTimerArmed)) { - SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, - SBT_OWNERDRAW | 0, szStatusMessage); + SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); } if (duration) { diff --git a/src/stdlg.c b/src/stdlg.c index 37f797df..a1f0fad0 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -1147,7 +1147,7 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR { int i; HWND hNotes; - char tmp[128]; + char tmp[128], cmdline[] = APPLICATION_NAME " -w 150"; static char* filepath = NULL; static int download_status = 0; STARTUPINFOA si; @@ -1202,15 +1202,12 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; break; case 2: // Launch newer version and close this one - for (i=(int)safe_strlen(filepath); (i>0)&&(filepath[i]!='\\'); i--); - safe_strcpy(tmp, sizeof(tmp), &filepath[i+1]); - safe_strcat(tmp, sizeof(tmp), " -w 150"); // add 15 seconds delay to wait for lock release - filepath[i] = 0; memset(&si, 0, sizeof(si)); memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - if (!CreateProcessU(NULL, tmp, NULL, NULL, FALSE, 0, NULL, filepath, &si, &pi)) { + if (!CreateProcessU(filepath, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { PrintStatus(0, FALSE, lmprintf(MSG_214)); + // TODO: produce a message box and add a retry, as the file may be scanned by the Antivirus uprintf("Failed to launch new application: %s\n", WindowsErrorString()); } else { PrintStatus(0, FALSE, lmprintf(MSG_213));