mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[updates] add "Check Now" button
* Also reword update policy and adjust timings * Also fix ISO extraction window title
This commit is contained in:
		
							parent
							
								
									bdbc9ed9c0
								
							
						
					
					
						commit
						5a53cb3b9c
					
				
					 7 changed files with 58 additions and 50 deletions
				
			
		|  | @ -407,6 +407,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) | ||||||
| 		SendMessage(hISOProgressBar, PBM_SETMARQUEE, TRUE, 0); | 		SendMessage(hISOProgressBar, PBM_SETMARQUEE, TRUE, 0); | ||||||
| 	} else { | 	} else { | ||||||
| 		uprintf("Extracting files...\n"); | 		uprintf("Extracting files...\n"); | ||||||
|  | 		SetWindowTextU(hISOProgressDlg, "Copying ISO files..."); | ||||||
| 		if (total_blocks == 0) { | 		if (total_blocks == 0) { | ||||||
| 			uprintf("Error: ISO has not been properly scanned.\n"); | 			uprintf("Error: ISO has not been properly scanned.\n"); | ||||||
| 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN); | 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN); | ||||||
|  |  | ||||||
|  | @ -90,18 +90,17 @@ const char* additional_copyrights = | ||||||
| 
 | 
 | ||||||
| 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;}{\\f1\\fnil\\fcharset2 Symbol;}}\n" | ||||||
| "\\fs16\\b Update Policy\\b0\\line\\line\n" | "\\fs16\\b Update Policy:\\b0\\line\n" | ||||||
| "If you choose to allow update checks, you agree that the following information may be collected on our server(s):\\par\n" | "If you choose to allow update checks, you agree that the following information may be collected on our server(s):\\par\n" | ||||||
| "\\pard{\\pntext\\f1\\'B7\\tab}{\\*\\pn\\pnlvlblt\\pnf2\\pnindent0{\\pntxtb\\'B7}}\\fi-150\\li220 Your Operating System's architecture and version\\par\n" | "\\pard{\\pntext\\f1\\'B7\\tab}{\\*\\pn\\pnlvlblt\\pnf2\\pnindent0{\\pntxtb\\'B7}}\\fi-150\\li220 Your Operating System's architecture and version\\par\n" | ||||||
| "{\\pntext\\f1\\'B7\\tab}The version of the application\\par\n" | "{\\pntext\\f1\\'B7\\tab}The version of the application\\par\n" | ||||||
| "{\\pntext\\f1\\'B7\\tab}Your IP address\\line\\pard\n" | "{\\pntext\\f1\\'B7\\tab}Your IP address\\line\\pard\n" | ||||||
| "\\line\n" | "\\line\n" | ||||||
| "\\b None\\b0  of the data above will be disclosed to third parties.\\line\n" | "For the purpose of generating private usage statistics, we reserve the right to keep the information collected, \n" | ||||||
| "However we reserve the right to keep the information collected, for at most a year, \n" | "\\b for at most a year\\b0 . However \\b none\\b0  of the data provided above will be disclosed to third parties.\\line\n\\line\n" | ||||||
| "for the purpose of generating private usage statistics.\\line\n\\line\n" | "\\b Update Process:\\b0\\line\n" | ||||||
| "\\b Update Process\\b0\\line\\line\n" | APPLICATION_NAME " does not install or run any background services, therefore update checks are only performed when the main application is running.\\line\n" | ||||||
| APPLICATION_NAME " does not install or run any background services, therefore update checks are only performed when the main application is running. \n" | "Internet access will be required when checking for new versions.\n"  | ||||||
| "Internet access is required when checking for new versions.\n"  |  | ||||||
| "}"; | "}"; | ||||||
| 
 | 
 | ||||||
| const char* gplv3 = | const char* gplv3 = | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								src/net.c
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								src/net.c
									
										
									
									
									
								
							|  | @ -44,6 +44,7 @@ | ||||||
| /* Globals */ | /* Globals */ | ||||||
| static DWORD error_code; | static DWORD error_code; | ||||||
| static BOOL update_check_in_progress = FALSE; | static BOOL update_check_in_progress = FALSE; | ||||||
|  | static BOOL force_update_check = FALSE; | ||||||
| 
 | 
 | ||||||
| /* MinGW is missing some of those */ | /* MinGW is missing some of those */ | ||||||
| #if !defined(ERROR_INTERNET_DISCONNECTED) | #if !defined(ERROR_INTERNET_DISCONNECTED) | ||||||
|  | @ -401,7 +402,7 @@ static __inline uint64_t to_uint64_t(uint16_t x[4]) { | ||||||
|  */ |  */ | ||||||
| static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | ||||||
| { | { | ||||||
| 	BOOL releases_only, force = (BOOL)param, found_new_version = FALSE; | 	BOOL releases_only, found_new_version = FALSE; | ||||||
| 	const char* server_url = RUFUS_URL "/"; | 	const char* server_url = RUFUS_URL "/"; | ||||||
| 	int i, j, k, verbose = 0, verpos[4]; | 	int i, j, k, verbose = 0, verpos[4]; | ||||||
| 	static const char* archname[] = {"win_x86", "win_x64"}; | 	static const char* archname[] = {"win_x86", "win_x64"}; | ||||||
|  | @ -419,14 +420,17 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | ||||||
| 	BOOL is_x64 = FALSE, (__stdcall *pIsWow64Process)(HANDLE, PBOOL) = NULL; | 	BOOL is_x64 = FALSE, (__stdcall *pIsWow64Process)(HANDLE, PBOOL) = NULL; | ||||||
| 
 | 
 | ||||||
| 	update_check_in_progress = TRUE; | 	update_check_in_progress = TRUE; | ||||||
| 	if (!force) { |  | ||||||
| 		// Wait a while before checking for updates
 |  | ||||||
| 		// TODO: Also check on inactivity
 |  | ||||||
| 		do { |  | ||||||
| 			Sleep(15000); |  | ||||||
| 		} while (iso_op_in_progress || format_op_in_progress || (dialog_showing>0)); |  | ||||||
| 
 |  | ||||||
| 	verbose = ReadRegistryKey32(REGKEY_VERBOSE_UPDATES); | 	verbose = ReadRegistryKey32(REGKEY_VERBOSE_UPDATES); | ||||||
|  | 	// Unless the update was forced, wait a while before performing the update check
 | ||||||
|  | 	if (!force_update_check) { | ||||||
|  | 		// TODO: Also check on inactivity
 | ||||||
|  | 		// It would of course be a lot nicer to use a timer and wake the thread, but my
 | ||||||
|  | 		// development time is limited and this is FASTER to implement.
 | ||||||
|  | 		do { | ||||||
|  | 			for (i=0; (i<30) && (!force_update_check); i++) | ||||||
|  | 				Sleep(500); | ||||||
|  | 		} while ((!force_update_check) && ((iso_op_in_progress || format_op_in_progress || (dialog_showing>0)))); | ||||||
|  | 		if (!force_update_check) { | ||||||
| 			if ((ReadRegistryKey32(REGKEY_UPDATE_INTERVAL) == -1)) { | 			if ((ReadRegistryKey32(REGKEY_UPDATE_INTERVAL) == -1)) { | ||||||
| 				vuprintf("Check for updates disabled, as per registry settings.\n"); | 				vuprintf("Check for updates disabled, as per registry settings.\n"); | ||||||
| 				goto out; | 				goto out; | ||||||
|  | @ -447,6 +451,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(3000, FALSE, "Checking for " APPLICATION_NAME " updates...\n"); | 	PrintStatus(3000, FALSE, "Checking for " APPLICATION_NAME " updates...\n"); | ||||||
| 
 | 
 | ||||||
|  | @ -546,7 +551,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | ||||||
| 		// Always store the server response time - the only clock we trust!
 | 		// Always store the server response time - the only clock we trust!
 | ||||||
| 		WriteRegistryKey64(REGKEY_LAST_UPDATE, server_time); | 		WriteRegistryKey64(REGKEY_LAST_UPDATE, server_time); | ||||||
| 		// Might as well let the user know
 | 		// Might as well let the user know
 | ||||||
| 		if (!force) { | 		if (!force_update_check) { | ||||||
| 			if (local_time > server_time + 600) { | 			if (local_time > server_time + 600) { | ||||||
| 				uprintf("Your local clock appears more than 10 minutes early - You ought to fix that...\n"); | 				uprintf("Your local clock appears more than 10 minutes early - You ought to fix that...\n"); | ||||||
| 			} | 			} | ||||||
|  | @ -591,11 +596,12 @@ out: | ||||||
| 	// Start the new download after cleanup
 | 	// Start the new download after cleanup
 | ||||||
| 	if (found_new_version) { | 	if (found_new_version) { | ||||||
| 		// User may have started an operation while we were checking
 | 		// User may have started an operation while we were checking
 | ||||||
| 		while (iso_op_in_progress || format_op_in_progress || (dialog_showing>0)) { | 		while ((!force_update_check) && (iso_op_in_progress || format_op_in_progress || (dialog_showing>0))) { | ||||||
| 			Sleep(3000); | 			Sleep(15000); | ||||||
| 		} | 		} | ||||||
| 		DownloadNewVersion(); | 		DownloadNewVersion(); | ||||||
| 	} | 	} | ||||||
|  | 	force_update_check = FALSE; | ||||||
| 	update_check_in_progress = FALSE; | 	update_check_in_progress = FALSE; | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
| } | } | ||||||
|  | @ -605,9 +611,10 @@ out: | ||||||
|  */ |  */ | ||||||
| BOOL CheckForUpdates(BOOL force) | BOOL CheckForUpdates(BOOL force) | ||||||
| { | { | ||||||
|  | 	force_update_check = force; | ||||||
| 	if (update_check_in_progress) | 	if (update_check_in_progress) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	if (CreateThread(NULL, 0, CheckForUpdatesThread, (LPVOID)force, 0, NULL) == NULL) { | 	if (CreateThread(NULL, 0, CheckForUpdatesThread, NULL, 0, NULL) == NULL) { | ||||||
| 		uprintf("Unable to start check for updates thread"); | 		uprintf("Unable to start check for updates thread"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -88,6 +88,7 @@ | ||||||
| #define IDC_INCLUDE_BETAS               1063 | #define IDC_INCLUDE_BETAS               1063 | ||||||
| #define IDC_RELEASE_NOTES               1064 | #define IDC_RELEASE_NOTES               1064 | ||||||
| #define IDC_DOWNLOAD                    1065 | #define IDC_DOWNLOAD                    1065 | ||||||
|  | #define IDC_CHECK_NOW                   1066 | ||||||
| #define IDC_WEBSITE                     1067 | #define IDC_WEBSITE                     1067 | ||||||
| #define IDC_YOUR_VERSION                1068 | #define IDC_YOUR_VERSION                1068 | ||||||
| #define IDC_LATEST_VERSION              1069 | #define IDC_LATEST_VERSION              1069 | ||||||
|  |  | ||||||
|  | @ -2040,11 +2040,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 				DeleteRegistryKey(COMPANY_NAME); | 				DeleteRegistryKey(COMPANY_NAME); | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			// Alt-U => Force an update check
 |  | ||||||
| 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'U')) { |  | ||||||
| 				CheckForUpdates(TRUE); |  | ||||||
| 				continue; |  | ||||||
| 			} |  | ||||||
| 			TranslateMessage(&msg); | 			TranslateMessage(&msg); | ||||||
| 			DispatchMessage(&msg); | 			DispatchMessage(&msg); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 206, 316 | IDD_DIALOG DIALOGEX 12, 12, 206, 316 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_APPWINDOW | EXSTYLE WS_EX_APPWINDOW | ||||||
| CAPTION "Rufus v1.3.0.206" | CAPTION "Rufus v1.3.0.207" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,278,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,278,50,14 | ||||||
|  | @ -128,14 +128,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| CAPTION "Update policy and settings" | CAPTION "Update policy and settings" | ||||||
| FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 | FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     ICON            IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 |     ICON            IDI_ICON,IDC_ABOUT_ICON,11,8,21,20 | ||||||
|     DEFPUSHBUTTON   "Close",IDCANCEL,224,176,50,14,WS_GROUP |     DEFPUSHBUTTON   "Close",IDCANCEL,221,172,50,14,WS_GROUP | ||||||
|     CONTROL         "",IDC_POLICY,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,8,235,130,WS_EX_STATICEDGE |     CONTROL         "",IDC_POLICY,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_VSCROLL,46,8,235,130,WS_EX_STATICEDGE | ||||||
|     COMBOBOX        IDC_UPDATE_FREQUENCY,133,155,66,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_UPDATE_FREQUENCY,133,155,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
|     LTEXT           "Check for updates:",IDC_STATIC,52,157,72,11 |     LTEXT           "Check for updates:",IDC_STATIC,52,157,72,11 | ||||||
|     LTEXT           "Include beta versions:",IDC_STATIC,52,173,93,11 |     LTEXT           "Include beta versions:",IDC_STATIC,52,173,93,11 | ||||||
|     COMBOBOX        IDC_INCLUDE_BETAS,133,171,36,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_INCLUDE_BETAS,133,171,36,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
|     GROUPBOX        "Settings",IDC_STATIC,46,145,161,45 |     GROUPBOX        "Settings",IDC_STATIC,45,145,161,46 | ||||||
|  |     PUSHBUTTON      "Check Now",IDC_CHECK_NOW,221,154,50,14 | ||||||
|  |     GROUPBOX        "",IDC_STATIC,210,145,71,46 | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| IDD_NEW_VERSION DIALOGEX 0, 0, 384, 268 | IDD_NEW_VERSION DIALOGEX 0, 0, 384, 268 | ||||||
|  | @ -272,8 +274,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,3,0,206 |  FILEVERSION 1,3,0,207 | ||||||
|  PRODUCTVERSION 1,3,0,206 |  PRODUCTVERSION 1,3,0,207 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -290,13 +292,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", "1.3.0.206" |             VALUE "FileVersion", "1.3.0.207" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "(c) 2011-2012 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "(c) 2011-2012 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", "1.3.0.206" |             VALUE "ProductVersion", "1.3.0.207" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -1182,6 +1182,9 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l | ||||||
| 		case IDCANCEL: | 		case IDCANCEL: | ||||||
| 			EndDialog(hDlg, LOWORD(wParam)); | 			EndDialog(hDlg, LOWORD(wParam)); | ||||||
| 			return (INT_PTR)TRUE; | 			return (INT_PTR)TRUE; | ||||||
|  | 		case IDC_CHECK_NOW: | ||||||
|  | 			CheckForUpdates(TRUE); | ||||||
|  | 			return (INT_PTR)TRUE; | ||||||
| 		case IDC_UPDATE_FREQUENCY: | 		case IDC_UPDATE_FREQUENCY: | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
| 				break; | 				break; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue