mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] automatically save log to %LocalAppData%\Rufus\rufus.log on exit
This commit is contained in:
		
							parent
							
								
									8ceb0045fa
								
							
						
					
					
						commit
						41a9436649
					
				
					 3 changed files with 28 additions and 14 deletions
				
			
		|  | @ -11,7 +11,7 @@ | ||||||
|   <Identity |   <Identity | ||||||
|     Name="19453.net.Rufus" |     Name="19453.net.Rufus" | ||||||
|     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" |     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" | ||||||
|     Version="3.15.1804.0" /> |     Version="3.15.1805.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
							
								
								
									
										30
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -129,7 +129,7 @@ int dialog_showing = 0, selection_default = BT_IMAGE, persistence_unit_selection | ||||||
| int default_fs, fs_type, boot_type, partition_type, target_type; // file system, boot type, partition type, target type
 | int default_fs, fs_type, boot_type, partition_type, target_type; // file system, boot type, partition type, target type
 | ||||||
| int force_update = 0, default_thread_priority = THREAD_PRIORITY_ABOVE_NORMAL; | int force_update = 0, default_thread_priority = THREAD_PRIORITY_ABOVE_NORMAL; | ||||||
| char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; | char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; | ||||||
| char app_data_dir[MAX_PATH]; | char app_data_dir[MAX_PATH], user_dir[MAX_PATH]; | ||||||
| char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | ||||||
| char embedded_sl_version_ext[2][32]; | char embedded_sl_version_ext[2][32]; | ||||||
| char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; | char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; | ||||||
|  | @ -987,11 +987,9 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 				log_size = GetDlgItemTextU(hDlg, IDC_LOG_EDIT, log_buffer, log_size); | 				log_size = GetDlgItemTextU(hDlg, IDC_LOG_EDIT, log_buffer, log_size); | ||||||
| 				if (log_size != 0) { | 				if (log_size != 0) { | ||||||
| 					log_size--;	// remove NUL terminator
 | 					log_size--;	// remove NUL terminator
 | ||||||
| 					// TODO: Ideally we want to use user dir here
 | 					filepath =  FileDialog(TRUE, user_dir, &log_ext, 0); | ||||||
| 					filepath =  FileDialog(TRUE, app_dir, &log_ext, 0); | 					if (filepath != NULL) | ||||||
| 					if (filepath != NULL) { |  | ||||||
| 						FileIO(TRUE, filepath, &log_buffer, &log_size); | 						FileIO(TRUE, filepath, &log_buffer, &log_size); | ||||||
| 					} |  | ||||||
| 					safe_free(filepath); | 					safe_free(filepath); | ||||||
| 				} | 				} | ||||||
| 				safe_free(log_buffer); | 				safe_free(log_buffer); | ||||||
|  | @ -2155,8 +2153,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 	RECT rc, DialogRect, DesktopRect; | 	RECT rc, DialogRect, DesktopRect; | ||||||
| 	HDC hDC; | 	HDC hDC; | ||||||
| 	PAINTSTRUCT ps; | 	PAINTSTRUCT ps; | ||||||
|  | 	DWORD log_size; | ||||||
| 	int nDeviceIndex, i, nWidth, nHeight, nb_devices, selected_language, offset, tb_state, tb_flags; | 	int nDeviceIndex, i, nWidth, nHeight, nb_devices, selected_language, offset, tb_state, tb_flags; | ||||||
| 	char tmp[128]; | 	char tmp[MAX_PATH], *log_buffer = NULL; | ||||||
| 	wchar_t* wbuffer = NULL; | 	wchar_t* wbuffer = NULL; | ||||||
| 	loc_cmd* lcmd = NULL; | 	loc_cmd* lcmd = NULL; | ||||||
| 	wchar_t wtooltip[128]; | 	wchar_t wtooltip[128]; | ||||||
|  | @ -2219,6 +2218,18 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE); | 				EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE); | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			} | 			} | ||||||
|  | 
 | ||||||
