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); | ||||
| 	} else { | ||||
| 		uprintf("Extracting files...\n"); | ||||
| 		SetWindowTextU(hISOProgressDlg, "Copying ISO files..."); | ||||
| 		if (total_blocks == 0) { | ||||
| 			uprintf("Error: ISO has not been properly scanned.\n"); | ||||
| 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN); | ||||
|  |  | |||
|  | @ -90,18 +90,17 @@ const char* additional_copyrights = | |||
| 
 | ||||
| const char* update_policy = | ||||
| "{\\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" | ||||
| "\\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}Your IP address\\line\\pard\n" | ||||
| "\\line\n" | ||||
| "\\b None\\b0  of the data above will be disclosed to third parties.\\line\n" | ||||
| "However we reserve the right to keep the information collected, for at most a year, \n" | ||||
| "for the purpose of generating private usage statistics.\\line\n\\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. \n" | ||||
| "Internet access is required when checking for new versions.\n"  | ||||
| "For the purpose of generating private usage statistics, we reserve the right to keep the information collected, \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" | ||||
| "\\b Update Process:\\b0\\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" | ||||
| "Internet access will be required when checking for new versions.\n"  | ||||
| "}"; | ||||
| 
 | ||||
| const char* gplv3 = | ||||
|  |  | |||
							
								
								
									
										65
									
								
								src/net.c
									
										
									
									
									
								
							
							
						
						
									
										65
									
								
								src/net.c
									
										
									
									
									
								
							|  | @ -44,6 +44,7 @@ | |||
| /* Globals */ | ||||
| static DWORD error_code; | ||||
| static BOOL update_check_in_progress = FALSE; | ||||
| static BOOL force_update_check = FALSE; | ||||
| 
 | ||||
| /* MinGW is missing some of those */ | ||||
| #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) | ||||
| { | ||||
| 	BOOL releases_only, force = (BOOL)param, found_new_version = FALSE; | ||||
| 	BOOL releases_only, found_new_version = FALSE; | ||||
| 	const char* server_url = RUFUS_URL "/"; | ||||
| 	int i, j, k, verbose = 0, verpos[4]; | ||||
| 	static const char* archname[] = {"win_x86", "win_x64"}; | ||||
|  | @ -419,32 +420,36 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | |||
| 	BOOL is_x64 = FALSE, (__stdcall *pIsWow64Process)(HANDLE, PBOOL) = NULL; | ||||
| 
 | ||||
| 	update_check_in_progress = TRUE; | ||||
| 	if (!force) { | ||||
| 		// Wait a while before checking for 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 { | ||||
| 			Sleep(15000); | ||||
| 		} while (iso_op_in_progress || format_op_in_progress || (dialog_showing>0)); | ||||
| 
 | ||||
| 		verbose = ReadRegistryKey32(REGKEY_VERBOSE_UPDATES); | ||||
| 		if ((ReadRegistryKey32(REGKEY_UPDATE_INTERVAL) == -1)) { | ||||
| 			vuprintf("Check for updates disabled, as per registry settings.\n"); | ||||
| 			goto out; | ||||
| 		} | ||||
| 		reg_time = ReadRegistryKey64(REGKEY_LAST_UPDATE); | ||||
| 		update_interval = (int64_t)ReadRegistryKey32(REGKEY_UPDATE_INTERVAL); | ||||
| 		if (update_interval == 0) { | ||||
| 			WriteRegistryKey32(REGKEY_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL); | ||||
| 			update_interval = DEFAULT_UPDATE_INTERVAL; | ||||
| 		} | ||||
| 		GetSystemTime(&LocalTime); | ||||
| 		if (!SystemTimeToFileTime(&LocalTime, &FileTime)) | ||||
| 			goto out; | ||||
| 		local_time = ((((int64_t)FileTime.dwHighDateTime)<<32) + FileTime.dwLowDateTime) / 10000000; | ||||
| 		vvuprintf("Local time: %" PRId64 "\n", local_time); | ||||
| 		if (local_time < reg_time + update_interval) { | ||||
| 			vuprintf("Next update check in %" PRId64 " seconds.\n", reg_time + update_interval - local_time); | ||||
| 			goto out; | ||||
| 			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)) { | ||||
| 				vuprintf("Check for updates disabled, as per registry settings.\n"); | ||||
| 				goto out; | ||||
| 			} | ||||
| 			reg_time = ReadRegistryKey64(REGKEY_LAST_UPDATE); | ||||
| 			update_interval = (int64_t)ReadRegistryKey32(REGKEY_UPDATE_INTERVAL); | ||||
| 			if (update_interval == 0) { | ||||
| 				WriteRegistryKey32(REGKEY_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL); | ||||
| 				update_interval = DEFAULT_UPDATE_INTERVAL; | ||||
| 			} | ||||
| 			GetSystemTime(&LocalTime); | ||||
| 			if (!SystemTimeToFileTime(&LocalTime, &FileTime)) | ||||
| 				goto out; | ||||
| 			local_time = ((((int64_t)FileTime.dwHighDateTime)<<32) + FileTime.dwLowDateTime) / 10000000; | ||||
| 			vvuprintf("Local time: %" PRId64 "\n", local_time); | ||||
| 			if (local_time < reg_time + update_interval) { | ||||
| 				vuprintf("Next update check in %" PRId64 " seconds.\n", reg_time + update_interval - local_time); | ||||
| 				goto out; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | @ -546,7 +551,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | |||
| 		// Always store the server response time - the only clock we trust!
 | ||||
| 		WriteRegistryKey64(REGKEY_LAST_UPDATE, server_time); | ||||
| 		// Might as well let the user know
 | ||||
| 		if (!force) { | ||||
| 		if (!force_update_check) { | ||||
| 			if (local_time > server_time + 600) { | ||||
| 				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
 | ||||
| 	if (found_new_version) { | ||||
| 		// User may have started an operation while we were checking
 | ||||
| 		while (iso_op_in_progress || format_op_in_progress || (dialog_showing>0)) { | ||||
| 			Sleep(3000); | ||||
| 		while ((!force_update_check) && (iso_op_in_progress || format_op_in_progress || (dialog_showing>0))) { | ||||
| 			Sleep(15000); | ||||
| 		} | ||||
| 		DownloadNewVersion(); | ||||
| 	} | ||||
| 	force_update_check = FALSE; | ||||
| 	update_check_in_progress = FALSE; | ||||
| 	ExitThread(0); | ||||
| } | ||||
|  | @ -605,9 +611,10 @@ out: | |||
|  */ | ||||
| BOOL CheckForUpdates(BOOL force) | ||||
| { | ||||
| 	force_update_check = force; | ||||
| 	if (update_check_in_progress) | ||||
| 		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"); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  |  | |||
|  | @ -88,6 +88,7 @@ | |||
| #define IDC_INCLUDE_BETAS               1063 | ||||
| #define IDC_RELEASE_NOTES               1064 | ||||
| #define IDC_DOWNLOAD                    1065 | ||||
| #define IDC_CHECK_NOW                   1066 | ||||
| #define IDC_WEBSITE                     1067 | ||||
| #define IDC_YOUR_VERSION                1068 | ||||
| #define IDC_LATEST_VERSION              1069 | ||||
|  |  | |||
|  | @ -2040,11 +2040,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | |||
| 				DeleteRegistryKey(COMPANY_NAME); | ||||
| 				continue; | ||||
| 			} | ||||
| 			// Alt-U => Force an update check
 | ||||
| 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'U')) { | ||||
| 				CheckForUpdates(TRUE); | ||||
| 				continue; | ||||
| 			} | ||||
| 			TranslateMessage(&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 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus v1.3.0.206" | ||||
| CAPTION "Rufus v1.3.0.207" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     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" | ||||
| FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     ICON            IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 | ||||
|     DEFPUSHBUTTON   "Close",IDCANCEL,224,176,50,14,WS_GROUP | ||||
|     ICON            IDI_ICON,IDC_ABOUT_ICON,11,8,21,20 | ||||
|     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 | ||||
|     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           "Include beta versions:",IDC_STATIC,52,173,93,11 | ||||
|     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 | ||||
| 
 | ||||
| IDD_NEW_VERSION DIALOGEX 0, 0, 384, 268 | ||||
|  | @ -272,8 +274,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,3,0,206 | ||||
|  PRODUCTVERSION 1,3,0,206 | ||||
|  FILEVERSION 1,3,0,207 | ||||
|  PRODUCTVERSION 1,3,0,207 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -290,13 +292,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.3.0.206" | ||||
|             VALUE "FileVersion", "1.3.0.207" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "(c) 2011-2012 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "1.3.0.206" | ||||
|             VALUE "ProductVersion", "1.3.0.207" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -1182,6 +1182,9 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l | |||
| 		case IDCANCEL: | ||||
| 			EndDialog(hDlg, LOWORD(wParam)); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		case IDC_CHECK_NOW: | ||||
| 			CheckForUpdates(TRUE); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		case IDC_UPDATE_FREQUENCY: | ||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||
| 				break; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue