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

[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
This commit is contained in:
Pete Batard 2013-11-30 17:39:38 +00:00
parent 7ba9ee6505
commit e163ecb9eb
7 changed files with 49 additions and 37 deletions

View file

@ -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"},

View file

@ -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();

View file

@ -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));

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.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"

View file

@ -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) {

View file

@ -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));