|  | 			// Save the current log to %LocalAppData%\Rufus\rufus.log
 | ||||||
|  | 			log_size = GetWindowTextLengthU(hLog); | ||||||
|  | 			if ((log_size > 0) && ((log_buffer = (char*)malloc(log_size)) != NULL)) { | ||||||
|  | 				log_size = GetDlgItemTextU(hLogDialog, IDC_LOG_EDIT, log_buffer, log_size); | ||||||
|  | 				if (log_size-- > 1) { | ||||||
|  | 					static_sprintf(tmp, "%s\\%s\\rufus.log", app_data_dir, FILES_DIR); | ||||||
|  | 					FileIO(TRUE, tmp, &log_buffer, &log_size); | ||||||
|  | 				} | ||||||
|  | 				safe_free(log_buffer); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			if (ulRegister != 0) | 			if (ulRegister != 0) | ||||||
| 				SHChangeNotifyDeregister(ulRegister); | 				SHChangeNotifyDeregister(ulRegister); | ||||||
| 			PostQuitMessage(0); | 			PostQuitMessage(0); | ||||||
|  | @ -2837,9 +2848,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 	case WM_CLIENTSHUTDOWN: | 	case WM_CLIENTSHUTDOWN: | ||||||
| 	case WM_QUERYENDSESSION: | 	case WM_QUERYENDSESSION: | ||||||
| 	case WM_ENDSESSION: | 	case WM_ENDSESSION: | ||||||
| 		if (op_in_progress) { | 		if (op_in_progress) | ||||||
| 			return (INT_PTR)TRUE; | 			return (INT_PTR)TRUE; | ||||||
| 		} |  | ||||||
| 		if (message == WM_CLOSE) { | 		if (message == WM_CLOSE) { | ||||||
| 			// We must use PostQuitMessage() on WM_CLOSE, to prevent notification sound...
 | 			// We must use PostQuitMessage() on WM_CLOSE, to prevent notification sound...
 | ||||||
| 			PostQuitMessage(0); | 			PostQuitMessage(0); | ||||||
|  | @ -3209,6 +3219,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 		uprintf("Could not get app data directory: %s", WindowsErrorString()); | 		uprintf("Could not get app data directory: %s", WindowsErrorString()); | ||||||
| 		static_strcpy(app_data_dir, temp_dir); | 		static_strcpy(app_data_dir, temp_dir); | ||||||
| 	} | 	} | ||||||
|  | 	if (!SHGetSpecialFolderPathU(NULL, user_dir, CSIDL_PROFILE, FALSE)) { | ||||||
|  | 		uprintf("Could not get user directory: %s", WindowsErrorString()); | ||||||
|  | 		static_strcpy(user_dir, temp_dir); | ||||||
|  | 	} | ||||||
| 	// Construct Sysnative ourselves as there is no GetSysnativeDirectory() call
 | 	// Construct Sysnative ourselves as there is no GetSysnativeDirectory() call
 | ||||||
| 	// By default (64bit app running on 64 bit OS or 32 bit app running on 32 bit OS)
 | 	// By default (64bit app running on 64 bit OS or 32 bit app running on 32 bit OS)
 | ||||||
| 	// Sysnative and System32 are the same
 | 	// Sysnative and System32 are the same
 | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.15.1804" | CAPTION "Rufus 3.15.1805" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -395,8 +395,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,15,1804,0 |  FILEVERSION 3,15,1805,0 | ||||||
|  PRODUCTVERSION 3,15,1804,0 |  PRODUCTVERSION 3,15,1805,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -414,13 +414,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.15.1804" |             VALUE "FileVersion", "3.15.1805" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.15.exe" |             VALUE "OriginalFilename", "rufus-3.15.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.15.1804" |             VALUE "ProductVersion", "3.15.1805" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue