diff --git a/src/rufus.c b/src/rufus.c index 5920efd1..4b3a5a09 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -102,6 +102,7 @@ int default_fs; uint32_t dur_mins, dur_secs; loc_cmd* selected_locale = NULL; WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); +DWORD MainThreadId; HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar; BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode; @@ -591,7 +592,8 @@ static void SetTargetSystem(void) ts = 0; // MBR/BIOS|UEFI } IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, ts)); - SetPartitionSchemeTooltip(); + // Can't call SetPartitionSchemeTooltip() directly, as we may be on a different thread + SendMessage(hMainDialog, UM_SET_PARTITION_SCHEME_TOOLTIP, 0, 0); } static void SetProposedLabel(int ComboIndex) @@ -1634,6 +1636,7 @@ void InitDialog(HWND hDlg) // Quite a burden to carry around as parameters hMainDialog = hDlg; + MainThreadId = GetCurrentThreadId(); hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); hPartitionScheme = GetDlgItem(hDlg, IDC_PARTITION_TYPE); hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); @@ -2694,6 +2697,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA FormatStatus = 0; format_op_in_progress = FALSE; return (INT_PTR)TRUE; + + // Ensures that SetPartitionSchemeTooltip() can be called from the original thread + case UM_SET_PARTITION_SCHEME_TOOLTIP: + SetPartitionSchemeTooltip(); + break; } return (INT_PTR)FALSE; } diff --git a/src/rufus.h b/src/rufus.h index a18dc063..197f8682 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -147,6 +147,7 @@ enum user_message_type { UM_PROGRESS_INIT, UM_PROGRESS_EXIT, UM_NO_UPDATE, + UM_SET_PARTITION_SCHEME_TOOLTIP, // Start of the WM IDs for the language menu items UM_LANGUAGE_MENU = WM_APP + 0x100 }; @@ -364,7 +365,7 @@ extern HWND hInfo, hProgress, hDiskID, hStatusToolbar; extern float fScale; extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH]; extern char* image_path; -extern DWORD FormatStatus, DownloadStatus; +extern DWORD FormatStatus, DownloadStatus, MainThreadId; extern BOOL PromptOnError; extern unsigned long syslinux_ldlinux_len[2]; extern const int nb_steps[FS_MAX]; diff --git a/src/rufus.rc b/src/rufus.rc index b5adcc50..0d872838 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 2.10.941" +CAPTION "Rufus 2.10.942" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -320,8 +320,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,941,0 - PRODUCTVERSION 2,10,941,0 + FILEVERSION 2,10,942,0 + PRODUCTVERSION 2,10,942,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -338,13 +338,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.10.941" + VALUE "FileVersion", "2.10.942" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.10.941" + VALUE "ProductVersion", "2.10.942" END END BLOCK "VarFileInfo" diff --git a/src/stdfn.c b/src/stdfn.c index 47648b43..52a3f4be 100644 --- a/src/stdfn.c +++ b/src/stdfn.c @@ -803,7 +803,7 @@ BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* s uprintf("SetLGP: Unable to start thread"); return FALSE; } - if (WaitForSingleObject(thread_id, 5000) != WAIT_OBJECT_0) { + if (WaitForSingleObject(thread_id, 60000) != WAIT_OBJECT_0) { uprintf("SetLGP: Killing stuck thread!"); TerminateThread(thread_id, 0); CloseHandle(thread_id); diff --git a/src/stdlg.c b/src/stdlg.c index 9676575c..5cabc896 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -963,12 +963,10 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM for (i=0; icode) { case TTN_GETDISPINFOW: @@ -979,6 +977,11 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM } break; } +#ifdef _DEBUG + // comctl32 causes issues if the tooltips are not being manipulated from the same thread as their parent controls + if (GetCurrentThreadId() != MainThreadId) + uprintf("Warning: Tooltip callback is being called from wrong thread"); +#endif return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam); }