mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] improve path display for Sylinux/GRUB resources
This commit is contained in:
		
							parent
							
								
									1c2884ceba
								
							
						
					
					
						commit
						32b083e535
					
				
					 5 changed files with 20 additions and 15 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.17.1839.0" /> |     Version="3.17.1840.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
|  | @ -1517,6 +1517,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param) | ||||||
| 			fd = fopen(tmp, "rb"); | 			fd = fopen(tmp, "rb"); | ||||||
| 			if (fd != NULL) { | 			if (fd != NULL) { | ||||||
| 				// If a file already exists in the current directory, use that one
 | 				// If a file already exists in the current directory, use that one
 | ||||||
|  | 				to_windows_path(tmp); | ||||||
| 				uprintf("Will reuse '%s' from '%s\\%s\\%s-%s\\' for Grub 2.x installation", | 				uprintf("Will reuse '%s' from '%s\\%s\\%s-%s\\' for Grub 2.x installation", | ||||||
| 					core_img, app_data_dir, FILES_DIR, grub, img_report.grub2_version); | 					core_img, app_data_dir, FILES_DIR, grub, img_report.grub2_version); | ||||||
| 				fseek(fd, 0, SEEK_END); | 				fseek(fd, 0, SEEK_END); | ||||||
|  | @ -1620,7 +1621,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param) | ||||||
| 				IGNORE_RETVAL(_chdir(FILES_DIR)); | 				IGNORE_RETVAL(_chdir(FILES_DIR)); | ||||||
| 				for (i=0; i<2; i++) { | 				for (i=0; i<2; i++) { | ||||||
| 					// Check if we already have the relevant ldlinux_v#.##.sys & ldlinux_v#.##.bss files
 | 					// Check if we already have the relevant ldlinux_v#.##.sys & ldlinux_v#.##.bss files
 | ||||||
| 					static_sprintf(tmp, "%s-%s%s/%s.%s", syslinux, img_report.sl_version_str, | 					static_sprintf(tmp, "%s-%s%s\\%s.%s", syslinux, img_report.sl_version_str, | ||||||
| 						img_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | 						img_report.sl_version_ext, ldlinux, ldlinux_ext[i]); | ||||||
| 					fd = fopen(tmp, "rb"); | 					fd = fopen(tmp, "rb"); | ||||||
| 					if (fd != NULL) { | 					if (fd != NULL) { | ||||||
|  | @ -1630,6 +1631,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param) | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | 				if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | ||||||
|  | 					to_windows_path(img_report.sl_version_ext); | ||||||
| 					uprintf("Will reuse '%s.%s' and '%s.%s' from '%s\\%s\\%s-%s%s\\' for Syslinux installation", | 					uprintf("Will reuse '%s.%s' and '%s.%s' from '%s\\%s\\%s-%s%s\\' for Syslinux installation", | ||||||
| 						ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], app_data_dir, FILES_DIR, syslinux, | 						ldlinux, ldlinux_ext[0], ldlinux, ldlinux_ext[1], app_data_dir, FILES_DIR, syslinux, | ||||||
| 						img_report.sl_version_str, img_report.sl_version_ext); | 						img_report.sl_version_str, img_report.sl_version_ext); | ||||||
|  | @ -1687,6 +1689,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param) | ||||||
| 		static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]); | 		static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]); | ||||||
| 		fd = fopenU(tmp, "rb"); | 		fd = fopenU(tmp, "rb"); | ||||||
| 		if (fd != NULL) { | 		if (fd != NULL) { | ||||||
|  | 			to_windows_path(tmp); | ||||||
| 			uprintf("Will reuse '%s\\%s\\%s' for Syslinux installation", app_data_dir, FILES_DIR, tmp); | 			uprintf("Will reuse '%s\\%s\\%s' for Syslinux installation", app_data_dir, FILES_DIR, tmp); | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 		} else { | 		} else { | ||||||
|  | @ -1720,6 +1723,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param) | ||||||
| 		static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION); | 		static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION); | ||||||
| 		fd = fopenU(tmp, "rb"); | 		fd = fopenU(tmp, "rb"); | ||||||
| 		if (fd != NULL) { | 		if (fd != NULL) { | ||||||
|  | 			to_windows_path(tmp); | ||||||
| 			uprintf("Will reuse '%s\\%s\\%s' for Grub4DOS installation", app_data_dir, FILES_DIR, tmp); | 			uprintf("Will reuse '%s\\%s\\%s' for Grub4DOS installation", app_data_dir, FILES_DIR, tmp); | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 		} else { | 		} else { | ||||||
|  |  | ||||||
|  | @ -163,6 +163,7 @@ | ||||||
| #define static_sprintf(dst, ...) safe_sprintf(dst, sizeof(dst), __VA_ARGS__) | #define static_sprintf(dst, ...) safe_sprintf(dst, sizeof(dst), __VA_ARGS__) | ||||||
| #define safe_strlen(str) ((((char*)str)==NULL)?0:strlen(str)) | #define safe_strlen(str) ((((char*)str)==NULL)?0:strlen(str)) | ||||||
| #define safe_strdup _strdup | #define safe_strdup _strdup | ||||||
|  | #define to_windows_path(str) do { size_t __i; for (__i = 0; __i < safe_strlen(str); __i++) if (str[__i] == '/') str[__i] = '\\'; } while(0) | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
| #define safe_vsnprintf(buf, size, format, arg) _vsnprintf_s(buf, size, _TRUNCATE, format, arg) | #define safe_vsnprintf(buf, size, format, arg) _vsnprintf_s(buf, size, _TRUNCATE, format, arg) | ||||||
| #else | #else | ||||||
|  |  | ||||||
							
								
								
									
										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.17.1839" | CAPTION "Rufus 3.17.1840" | ||||||
| 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,17,1839,0 |  FILEVERSION 3,17,1840,0 | ||||||
|  PRODUCTVERSION 3,17,1839,0 |  PRODUCTVERSION 3,17,1840,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.17.1839" |             VALUE "FileVersion", "3.17.1840" | ||||||
|             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.17.exe" |             VALUE "OriginalFilename", "rufus-3.17.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.17.1839" |             VALUE "ProductVersion", "3.17.1840" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -162,28 +162,28 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system) | ||||||
| 	/* Access a copy of the ldlinux.sys & ldlinux.bss resources (downloaded or embedded) */ | 	/* Access a copy of the ldlinux.sys & ldlinux.bss resources (downloaded or embedded) */ | ||||||
| 	if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | 	if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { | ||||||
| 		IGNORE_RETVAL(_chdirU(app_data_dir)); | 		IGNORE_RETVAL(_chdirU(app_data_dir)); | ||||||
| 		for (i=0; i<2; i++) { | 		for (i = 0; i < 2; i++) { | ||||||
| 			syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); | 			syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); | ||||||
| 			if (syslinux_ldlinux[i] == NULL) | 			if (syslinux_ldlinux[i] == NULL) | ||||||
| 				goto out; | 				goto out; | ||||||
| 			static_sprintf(path, "%s/%s-%s%s/%s.%s", FILES_DIR, syslinux, img_report.sl_version_str, | 			static_sprintf(path, "%s\\%s-%s%s\\%s.%s", FILES_DIR, syslinux, img_report.sl_version_str, | ||||||
| 				img_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); | 				img_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); | ||||||
| 			fd = fopen(path, "rb"); | 			fd = fopen(path, "rb"); | ||||||
| 			if (fd == NULL) { | 			if (fd == NULL) { | ||||||
| 				uprintf("Could not open %s", path); | 				uprintf("Could not open %s\\%s", app_data_dir, path); | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
| 			length = fread(syslinux_ldlinux[i], 1, (size_t)syslinux_ldlinux_len[i], fd); | 			length = fread(syslinux_ldlinux[i], 1, (size_t)syslinux_ldlinux_len[i], fd); | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 			if (length != (size_t)syslinux_ldlinux_len[i]) { | 			if (length != (size_t)syslinux_ldlinux_len[i]) { | ||||||
| 				uprintf("Could not read %s", path); | 				uprintf("Could not read %s\\%s", app_data_dir, path); | ||||||
| 				goto out; | 				goto out; | ||||||
| 			} | 			} | ||||||
| 			uprintf("Using existing '%s\\%s' %s", app_data_dir, path, | 			uprintf("Using existing '%s\\%s' %s", app_data_dir, path, | ||||||
| 				IsBufferInDB(syslinux_ldlinux[i], (size_t)syslinux_ldlinux_len[i])?"✓":"✗"); | 				IsBufferInDB(syslinux_ldlinux[i], (size_t)syslinux_ldlinux_len[i])?"✓":"✗"); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		for (i=0; i<2; i++) { | 		for (i = 0; i < 2; i++) { | ||||||
| 		static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[i]); | 		static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[i]); | ||||||
| 		syslinux_ldlinux_len[i] = 0; | 		syslinux_ldlinux_len[i] = 0; | ||||||
| 		syslinux_ldlinux[i] = GetResource(hMainInstance, resource[use_v5?1:0][i], | 		syslinux_ldlinux[i] = GetResource(hMainInstance, resource[use_v5?1:0][i], | ||||||
|  | @ -250,7 +250,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system) | ||||||
| 			vcn = extent.NextVcn) { | 			vcn = extent.NextVcn) { | ||||||
| 				err = NtfsSectLcnToLba(&vol_info, &extent.FirstLcn, &lba); | 				err = NtfsSectLcnToLba(&vol_info, &extent.FirstLcn, &lba); | ||||||
| 				if (err != ERROR_SUCCESS) { | 				if (err != ERROR_SUCCESS) { | ||||||
| 					uprintf("Could not translate LDLINUX.SYS LCN to disk LBA"); | 					uprintf("Could not translate 'ldlinux.sys' LCN to disk LBA"); | ||||||
| 					goto out; | 					goto out; | ||||||
| 				} | 				} | ||||||
| 				lba.QuadPart -= vol_info.PartitionLba.QuadPart; | 				lba.QuadPart -= vol_info.PartitionLba.QuadPart; | ||||||
|  | @ -331,7 +331,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system) | ||||||
| 
 | 
 | ||||||
| 	if (boot_type == BT_SYSLINUX_V6) { | 	if (boot_type == BT_SYSLINUX_V6) { | ||||||
| 		IGNORE_RETVAL(_chdirU(app_data_dir)); | 		IGNORE_RETVAL(_chdirU(app_data_dir)); | ||||||
| 		static_sprintf(path, "%s/%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]); | 		static_sprintf(path, "%s\\%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]); | ||||||
| 		IGNORE_RETVAL(_chdir(path)); | 		IGNORE_RETVAL(_chdir(path)); | ||||||
| 		static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]); | 		static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]); | ||||||
| 		fd = fopen(&path[3], "rb"); | 		fd = fopen(&path[3], "rb"); | ||||||
|  | @ -340,7 +340,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system) | ||||||
| 		} else { | 		} else { | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 			if (CopyFileU(&path[3], path, TRUE)) { | 			if (CopyFileU(&path[3], path, TRUE)) { | ||||||
| 				uprintf("Created '%s' (from '%s/%s-%s/%s') %s", path, FILES_DIR, syslinux, | 				uprintf("Created '%s' (from '%s\\%s\\%s-%s\\%s') %s", path, app_data_dir, FILES_DIR, syslinux, | ||||||
| 					embedded_sl_version_str[1], &path[3], IsFileInDB(&path[3])?"✓":"✗"); | 					embedded_sl_version_str[1], &path[3], IsFileInDB(&path[3])?"✓":"✗"); | ||||||
| 			} else { | 			} else { | ||||||
| 				uprintf("Failed to create '%s': %s", path, WindowsErrorString()); | 				uprintf("Failed to create '%s': %s", path, WindowsErrorString()); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue